[Click] line numbers in click binary symbol table

Roman Chertov rchertov at cs.ucsb.edu
Tue Mar 30 02:28:46 EDT 2010


Ian,

When you are compiling for debugging, do not use the O2 flag is it makes
it hard to match the program with the code (gcc can move instructions
about).  An easy way to see if you have debugging symbols in the code is
to place a break point in your code.  If you can't see your code at the
break point, you don't have debugging symbols (you will probably have
problems placing the break point in the first place).

Make sure that the -g option is passed to the compiler and the linker.
Also, rebuild the whole project to ensure that you get debugging
information built in. I've done this in past with click, but it takes a
bit of mucking around with the make file.

Roman

Ian Rose wrote:
> Hi list,
> 
> This may or may not be specific to Click, so apologies in advance if I 
> am off topic.  I am attempting to do some debugging of my (userlevel) 
> click app and I am finding that the symbol table of the resulting click 
> binary has very few line numbers in it (as viewed by 'nm -l -C 
> bin/click').  This is a problem for me because it means that basically 
> every address that I pass to addr2line returns '??:0' for the file and 
> line number.  I've also had some problems getting useful information out 
> of coredumps (which is why I am messing about with addr2line instead of 
> just gdb), perhaps for the same reason?
> 
> My knowledge is rather limited as far as compiling and linking go, so my 
> question is whether this is somehow Click's doing (perhaps its stripping 
> most of the line numbers?) or whether this is normal gcc/ld behavior 
> that I'm just unfamiliar with.  Other than click, I pretty much 
> exclusively use C over C++ so if there is some different behavior for 
> C++ code I wouldn't know it.  I've tried digging through the click 
> Makefiles but I haven't found anything incriminating.  Also, I've 
> confirmed that I am compiling with -g and I have tried both with and 
> without -O2 with no noticeable difference.
> 
> Many thanks for any tips!
> - Ian
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 



More information about the click mailing list