[rfc] Fixes for sim and gdb gdb_mbuild.sh failures

Daniel Jacobowitz
2004-05-11T02:20:00Z

After Andrew told me I'd broken PPC targets by committing Maciej's patch, I
ran gdb_mbuild.sh. The results on my host were pretty abyssmal... seven
targets failed. Here's fixes for all of them.

I'm committing the sim/ppc/ bits now, because they broke the build even
without -Werror.

The others were all warnings. Two are dead fix_call_dummy's, one is a
printf format string warning (sizeof is size_t, which is not necessarily
long), and three are long 64-bit constants without suffixes. The last I'm
least sure about. ia64-tdep.c already used the LL suffix, but alpha-tdep.c
and amd64-tdep.c didn't. I'm slightly worried that a native Alpha (Compaq)
compiler will complain about the LL syntax (since CORE_ADDR may be just a
long in that case, and I remember Compaq's compiler as being remarkably
pedantic). Joel (or someone else), I don't suppose you could test this
patch by building GDB on OSF/1?

--
Daniel Jacobowitz

2004-05-10 Daniel Jacobowitz <dan@debian.org>

* alpha-tdep.c (alpha_gdbarch_init): Use LL suffix for large
constants.
* amd64-tdep.c (amd64_skip_prologue): Likewise.
* ia64-tdep.c (examine_prologue): Likewise.
* ns32k-tdep.c (ns32k_fix_call_dummy): Remove unused function.
* v850-tdep.c (v850_fix_call_dummy): Likewise.

2004-05-10 Daniel Jacobowitz <dan@debian.org>

* dv-glue.c (hw_glue_finish): Cast result of sizeof to long before
passing it to printf.

2004-05-10 Daniel Jacobowitz <dan@debian.org>

* configure.in (sim_fpu_cflags): Add -I../common.
* configure: Regenerated.

