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

Daniel Jacobowitz
2004-05-18T21:20:00Z

On Mon, May 10, 2004 at 10:20:48PM -0400, Daniel Jacobowitz wrote:
> 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?

I'm checking this in now. Revised patch attached; the only changes
are that the PPC bits are removed (because I checked them in last week)
and I add a parallel make fix to m32r, by using -outfile-suffix on
genmloop.sh. Otherwise I had all three sets of eng.hin get built in
parallel.

--
Daniel Jacobowitz

2004-05-18 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-18 Daniel Jacobowitz <dan@debian.org>

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

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

* Makefile.in (stamp-xmloop, stamp-2mloop): Use -outfile-suffix.

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 18 May 2004 21:08:25 -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 18 May 2004 21:08:25 -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 18 May 2004 21:08:26 -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 18 May 2004 21:08:26 -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 18 May 2004 21:08:26 -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 18 May 2004 21:08:43 -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/m32r/Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/m32r/Makefile.in,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile.in
--- sim/m32r/Makefile.in 19 Dec 2003 11:43:57 -0000 1.10
+++ sim/m32r/Makefile.in 18 May 2004 21:08:43 -0000
@@ -1,5 +1,6 @@
# Makefile template for Configure for the m32r simulator
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2003, 2004
+# Free Software Foundation, Inc.
# Contributed by Cygnus Support.
#
# This file is part of GDB, the GNU debugger.
@@ -107,9 +108,10 @@ mloopx.c engx.h: stamp-xmloop
stamp-xmloop: $(srcdir)/../common/genmloop.sh mloopx.in Makefile
$(SHELL) $(srccom)/genmloop.sh \
-mono -no-fast -pbb -parallel-write -switch semx-switch.c \
- -cpu m32rxf -infile $(srcdir)/mloopx.in
- $(SHELL) $(srcroot)/move-if-change eng.hin engx.h
- $(SHELL) $(srcroot)/move-if-change mloop.cin mloopx.c
+ -cpu m32rxf -infile $(srcdir)/mloopx.in \
+ -outfile-suffix x
+ $(SHELL) $(srcroot)/move-if-change engx.hin engx.h
+ $(SHELL) $(srcroot)/move-if-change mloopx.cin mloopx.c
touch stamp-xmloop
mloopx.o: mloopx.c semx-switch.c $(M32RXF_INCLUDE_DEPS)

@@ -131,9 +133,10 @@ mloop2.c eng2.h: stamp-2mloop
stamp-2mloop: $(srcdir)/../common/genmloop.sh mloop2.in Makefile
$(SHELL) $(srccom)/genmloop.sh \
-mono -no-fast -pbb -parallel-write -switch sem2-switch.c \
- -cpu m32r2f -infile $(srcdir)/mloop2.in
- $(SHELL) $(srcroot)/move-if-change eng.hin eng2.h
- $(SHELL) $(srcroot)/move-if-change mloop.cin mloop2.c
+ -cpu m32r2f -infile $(srcdir)/mloop2.in \
+ -outfile-suffix 2
+ $(SHELL) $(srcroot)/move-if-change eng2.hin eng2.h
+ $(SHELL) $(srcroot)/move-if-change mloop2.cin mloop2.c
touch stamp-2mloop

mloop2.o: mloop2.c sem2-switch.c $(M32R2F_INCLUDE_DEPS)