LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

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

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


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 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/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
Neo

Last edited by NeoMagic; 11-30-2006 at 12:47 AM.
 
Old 12-28-2006, 11:52 PM   #2
dombrowsky
Member
 
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.

anywho...

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.
 
  


Reply

Tags
debug


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 03:10 PM
stack trace of a process node047 Linux - Newbie 2 04-01-2005 09:11 PM
How to interpret backtrace (gdb) jnusa Programming 1 12-06-2004 09:16 AM
How To interpret kernel stack trace kklier Linux - Enterprise 6 08-22-2004 09:24 AM
Stack trace ust Linux - General 0 02-27-2004 02:30 AM


All times are GMT -5. The time now is 11:05 PM.

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