Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "srikrish" <srikrish@in.ibm.com>
To: <gdb@sources.redhat.com>
Subject: Re: gdb stack trace shows only those frames after the signal
Date: Tue, 23 Dec 2003 15:03:00 -0000	[thread overview]
Message-ID: <00e501c3c966$3fc1ab90$fd0eb609@srikrishnan> (raw)
In-Reply-To: <00c701c3c965$424c6a90$fd0eb609@srikrishnan>

Hi - I'm sorry for the formatting problems in my previous post.

After handling a signal the previous stack trace is lost. Is this a known problem? Any fixes?
Hardware Environment: Intel x86

Software Environment:
RHEL 3; gdb-5.3.90-0.20030710.40rh; glibc 2.3.2-95.6; gcc 3.2.3 20030502 
Steps to Reproduce:
1. compile the testcase (under Additinal Info below) with "gcc -o t mytrap.c"
2. run "t"
3. attach gdb to the "t"'s PID and type "where"

Actual Results:

[root@localhost root]# gdb
GNU gdb Red Hat Linux (5.3.90-0.20030710.40rh)
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) attach 2032
Attaching to process 2032
Reading symbols from /home/krishna/t...done.
Using host libthread_db library "/lib/libthread_db.so.1".
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0xb755d8cb in pause () from /lib/libc.so.6
(gdb) where
#0  0xb755d8cb in pause () from /lib/libc.so.6
#1  0x0804840f in function2 () at mytrap.c:8
#2  0x0804842c in function1 () at mytrap.c:15
#3  0x08048449 in SIGSEGVhandler (sig=11, info=0xbfffa5a0, ucontext=0xbfffa620)
    at mytrap.c:22
#4  <signal handler called>
(gdb) frame 5
#0  0x00000000 in ?? ()
(gdb)

Expected Results:
the stack traceback should display functionb, functiona, and main for this 
testcase


mytrap.c:
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

void function2( void )
{
   printf( "Now in function2.. pausing.. pid = %d\n", getpid() );
   pause();
}

void function1( void )
{
   printf( "Now in function1\n" );
   function2();
}

void SIGSEGVhandler( int sig, siginfo_t *info, void *ucontext )
{
   printf( "Now in SIGSEGVhandler\n" );
   function1();
}

void functionb( void )
{
   char *p = NULL;
   printf( "Now in functionb... causing sig11...\n" );
   *p = 'x';  /* forcing SEGFAULT */
}

void functiona( void )
{
   printf( "Now in functiona\n" );
   functionb();
}

int main( void )
{
   struct sigaction newact;
   struct sigaction oldact;
   newact.sa_sigaction = SIGSEGVhandler;
   newact.sa_flags = SA_SIGINFO;
   sigaction( SIGSEGV, &newact, &oldact );
   printf( "About to call functiona\n" );
   functiona();
   return 0;
}

Srikrishnan



  parent reply	other threads:[~2003-12-23 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-23 14:56 srikrish
2003-12-23 15:02 ` Daniel Jacobowitz
2003-12-23 15:03 ` srikrish [this message]
2003-12-24  7:03   ` Joel Brobecker
2003-12-24 14:16     ` srikrish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00e501c3c966$3fc1ab90$fd0eb609@srikrishnan' \
    --to=srikrish@in.ibm.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox