This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: objdump -S with C++ code


Since I didn't get any response yet about objdump -S, I decided to try
compiling a debug version of objdump and watching what was happening
in gdb, and I think I see what the problem is.

In the function skip_to_line(), which is where the printing of the
code takes place, there is a test:

    while (p->line < line)

p->line gets incremented every time a line of code is printed out, and
the next time a line of code is hit, we test if the line we are on is
after all the code that was printed.  This assumes that the functions
in the object file are in the same order that they were in in the
source file.  Using nm -l -n, I can see that this seems to be true for
object files produced by gcc from .c files, but not for those produced
by g++ from .cpp files.  I don't know what the order is, but it isn't
the order from the source file.  Maybe there is some option for g++ to
change this, but I don't know.


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