How to set the break point using dbx?

Hi,

I am trying to debug my project using dbx to understand the code and functionality of modules.

I compiled all my C files using gcc -g flag to enable the debug option.
I was able to get in to the debug mode using dbx.
I was able to create breakpoints using stop at line no.
"stop at 1117" " stop at main.c:1147" like this..

I was able to see my break points in status output.

What my problem is after running the command using dbx, it is not stopping the execution at break point, it is completing the command execution.

I did read and followed the dbx usage and debug documentation.

Can some one please explain me, how exactly we can debug the binary using breakpoints.

basically, if it did not stop there, it is probably because logic did not go there.

much slower, but you could try single stepping through the program.

p.s. last time i seriously debugged assembly (> 20 years ago) I used adb. So, hopefully, someone with more hands on will assist after me.

I don't use dbx. But I use gdb a lot. It always works for me. I say "break out1.c:10784" which is equivalent to the dbx "stop at" syntax.

You're on the right direction. You're just making some kind of little mistake. Have you made dbx work anywhere? Has dbx ever worked for you? If not, I would suggest compiling a short test program, and making dbx work in that environment first, before you try with the complex program you are studying.

Hi,
Thanks for your quick replies.

I was able to debug the sample program using dbx, but unable to debug when my program depends on other source files [other C program's].

Is there any other option in debugging when we have source file dependencies?
I already compiled all the C files with -g option, do I need to add any other option?

Thanks in advance.

All the dependencies also need to be compiled with -g if you want the same level of support. Otherwise you are highly dependent on the level of information in, I assume, libraries.

If the dependancies are "stripped" you will, probably, see little more than assembly code. If the dependancies are "commericial" you should not need to debug them. Mainly, your focus will be parameter values passed to a routine, changes to these values when passed by reference, and the function return value.

I agree with other response.

Beyond that, not sure what you mean by "other source files". Yes, you want to use -g option on any files you are compiling. Can you compile the "other source files"? If not, maybe they are not really "source files".

Hi Hanson,

Other source files means, I have C files in my project like sample.c, main.c, cli.c .
I compiled all these files with -g option. but, I am unable to debug using breakpoints.

You should be able to set breakpoints in those files. There must be some mistake in how you are compiling the files or setting the breakpoints. Again, I use gdb not dbx. But the principle is exactly the same. gdb (dbx) is not the most user-friendly system. There is something you are doing wrong. It would just be a wild guess what it is on my part. You need some local diagnostics.

When you try to set the breakpoint, does it give an error message?

What happens when you try to list out the breakpoints? Maybe you think a breakpoint is being set, but nothing is really happening.

Can you set the breakpoint in main.c file, as it seemed you originally said? Or no files allow breakpoint to be set?