qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wei-cheng Wang <cole945@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] gdbstub: Convert gdb-signal to target signal when continuing.
Date: Mon, 27 Oct 2014 00:58:13 +0800	[thread overview]
Message-ID: <CAPmZyH7tf78Te2PiX5uUQzL1vD1Vwa5LG0yahrgp4HVPh=XNxw@mail.gmail.com> (raw)

QEMU should convert signal number reciving from GDB cilent
from gdb-signal number to target sginal number - using gdb_signal_to_target().

In this case, GDB_SIG_BUS is 10.  However, 10 is SIGUSR1 for target.
So QEMU continues with the wrong signal number.


#include <stdio.h>
#include <signal.h>

void handle_signal (int sig)
{
    puts ("Hello");
}

int main ()
{
    signal (SIGBUS, handle_signal);
    kill (0, SIGBUS);
    return 0;
}


(gdb) target remote :25566
Remote debugging using :25566
0x00008b98 in _start ()
(gdb) c
Continuing.

Program received signal SIGBUS, Bus error.
0x0000e18c in kill ()
(gdb) c
Continuing.

Program terminated with signal SIGUSR1, User defined signal 1.
                               ^^^^^^^
The program no longer exists.
(gdb)


Thansk,
Wei-cheng Wang


From: Cole Wang <cole945@gmail.com>
Date: Mon, 27 Oct 2014 00:33:18 +0800
Subject: [PATCH] gdbstub: Convert gdb-signal to target signal when continuing.

Signed-off-by: Wei-cheng Wang <cole945@gmail.com>
---
 gdbstub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdbstub.c b/gdbstub.c
index d1b5afd..cce5c69 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -851,7 +851,7 @@ static int gdb_handle_packet(GDBState *s, const
char *line_buf)
                 if (res == 's') {
                     cpu_single_step(s->c_cpu, sstep_flags);
                 }
-                s->signal = res_signal;
+                s->signal = gdb_signal_to_target(res_signal);
                 gdb_continue(s);
                 return RS_IDLE;
             }
--
1.9.1

             reply	other threads:[~2014-10-26 16:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 16:58 Wei-cheng Wang [this message]
2014-11-23 13:30 ` [Qemu-devel] [PATCH] gdbstub: Convert gdb-signal to target signal when continuing Wei-cheng, Wang
2014-11-23 13:46   ` Wei-cheng Wang

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='CAPmZyH7tf78Te2PiX5uUQzL1vD1Vwa5LG0yahrgp4HVPh=XNxw@mail.gmail.com' \
    --to=cole945@gmail.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).