This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/RFA?] Should break FILE:LINENO skip prologue?


> > *FUNCTION and *FILENAME:FUNCTION are just special cases of *EXPRESSION
> 
> "*FUNCTION" is generally not a useful C expression, unless FUNCTION
> returns a pointer.  So I don't want to rely on the user to guess this
> magic in GDB.

Actually, FUNCTION is a degenerated form of EXPRESSION, and the result
depends on the language. In C, FUNCTION refers to the function pointer
whereas "FUNCTION ()" refers to the return value from a call to FUNCTION.
So, in C, *FUNCTION is the first instruction of our function. However,
in Ada, calls to parameterless function are made by just using the name
of that function. For instance:

        A := Get_A;

So the, when you say "break *FUNCTION", then GDB will first call
FUNCTION, and break at the value returned by that function. So you
have to use "break *FUNCTION'Address", or more simply "break 
*&FUNCTION" should work.

But I still agree that it would be useful to describe the special
case *FUNCTION, as it is a very useful idiom.

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]