Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:31:23+00:00 2026-06-14T08:31:23+00:00

I have a source file testcc.c which just print a Hello, World, I compile

  • 0

I have a source file testcc.c which just print a “Hello, World”, I compile it with cc as below

cc -g -o testcc testcc.c

it works fine when I run it.
now I want to debug it with gdb with the following command.

gdb testcc

I can see the output from gdb.

GDB is free software and you are welcome to distribute copies of it
under certain conditions; type “show copying” to see the conditions.
There is absolutely no warranty for GDB; type “show warranty” for
details. GDB 4.16 (sparc-sun-solaris2.6), Copyright 1996 Free Software
Foundation, Inc…

But, When I try to set a breakpoint at line 5, I got the following message

(gdb) break 5
Breakpoint 1 at 0x10814: file /home/users/xxx/C, line 5.
(gdb)

The problem is /home/users/xxx/C is my current working directory, not the source file!

Then, I try to use the file:line-number options

(gdb) break testcc.c:5
No source file named testcc.c.

So, I include the full path for the file name as below

(gdb) break /home/users/xxx/testcc.c:5
No source file named /home/users/xxx/testcc.c.

I am confused, the file is there, why gdb can not find it?
I also try to specify the directory to search for source files when starting gdb

gdb -d /home/users/xxx/C testcc

it still not work, what’s the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:31:24+00:00Added an answer on June 14, 2026 at 8:31 am

    After struggle for a whole day, I finally find that we should use dbx to debug program compiled by Sun cc compiler. here is the link said this.

    http://www.cs.cmu.edu/~gilpin/tutorial/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a source file which can compile with javac / ecj
I have a source file shared_lib_test.c in which there's some code like below: 10
I have a c source file in which one of the method is defined
I have a source file in my project, which has more than 65,536 code
I have some source code file which has mixed tabs/spaces and I want to
Just started learning Haskell. I have an empty source file with this inside: pe
I have a CPP source file that uses #if / #endif to compile out
I have many source/text file, say file.cpp or file.txt . Now, I want to
Assume I have a sample source file, test.c, which I am compiling like so:
I have a source file that I can run via the terminal using gcc

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.