Index: gdb/alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.130
diff -u -p -r1.130 alpha-tdep.c
--- gdb/alpha-tdep.c 1 May 2004 15:34:49 -0000 1.130
+++ gdb/alpha-tdep.c 10 May 2004 23:29:27 -0000
@@ -1499,7 +1499,7 @@ alpha_gdbarch_init (struct gdbarch_info

/* Lowest text address. This is used by heuristic_proc_start()
to decide when to stop looking. */
- tdep->vm_min_address = (CORE_ADDR) 0x120000000;
+ tdep->vm_min_address = (CORE_ADDR) 0x120000000LL;

tdep->dynamic_sigtramp_offset = NULL;
tdep->sigcontext_addr = NULL;
Index: gdb/amd64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-tdep.c,v
retrieving revision 1.9
diff -u -p -r1.9 amd64-tdep.c
--- gdb/amd64-tdep.c 9 May 2004 19:48:25 -0000 1.9
+++ gdb/amd64-tdep.c 10 May 2004 23:29:27 -0000
@@ -781,7 +781,7 @@ amd64_skip_prologue (CORE_ADDR start_pc)
struct amd64_frame_cache cache;
CORE_ADDR pc;

- pc = amd64_analyze_prologue (start_pc, 0xffffffffffffffff, &cache);
+ pc = amd64_analyze_prologue (start_pc, 0xffffffffffffffffLL, &cache);
if (cache.frameless_p)
return start_pc;

Index: gdb/ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.121
diff -u -p -r1.121 ia64-tdep.c
--- gdb/ia64-tdep.c 30 Apr 2004 23:47:56 -0000 1.121
+++ gdb/ia64-tdep.c 10 May 2004 23:29:28 -0000
@@ -1116,7 +1116,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADD
if (next_pc == 0)
break;

- if (it == B && ((instr & 0x1e1f800003f) != 0x04000000000))
+ if (it == B && ((instr & 0x1e1f800003fLL) != 0x04000000000LL))
{
/* Exit loop upon hitting a non-nop branch instruction. */
if (trust_limit)
@@ -1228,7 +1228,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADD
{
cache->saved_regs[IA64_FR0_REGNUM + fM] = spill_addr;

- if ((instr & 0x1efc0000000) == 0x0eec0000000)
+ if ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
spill_addr += imm;
else
spill_addr = 0; /* last one; must be done */
Index: gdb/ns32k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ns32k-tdep.c,v
retrieving revision 1.74
diff -u -p -r1.74 ns32k-tdep.c
--- gdb/ns32k-tdep.c 8 May 2004 21:52:50 -0000 1.74
+++ gdb/ns32k-tdep.c 10 May 2004 23:29:28 -0000
@@ -419,33 +419,6 @@ ns32k_pop_frame (void)
flush_cached_frames ();
}
\f
-/* The NS32000 call dummy sequence:
-
- enter 0xff,0 82 ff 00
- jsr @0x00010203 7f ae c0 01 02 03
- adjspd 0x69696969 7f a5 01 02 03 04
- bpt f2
-
- It is 16 bytes long. */
-
-#define NS32K_CALL_DUMMY_ADDR 5
-#define NS32K_CALL_DUMMY_NARGS 11
-
-static void
-ns32k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
- struct value **args, struct type *type, int gcc_p)
-{
- int flipped;
-
- flipped = fun | 0xc0000000;
- flip_bytes (&flipped, 4);
- store_unsigned_integer (dummy + NS32K_CALL_DUMMY_ADDR, 4, flipped);
-
- flipped = - nargs * 4;
- flip_bytes (&flipped, 4);
- store_unsigned_integer (dummy + NS32K_CALL_DUMMY_NARGS, 4, flipped);
-}
-\f
static void
ns32k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
{
Index: gdb/v850-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/v850-tdep.c,v
retrieving revision 1.85
diff -u -p -r1.85 v850-tdep.c
--- gdb/v850-tdep.c 8 May 2004 21:52:50 -0000 1.85
+++ gdb/v850-tdep.c 10 May 2004 23:29:29 -0000
@@ -1019,27 +1019,6 @@ v850_frame_saved_pc (struct frame_info *
}

-/* Function: fix_call_dummy
- Pokes the callee function's address into the CALL_DUMMY assembly stub.
- Assumes that the CALL_DUMMY looks like this:
- jarl <offset24>, r31
- trap
- */
-
-static void
-v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs,
- struct value **args, struct type *type, int gcc_p)
-{
- long offset24;
-
- offset24 = (long) fun - (long) entry_point_address ();
- offset24 &= 0x3fffff;
- offset24 |= 0xff800000; /* jarl <offset24>, r31 */
-
- store_unsigned_integer ((unsigned int *) &dummy[2], 2, offset24 & 0xffff);
- store_unsigned_integer ((unsigned int *) &dummy[0], 2, offset24 >> 16);
-}
-
static CORE_ADDR
v850_saved_pc_after_call (struct frame_info *ignore)
{
Index: sim/common/dv-glue.c
===================================================================
RCS file: /cvs/src/src/sim/common/dv-glue.c,v
retrieving revision 1.3
diff -u -p -r1.3 dv-glue.c
--- sim/common/dv-glue.c 28 Aug 2003 17:02:00 -0000 1.3
+++ sim/common/dv-glue.c 10 May 2004 23:29:32 -0000
@@ -222,7 +222,7 @@ hw_glue_finish (struct hw *me)
hw_abort (me, "at least one reg property size must be nonzero");
if (glue->sizeof_output % sizeof (unsigned_word) != 0)
hw_abort (me, "reg property size must be %ld aligned",
- sizeof (unsigned_word));
+ (long) sizeof (unsigned_word));
/* and the address */
hw_unit_address_to_attach_address (hw_parent (me),
&unit.address,
@@ -231,7 +231,7 @@ hw_glue_finish (struct hw *me)
me);
if (glue->address % (sizeof (unsigned_word) * max_nr_ports) != 0)
hw_abort (me, "reg property address must be %ld aligned",
- sizeof (unsigned_word) * max_nr_ports);
+ (long) (sizeof (unsigned_word) * max_nr_ports));
glue->nr_outputs = glue->sizeof_output / sizeof (unsigned_word);
glue->output = hw_zalloc (me, glue->sizeof_output);
}
Index: sim/ppc/configure
===================================================================
RCS file: /cvs/src/src/sim/ppc/configure,v
retrieving revision 1.5
diff -u -p -r1.5 configure
--- sim/ppc/configure 22 Jun 2003 16:48:10 -0000 1.5
+++ sim/ppc/configure 10 May 2004 23:29:33 -0000
@@ -4675,7 +4675,7 @@ echo $ac_n "checking for common simulato
echo "configure:4676: checking for common simulator directory fpu implementation" >&5
if test -f "${srcdir}/../common/sim-fpu.c"; then
echo "$ac_t""yes" 1>&6
- sim_fpu_cflags="-DHAVE_COMMON_FPU -I${srcdir}/../common"
+ sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
sim_fpu="sim-fpu.o"
else
echo "$ac_t""no" 1>&6
Index: sim/ppc/configure.in
===================================================================
RCS file: /cvs/src/src/sim/ppc/configure.in,v
retrieving revision 1.4
diff -u -p -r1.4 configure.in
--- sim/ppc/configure.in 22 Jun 2003 16:48:12 -0000 1.4
+++ sim/ppc/configure.in 10 May 2004 23:29:33 -0000
@@ -700,7 +700,7 @@ fi
AC_MSG_CHECKING(for common simulator directory fpu implementation)
if test -f "${srcdir}/../common/sim-fpu.c"; then
AC_MSG_RESULT(yes)
- sim_fpu_cflags="-DHAVE_COMMON_FPU -I${srcdir}/../common"
+ sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
sim_fpu="sim-fpu.o"
else
AC_MSG_RESULT(no)