Hi
I have the following issue
I have some C code which is similar to the following snippet
All the Functions are Declared in K&R-Style
Function_A (args )
{
declarations;
assignments ;
Function_B( args1 );
}
Function_B (args1 )
{
declarations;
assignments ;
.........
.........
}
While debugging the issue with the help of DDD on linux I m facing following issues
Issue 1 :
---------
1. In the stack trace some library calls are getting embedded between the flow from functionA to function_B
I expect the stack trace should look some thing like the follwoing
#34 0x00370859 in function_B
#35 0x0808036f in function_A
#36 0x080501b7 in main (argc=27, argv=0x82906c0)
But I am getting some thing like the below
#14 0x00370859 in function_B
#15 0x00000089 in ?? ()
#16 0x000000cf in ?? ()
#17 0x00000001 in ?? ()
#18 0x09fbc008 in ?? ()
#19 0x09fa26e8 in ?? ()
#20 0x00000001 in ?? ()
#21 0x00000003 in ?? ()
#22 0x00411a78 in __DTOR_END__ () from /lib/tls/libc.so.6
#23 0x00000005 in ?? ()
#24 0x000001d9 in ?? ()
#25 0x000007b1 in ?? ()
#26 0x00000004 in ?? ()
#27 0x000007d6 in ?? ()
#28 0x0000000a in ?? ()
#29 0x0000001a in ?? ()
#30 0x00411a78 in __DTOR_END__ () from /lib/tls/libc.so.6
#31 0xfefe882c in ?? ()
#32 0x00000001 in ?? ()
#33 0xfefe87ec in ?? ()
#33 0xfefe87ef in ?? ()
#34 0x00370859 in __tz_convert () from /lib/tls/libc.so.6
#35 0x0808036f in function_A
#36 0x080501b7 in main (argc=27, argv=0x82906c0)
1.1 Why are these library calls coming into picture even if the
function_B is called directly by Function_A ?
1.2 Is there any way to avoid them ? any repurcations if we
avoid them ?
Issue 2
-------
While running DDD on the program I set a break point at the call to Function_B,in Function_A, at this point if you watch the values of the arguments ,the args are having correct values , on issuing 'Next' the control comes to the declarations section of the Function_B if you watch the arguments at this point the args are having some junk values
Now another 'Next' will take you to the assignments section in Function_B , at this point of time the args are having the correct values .
Why is this transistion in the values in the due course ?
Please let me know if any body faced the similar issues
Anticipating a quick reply
-Regards
Rinku
Post the actual code (or the
Post the actual code (or the minimum amount of code to reproduce this behaviour) along with compiler flags (CFLAGS/CXXFLAGS), compiler version, gdb version, etc.
backtrace lies
Backtrace line #14, ostensibly for function_B, has the same address as line #34 for __tz_convert.
The debugger is lying to you. function_B is not active. It looks like you stopped while performing I/O in function_A.
How to interpret Stack trace from gdb out put
Hi
Thank you for looking at this post.
It was by mistake the function_B adress was wrongly copied over there , I m sorry for that
But originally in the stack trace the adress of function_b is 0x0807a4c1 which is diffrent from that of __tz_convert.
Could you please throw light on why these library calls got embeded and regarding Issue 2 specifed in the post
I am using DDD 3.3.1
-Thanks
Rinku
chk ur code; looks like some
chk ur code; looks like some stack corruption!
-fomit-frame-pointer
Can you show us CFLAGS, CPPFLAGS and ldd output?
Maybe you're using -fomit-frame-pointer.
But, in this case, something is going wrong. As you can see, the backtrace is showing invalid function addresses (at least seems to be invalid).