Determining the value of local variables using gdb in a function in shared library built with -g (gdb says no line number information) -


list items 1- 4 steps did. list item 5 describes problem list item 6 provides additional information

  1. i have compiled c source code c1.c -g flag.
  2. i have dynamic shared library liba1.so built -g source files has.
  3. i built executable exe1 linking c1.o (c1.c object code) liba1.so .
  4. i gdb exe1. , able step through sources of c1.c. when c1 calls shared library, able put breakpoint on function in shared library.

  5. however, when try step through function, says "single stepping until exit function foo1 ,which has no line number information" should ordinarily show value of parameters passed function foo1 not that. happens functions in shared library including big ones values cannot optimized out

  6. i did objdump -t on shared library , executable - shows symbol table (the fact can set breakpoint on function supports this). also, can see values of variables used in file c1.c should in order ensure can see values of local variables inside shared library. here other arguments being used compile shared library "-o2 -std=gnu99 -werror -fno-stack-protector -wstack-protector --param ssp-buffer-size=1 -g -nostdinc". doing info f , trying @ memory addresses on frame not give information.

i looking suggestion @ least troubleshoot it. can know using objdump (or other utility) if shared library has line number information.

i looking suggestion @ least troubleshoot it.

the reason no line number information, there in fact no line number information, , reason have 2 copies of liba1.so -- 1 has debug info, , 1 doesn't, , loading @ runtime latter.

first step: (gdb) info shared tell exactly liba1.so loaded.

if in fact version you've built -g, should verify have debug info expecting. exact commands doing platform specific (and didn't tell platform on). on elf platform, objdump -g liba1.so or readelf -w liba1.so should work.

one common reason -g code not have debug info presence of -s (strip) flag on link line; make sure don't have "stray" flags on link line. platforms require -g used @ link time in addition compile time.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -