Detect SW breakpoints in Cell/B.E. combined debugging
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 27 Aug 2015 17:20:29 +0000 (19:20 +0200)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 27 Aug 2015 17:26:31 +0000 (19:26 +0200)
The Linux target and gdbserver now check the siginfo si_code
reported on a SIGTRAP to detect whether the trap indicates
a software breakpoint was hit.

Unfortunately, on Cell/B.E., the kernel uses an si_code value
of TRAP_BRKPT when a SW breakpoint was hit in PowerPC code,
but a si_code value of SI_KERNEL when a SW breakpoint was
hit in SPU code.

This patch updates Linux target and gdbserver to accept both
si_code values to indicate SW breakpoint on PowerPC.

ChangeLog:

* nat/linux-ptrace.h (GDB_ARCH_TRAP_BRKPT): Replace by ...
(GDB_ARCH_IS_TRAP_BRKPT): ... this.  Add __powerpc__ case.
* linux-nat.c (check_stopped_by_breakpoint): Use
GDB_ARCH_IS_TRAP_BRKPT instead of GDB_ARCH_TRAP_BRKPT.

gdbserver/ChangeLog:

* linux-low.c (check_stopped_by_breakpoint): Use
GDB_ARCH_IS_TRAP_BRKPT instead of GDB_ARCH_TRAP_BRKPT.

gdb/ChangeLog
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
gdb/linux-nat.c
gdb/nat/linux-ptrace.h

index 8319083fc386ed448ef7ae510c6a8db75371ce81..61e985160c831730cac41427d8b24e899ff0f8da 100644 (file)
@@ -1,3 +1,10 @@
+2015-08-08  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * nat/linux-ptrace.h (GDB_ARCH_TRAP_BRKPT): Replace by ...
+       (GDB_ARCH_IS_TRAP_BRKPT): ... this.  Add __powerpc__ case.
+       * linux-nat.c (check_stopped_by_breakpoint): Use
+       GDB_ARCH_IS_TRAP_BRKPT instead of GDB_ARCH_TRAP_BRKPT.
+
 2015-08-08  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * linux-thread-db.c (thread_db_get_thread_local_address): If the
index 0be303076ef6c17219abd6c5e2f67a25641e5315..cc733d8c31651e2e999a5ab80a655aeee9c5ab00 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-27  Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+       * linux-low.c (check_stopped_by_breakpoint): Use
+       GDB_ARCH_IS_TRAP_BRKPT instead of GDB_ARCH_TRAP_BRKPT.
+
 2015-08-27  Pedro Alves  <palves@redhat.com>
 
        * proc-service.c (ps_pdwrite): Return PS_ERR/PS_OK explicily.
index a8fa91c1d0f8b0216f154338766bbcaee0098872..f4c602962a28ade227c49aeb26a4a30273d8eae1 100644 (file)
@@ -651,7 +651,7 @@ check_stopped_by_breakpoint (struct lwp_info *lwp)
     {
       if (siginfo.si_signo == SIGTRAP)
        {
-         if (siginfo.si_code == GDB_ARCH_TRAP_BRKPT)
+         if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
            {
              if (debug_threads)
                {
index 4da361defdaac51b0f707254527f62b78866dff0..51541d5ef12f2434939b90422855552236924e67 100644 (file)
@@ -2801,7 +2801,7 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
     {
       if (siginfo.si_signo == SIGTRAP)
        {
-         if (siginfo.si_code == GDB_ARCH_TRAP_BRKPT)
+         if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
            {
              if (debug_linux_nat)
                fprintf_unfiltered (gdb_stdlog,
index 41f668cd93b97aea1994198e9ef014af47ee0568..8bff9084daba1a04c9a20df1ee34fe4cfde67967 100644 (file)
@@ -135,12 +135,19 @@ struct buffer;
    running to a breakpoint and checking what comes out of
    siginfo->si_code.
 
-   The generic Linux target code should use GDB_ARCH_TRAP_BRKPT
-   instead of TRAP_BRKPT to abstract out this x86 peculiarity.  */
+   The ppc kernel does use TRAP_BRKPT for software breakpoints
+   in PowerPC code, but it uses SI_KERNEL for software breakpoints
+   in SPU code on a Cell/B.E.  However, SI_KERNEL is never seen
+   on a SIGTRAP for any other reason.
+
+   The generic Linux target code should use GDB_ARCH_IS_TRAP_BRKPT
+   instead of TRAP_BRKPT to abstract out these peculiarities.  */
 #if defined __i386__ || defined __x86_64__
-# define GDB_ARCH_TRAP_BRKPT SI_KERNEL
+# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL)
+#elif defined __powerpc__
+# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
 #else
-# define GDB_ARCH_TRAP_BRKPT TRAP_BRKPT
+# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
 #endif
 
 #ifndef TRAP_HWBKPT
This page took 0.039865 seconds and 4 git commands to generate.