Skip to contentSkip to conversation

User emulation & gdb & sigsegv

Qemu-devel Lionel Landwerlin 3 participants 5 messages Dec 10, 2008 – Dec 17, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

Currently, when using gdb connected to qemu, if a sigsegv is raised, Qemu just exits.

How should I modify Qemu to redirect this last signal to the connected gdb and print a stack trace at least ?

I tried to call gdb_handlesig(gdbstub.c) from force_sig(linux-user/signal.c) but Qemu just crashes.

Any idea is welcome :)

Regards,

Signature · 3 lines
Lione Landwerlin                                         

O p e n W i d e                    14, rue Gaillon 75002 Paris
#1 lore raw
Quoted 5 lines · Lionel Landwerlin

Hello,

Currently, when using gdb connected to qemu, if a sigsegv is raised, Qemu just exits.

Quoted 7 lines

How should I modify Qemu to redirect this last signal to the connected gdb and print a stack trace at least ?

I tried to call gdb_handlesig(gdbstub.c) from force_sig(linux-user/signal.c) but Qemu just crashes.

Any idea is welcome :)

Hello,

I've got this in my git, IIRC it helped me out in those situations.

Cheers

commit 1efa40a743e16dbe2803a8d16902bf89850e80a3

Author: Edgar E. Iglesias <[email protected]>
Date:   Mon Sep 29 14:14:24 2008 +0200

Pass default handler signals to gdb aswell.

linux-user/signal.c +1 -0
index 9640923..b7d22a1 100644
@@ -365,6 +365,7 @@ int queue_signal(CPUState *env, int sig, target_siginfo_t *info)
         if (sig != TARGET_SIGCHLD &&
             sig != TARGET_SIGURG &&
             sig != TARGET_SIGWINCH) {
+	    sig = gdb_handlesig(env, sig);
             force_sig(sig);
         } else {
             return 0; /* indicate ignored */
#2 lore raw
Quoted 33 lines · Edgar E. Iglesias
Quoted 5 lines · Lionel Landwerlin

Hello,

Currently, when using gdb connected to qemu, if a sigsegv is raised, Qemu just exits.

Quoted 7 lines

How should I modify Qemu to redirect this last signal to the connected gdb and print a stack trace at least ?

I tried to call gdb_handlesig(gdbstub.c) from force_sig(linux-user/signal.c) but Qemu just crashes.

Any idea is welcome :)

Hello,

I've got this in my git, IIRC it helped me out in those situations.

Cheers

commit 1efa40a743e16dbe2803a8d16902bf89850e80a3

Author: Edgar E. Iglesias <[email protected]>
Date:   Mon Sep 29 14:14:24 2008 +0200

Pass default handler signals to gdb aswell.

linux-user/signal.c +0 -0
index 9640923..b7d22a1 100644

linux-user/signal.c int queue_signal(CPUState *env, int sig, target_siginfo_t *info) · line 371

Quoted 7 lines
linux-user/signal.c +1 -0
@@ -365,6 +365,7 @@ int queue_signal(CPUState *env, int sig, target_siginfo_t *info)
         if (sig != TARGET_SIGCHLD &&
             sig != TARGET_SIGURG &&
             sig != TARGET_SIGWINCH) {
+	    sig = gdb_handlesig(env, sig);
             force_sig(sig);
         } else {
             return 0; /* indicate ignored */

In fact this patch just make qemu crash too.
Have you tested this patch on the current svn ?
What cpu did you use to test it ?

Regards,

Signature · 3 lines
Lione Landwerlin                                         

O p e n W i d e                    14, rue Gaillon 75002 Paris
#3 lore raw
Quoted 36 lines · Lionel Landwerlin
Quoted 35 lines · Edgar E. Iglesias
Quoted 5 lines · Lionel Landwerlin

Hello,

Currently, when using gdb connected to qemu, if a sigsegv is raised, Qemu just exits.

Quoted 7 lines

How should I modify Qemu to redirect this last signal to the connected gdb and print a stack trace at least ?

I tried to call gdb_handlesig(gdbstub.c) from force_sig(linux-user/signal.c) but Qemu just crashes.

Any idea is welcome :)

Hello,

I've got this in my git, IIRC it helped me out in those situations.

Cheers

commit 1efa40a743e16dbe2803a8d16902bf89850e80a3

Author: Edgar E. Iglesias <[email protected]>
Date:   Mon Sep 29 14:14:24 2008 +0200

Pass default handler signals to gdb aswell.

linux-user/signal.c +1 -0
index 9640923..b7d22a1 100644
@@ -365,6 +365,7 @@ int queue_signal(CPUState *env, int sig, target_siginfo_t *info)
         if (sig != TARGET_SIGCHLD &&
             sig != TARGET_SIGURG &&
             sig != TARGET_SIGWINCH) {
+	    sig = gdb_handlesig(env, sig);
Quoted 8 lines

linux-user/signal.c int queue_signal(CPUState *env, int sig, target_siginfo_t *info) · line 371

Quoted 5 lines
linux-user/signal.c +0 -0
             force_sig(sig);
         } else {
             return 0; /* indicate ignored */

In fact this patch just make qemu crash too.
Have you tested this patch on the current svn ?

Nope, it's on my git with other patches, don't know if there are dependencies. Feel free to have a look at
git://repo.or.cz/qemu/cris-port.git if you're interested. No guarantees that it will help though :)

Quoted 1 line

What cpu did you use to test it ?

I run it on CRIS all the time.

Regards

#4 lore raw
In reply to Lionel Landwerlin
Quoted 10 lines · Lionel Landwerlin

Hello,

Currently, when using gdb connected to qemu, if a sigsegv is raised, Qemu just exits.

How should I modify Qemu to redirect this last signal to the connected gdb and print a stack trace at least ?

I tried to call gdb_handlesig(gdbstub.c) from force_sig(linux-user/signal.c) but Qemu just crashes.

Hi Lionel - I didn't see this message until today (I read the list only infrequently), but I posted a patch for this exact issue the next day. Let me know if it doesn't work for you, please.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery