Re: [RFA] Multi-arch DECR_PC_AFTER_HW_BREAKPOINT

Andrew Cagney
2002-04-25T02:07:51Z

Hmm,

+ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
+ && (gdbarch->decr_pc_after_hw_break == -1))
+ fprintf_unfiltered (log, "\n\tdecr_pc_after_hw_break");

-#ifndef DECR_PC_AFTER_HW_BREAK
-#define DECR_PC_AFTER_HW_BREAK 0
-#endif

+extern CORE_ADDR gdbarch_decr_pc_after_hw_break (struct gdbarch *gdbarch);
+extern void set_gdbarch_decr_pc_after_hw_break (struct gdbarch
*gdbarch, CORE_A
DDR decr_pc_after_hw_break);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined
(DECR_PC_AFTER_HW_BREA
K)
+#error "Non multi-arch definition of DECR_PC_AFTER_HW_BREAK"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined
(DECR_PC_AFTER_HW_BRE
AK)
+#define DECR_PC_AFTER_HW_BREAK (gdbarch_decr_pc_after_hw_break
(current_gdbarch
))
+#endif
+#endif
+

Keep in mind that a multi-arch conversion should, in no way, alter GDB's
behavour. GDB shall continue to build and/or run on any of the targets
listed in the MAINTAINER file.

I suspect for the above, you want something like TARGET_SHORT_BIT. As
things are:

v850-elf (and other non-multi-arch targets) don't build:
/home/scratch/GDB/src/gdb/breakpoint.c:2467: `DECR_PC_AFTER_HW_BREAK'
undeclared (first use in this function)
/home/scratch/GDB/src/gdb/breakpoint.c:2467: (Each undeclared identifier
is reported only once
/home/scratch/GDB/src/gdb/breakpoint.c:2467: for each function it
appears in.)

cris-elf and other multi-arch targets panic:
(gdb) maint print architecture
..../home/scratch/GDB/src/gdb/gdbarch.c:3948: gdb-internal-error:
gdbarch: gdbarch_decr_pc_after_hw_break invalid
An internal GDB error was detected. This may make further
debugging unreliable. Quit this debugging session? (y or n)

Can you please ensure that all the targets listed in the MAINTAINERS
file still build and pass a smoke-test.

> The GAWK segment:
>
> awk < "${maintainers}" '
> $2 ~ /--target=.*/ {
> targets = gensub (/^.*--target=/, "", 1, $2)
> warnings = gensub (/[)]*$/, "", 1, $3)
> split (targets, targ, /,/)
> for (i in targ) {
> print targ[i], warnings
> }
> }'
>
> can be used to generate a full list of --target=
> --enable-gdb-build-warnings= pairs.

(Richard Earnshaw posted a pretty neat shell script to help with this).

The other part, you've figured out (thanks!), is that the changes need
to be small. This is so that when (not if) a change breaks a target,
the developers can very quickly drill down to the specific change that
caused problems.

enjoy,
Andrew