GDB - insert breakpoint in a subroutine

Ingo Krabbe
Wed Aug 2 13:17:00 GMT 2006

Am Dienstag, 1. August 2006 21:55 schrieb victor marian:
>  How can I set a breakpoint when entering a subroutine
>  in gdb?
>  break function
>      inserts a breakpoint in a function
>      If I enter a subroutine it says the
> subroutine is not recognised.

I cannot see from your mail what you mean by subroutine, by I assume that you 
mean some fortran or what-ever language subroutine, which as compiled by gcc, 
finally should result in some function library binding.

Such a library binding is necessary to break at function entrance, which is 
completely sensefull, since gdb needs the function or subroutine entrance 
point that is linked with the examined program.

Though this is not always available by simply loading the program text, since 
some functions or subroutines will be known at run time only (static 
functions aren't exported but are completely local).

What you can do is to break at you main entry point to get the program running 
first and then install your subroutine breakpoints.

There is also a method to tell gdb to do this automatically but I don't know 
the command.

>                                    Thank you
> Victor MARIAN
> Department of Machine Elements and Tribology
> University Politehnica of Bucharest
> Spl. Indepentendei 313
> 060042 Bucharest
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around

More information about the Gcc-help mailing list