Inability to view a header file source in a debugger

  • Thread starter Generic Usenet Account
  • Start date
G

Generic Usenet Account

In our environment we have several C++ header files that have some
inline member function definitions. For some reason, I am unable to
step through the source code of those member functions in my debugger
(Insight debugger, which is a GUI front-end to GDB version 5.3). In
fact, when I try to view the header file, all I see is assembly
language. There is another header file in the same directory, which
does not have any inline member function definitions. I am able to
view that header file just fine. Since the only difference between the
two files is the fact that in one header file inline member functions
are defined, while they are not in the other header file, I suspect
that my inability to see the source code in the header file has
something to do with inlining. BTW, the source code is compiled with
the -g option, and we are not stripping the executable.

Does anyone have any idea under what circumstances will source files
not be viewable in a debugger?

Thanks,
Song
 
P

Puppet_Sock

Generic Usenet Account wrote:
[debugger question]

You will get better help by posting this in a news group where
they talk about your particular development platform. Here we
only talk about language issues for standard C++. You want
a news group that deals with your compiler/debugger. You
could start with a search at groups.google.com.
Socks
 
P

Phlip

Generic said:
(Insight debugger, which is a GUI front-end to GDB version 5.3)

You need to use Google to find a forum responsible for that debugger.

This newsgroup is only qualified to answer questions about the raw C++
language itself. If I took a guess and were wrong (what are the odds??),
others here would not be able to correct me.

Posting to the most topical newsgroup or mailing list is in your best
interest.
 
J

Jacek Dziedzic

Generic said:
In our environment we have several C++ header files that have some
inline member function definitions. For some reason, I am unable to
step through the source code of those member functions in my debugger

Pardon my ignorance, but if these functions are _inlined_,
*what* do you expect to step through? Isn't it the case of
"if you optimized it, forget debugging it"?

- J.
 
P

Phlip

Jacek said:
Pardon my ignorance, but if these functions are _inlined_,
*what* do you expect to step through? Isn't it the case of
"if you optimized it, forget debugging it"?

Inline doesn't mean the opcodes are inlined. It means the function is
excempt from aspects of the "one definition rule" that ordinarily says a
function's body must appear in only one translation unit.

A compiler has an easier time optimizing such a function, typically by
inlining its opcodes. And compiling with the -g option probably enabled
such optimization. So, turn off -g, or wait for a debugger that can track
raw opcodes back to their inlinable function definitions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top