This is the mail archive of the gdb@sources.redhat.com 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: displaying source after and before the program counter


>>>>> "Eli" == Eli Zaretskii <eliz@elta.co.il> writes:

 >> From: "Vianney Lecroart" <lecroart@nevrax.com> Date: Mon, 15 Dec
 >> 2003 11:50:09 +0100
 >> 
 >> The problem is that CPhrase::update() is a big function in a cpp
 >> file. I would like to know the line where the call to mpvi.h:527
 >> is made. I can't see it because the function is inlining and it's
 >> an accessor, so, it's called at least 50 times on this function.
 >> 
 >> The question is: Is it possible to know where in the function
 >> ::update() the crash happened?

 Eli> Without turning off the inlining, yes?

 Eli> Well, one way to do that is to look at the machine code in frame
 Eli> #3 (by using the `disassemble' command), then compare that with
 Eli> the assembly generated by the compiler for the source code in
 Eli> question.

Here's another approach:

Invoke the program via gdb.  Set a breakpoint at the address shown in
the call stack.  Start the program.

When the breakpoint hits, step to the next line ("n") until you're
back in the cpp file.  You're now near the inline function call you
need, most likely at the next line.  (Perhaps not quite, depending on
how much the optimizer has moved things around.

    paul


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