Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Seong-Kook Shin" <cinsky@gmail.com>
To: gdb@sourceware.org
Subject: signal 0 command
Date: Thu, 21 Aug 2008 20:11:00 -0000	[thread overview]
Message-ID: <991f3a0a0808210503y3c2c9218h5fcfb7bf544215da@mail.gmail.com> (raw)

Hi.

While reading the gdb info manual, I found the  paragraph saying:

     Alternatively, if SIGNAL is zero, continue execution without
     giving a signal.  This is useful when your program stopped on
     account of a signal and would ordinary see the signal when resumed
     with the `continue' command; `signal 0' causes it to resume
     without a signal.

If I understand correctly, I can issue "signal 0" to ignore the current
signal GDB caught, right?  So I made a simple program to raise SIGSEGV:

void
foo(const char *str)
{
  char *p = 0;     /* This should be "char *p = str" */

  while (*p != '\0') {
    /* do something */
    p++;
  }
}

After reading the manual, I thought that it is possible to
undo the generation of SIGSEGV after modifying the value `p'.
But when I set the value of `p' corrently, and execute "signal 0",
I can still see the SIGSEGV is generated.

$ gdb -q a.out
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) r
Starting program: /home/cinsk/pesticide/a.out

Program received signal SIGSEGV, Segmentation fault.
0x08048399 in foo (str=0x80484b8 "hello, world") at segv.c:8
8	  while (*p != '\0') {
(gdb) p p
$1 = 0x0
(gdb) p p = str
$2 = 0x80484b8 "hello, world"
(gdb) signal 0
Continuing with no signal.

Program received signal SIGSEGV, Segmentation fault.
0x08048399 in foo (str=0x80484b8 "hello, world") at segv.c:8
8	  while (*p != '\0') {
(gdb) _

Am I missing something?  If I misunderstand the meaning of "signal 0" command,
please let me know.  (A short example session would be great!!)

Thanks in advance.

-- 
C FAQs: http://www.eskimo.com/~scs/C-faq/top.html
Korean: http://pcrc.hongik.ac.kr/~cinsk/cfaqs/


             reply	other threads:[~2008-08-21 12:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 20:11 Seong-Kook Shin [this message]
2008-08-21 21:25 ` Andreas Schwab

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=991f3a0a0808210503y3c2c9218h5fcfb7bf544215da@mail.gmail.com \
    --to=cinsky@gmail.com \
    --cc=gdb@sourceware.org \
    /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