]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix Alpha native GDB build
authorUros Bizjak <ubizjak@gmail.com>
Thu, 31 May 2018 15:18:02 +0000 (11:18 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 31 May 2018 15:18:35 +0000 (11:18 -0400)
[Commit log by Simon Marchi]

I get this error:

  CXX    linux-nat.o
/home/simark/src/binutils-gdb/gdb/linux-nat.c: In function 'void save_stop_reason(lwp_info*)':
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2718:9: error: duplicated 'if' condition [-Werror=duplicated-cond]
    else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
         ^~
In file included from /home/simark/src/binutils-gdb/gdb/linux-nat.c:31:0:
/home/simark/src/binutils-gdb/gdb/nat/linux-ptrace.h:173:41: note: previously used here
 # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
                                    ~~~~~^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2709:13: note: in expansion of macro 'GDB_ARCH_IS_TRAP_BRKPT'
    else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
             ^~~~~~~~~~~~~~~~~~~~~~

For Alpha, we currently define GDB_ARCH_IS_TRAP_BRKPT and
GDB_ARCH_IS_TRAP_HWBKPT both to ((X) == TRAP_BRKPT), which causes the
two if branches to be duplicated.

Alpha doesn't have hardware breakpoints, so the Linux kernel for Alpha
never sets si_code to TRAP_HWBKPT.  We can just remove the special
definitions of these macros for __alpha__ and rely on the default ones.
Since the kernel will never report TRAP_HWBKPT, we will just never enter
the "hardware breakpoint" branch on Alpha (which is fine since it
doesn't have them).

gdb/ChangeLog:

* nat/linux-ptrace.h [__alpha__]
(GDB_ARCH_IS_TRAP_BRKPT, GDB_ARCH_IS_TRAP_HWBKPT): Remove
definitions.

gdb/ChangeLog
gdb/nat/linux-ptrace.h

index c6c862f035e438d5d3c55443612395c77dbdbe3c..8af7e67ed36e90edecef275296960440e354ee35 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-31  Uros Bizjak  <ubizjak@gmail.com>
+
+       * nat/linux-ptrace.h [__alpha__]
+       (GDB_ARCH_IS_TRAP_BRKPT, GDB_ARCH_IS_TRAP_HWBKPT): Remove
+       definitions.
+
 2018-05-31  Maciej W. Rozycki  <macro@mips.com>
 
        * arch-utils.c (gdbarch_info_fill): Set `default_byte_order' to
index dc180fbf82a8ac22f7a97db711fdee696756e17b..98b44a82a6bbd845c47e74eeca3e4162f85f7f9b 100644 (file)
@@ -156,8 +156,6 @@ struct buffer;
    Beginning with Linux 4.6, the MIPS port reports proper TRAP_BRKPT and
    TRAP_HWBKPT codes, so we also match them.
 
-   The Alpha kernel uses TRAP_BRKPT for all traps.
-
    The generic Linux target code should use GDB_ARCH_IS_TRAP_* instead
    of TRAP_* to abstract out these peculiarities.  */
 #if defined __i386__ || defined __x86_64__
@@ -169,9 +167,6 @@ struct buffer;
 #elif defined __mips__
 # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
 # define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == SI_KERNEL || (X) == TRAP_HWBKPT)
-#elif defined __alpha__
-# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
-# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_BRKPT)
 #else
 # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
 # define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)