Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 11-29-2006, 08:57 AM   #1
LQ Newbie
Registered: Jun 2006
Posts: 16

Rep: Reputation: 0
How to interpret Stack trace from gdb out put

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 )
assignments ;
Function_B( args1 );

Function_B (args1 )
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 0x0807a4c1 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 0x0807a4c1 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/
#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/
#31 0xfefe882c in ?? ()
#32 0x00000001 in ?? ()
#33 0xfefe87ec in ?? ()
#33 0xfefe87ef in ?? ()
#34 0x00370859 in __tz_convert () from /lib/tls/
#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


Last edited by NeoMagic; 11-30-2006 at 01:47 AM.
Old 12-29-2006, 12:52 AM   #2
Registered: Dec 2005
Location: New York
Distribution: Debian/GNU
Posts: 235

Rep: Reputation: 31
wow. no wonder this has gone unanswered for a month....

First, I've never used DDD. I've only used GDB, and done things the "hard way." Mostly becuase I don't usually have X running when I'm doing development anyway. So I'd first say RTFM on gdb to make sure your problems are coming from the debugger and not the buggy interface.


issue #1
The first thing to check is make sure your debug copiler flags are correct for the debugger you're using. After that, try stepping through the code assembly instruction by assembly instruction. I know GDB will show the source code line every time it hits it, so you can see exactly where the codepath is going.

issue #2
try and reproduce the bug in GDB. its quite possible you found a bug in the debugger. Usually illogical program behaviour in GNU tools is the result of a bug. The GNU development tools are the most solid tools in computing, but bugs are found... continually and constantly.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Building a stack trace in C++ Kikazaru Programming 5 07-02-2006 04:10 PM
stack trace of a process node047 Linux - Newbie 2 04-01-2005 10:11 PM
How to interpret backtrace (gdb) jnusa Programming 1 12-06-2004 10:16 AM
How To interpret kernel stack trace kklier Linux - Enterprise 6 08-22-2004 10:24 AM
Stack trace ust Linux - General 0 02-27-2004 03:30 AM > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 01:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration