This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [6/9] Multi-target support: Misc. compile fixes
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 26 Oct 2007 03:17:18 +0200 (CEST)
- Subject: [rfc] [6/9] Multi-target support: Misc. compile fixes
Hello,
when attempting a --enable-target=all build, I ran into a couple of compile
issues that prevented several targets from actually building. These range
from invalid type size assumptions to missing adaptations to overall GDB
changes (e.g. char * -> gdb_byte *).
This patch provides the obvious fixes for all such problems I encountered.
Bye,
Ulrich
ChangeLog:
* amd64fsdb-tdep.c (amd64fbsd_sigtramp_start_addr): Use ULL suffix.
(amd64fbsd_sigtramp_end_addr): Likewise.
* iq2000-tdep.c (iq2000_pointer_to_address): Fix argument type.
(iq2000_address_to_pointer): Likewise.
(iq2000_frame_prev_register): Likewise.
(iq2000_extract_return_value): Use regcache_cooked_read_unsigned
instead of regcache_cooked_read into CORE_ADDR variable.
(iq2000_return_value): Fix argument types.
* m32r-rom.c (m32r_load_section): Fix printf argument type.
(m32r_load): Likewise.
* m68kbsd-tdep.c: Include "gdbtypes.h".
* Makefile.in: Update dependencies.
* mn10300-tdep.c (mn10300_frame_unwind_cache): Fix aliasing violation.
* nto-tdep.c (LM_ADDR): Do not refer to no-longer-existing
lmo->l_addr_size element.
* remote-m32r-sdi.c (m32r_xfer_memory): Use paddr to print address.
(m32r_insert_breakpoint): Likewise.
(m32r_remove_breakpoint): Likewise.
(m32r_insert_watchpoint): Likewise.
(m32r_remove_watchpoint): Likewise.
(m32r_load): Fix printf argument type.
* xtensa-tdep.c (xtensa_regset_from_core_section): Fix printf
argument type.
(xtensa_frame_this_id): Do not cast pointers to "int" for output.
(xtensa_frame_prev_register): Likewise.
(xtensa_push_dummy_call): Likewise.
diff -urNp gdb-orig/gdb/amd64fbsd-tdep.c gdb-head/gdb/amd64fbsd-tdep.c
--- gdb-orig/gdb/amd64fbsd-tdep.c 2007-10-25 23:49:50.454220027 +0200
+++ gdb-head/gdb/amd64fbsd-tdep.c 2007-10-25 23:50:15.773426134 +0200
@@ -86,8 +86,8 @@ static int amd64fbsd_r_reg_offset[] =
};
/* Location of the signal trampoline. */
-CORE_ADDR amd64fbsd_sigtramp_start_addr = 0x7fffffffffc0;
-CORE_ADDR amd64fbsd_sigtramp_end_addr = 0x7fffffffffe0;
+CORE_ADDR amd64fbsd_sigtramp_start_addr = 0x7fffffffffc0ULL;
+CORE_ADDR amd64fbsd_sigtramp_end_addr = 0x7fffffffffe0ULL;
/* From <machine/signal.h>. */
int amd64fbsd_sc_reg_offset[] =
diff -urNp gdb-orig/gdb/iq2000-tdep.c gdb-head/gdb/iq2000-tdep.c
--- gdb-orig/gdb/iq2000-tdep.c 2007-10-25 23:49:50.461219018 +0200
+++ gdb-head/gdb/iq2000-tdep.c 2007-10-25 23:50:15.780425125 +0200
@@ -86,7 +86,7 @@ insn_addr_from_ptr (CORE_ADDR ptr) /* ta
Convert a target pointer to an address in host (CORE_ADDR) format. */
static CORE_ADDR
-iq2000_pointer_to_address (struct type * type, const void * buf)
+iq2000_pointer_to_address (struct type * type, const gdb_byte * buf)
{
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
@@ -103,7 +103,7 @@ iq2000_pointer_to_address (struct type *
Convert a host-format address (CORE_ADDR) into a target pointer. */
static void
-iq2000_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr)
+iq2000_address_to_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr)
{
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
@@ -393,7 +393,7 @@ static void
iq2000_frame_prev_register (struct frame_info *next_frame, void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, void *valuep)
+ int *realnump, gdb_byte *valuep)
{
struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache);
if (regnum == E_SP_REGNUM && cache->saved_sp)
@@ -557,7 +557,6 @@ iq2000_extract_return_value (struct type
returned in a register, and if larger than 8 bytes, it is
returned in a stack location which is pointed to by the same
register. */
- CORE_ADDR return_buffer;
int len = TYPE_LENGTH (type);
if (len <= (2 * 4))
@@ -583,7 +582,9 @@ iq2000_extract_return_value (struct type
{
/* Return values > 8 bytes are returned in memory,
pointed to by FN_RETURN_REGNUM. */
- regcache_cooked_read (regcache, E_FN_RETURN_REGNUM, & return_buffer);
+ ULONGEST return_buffer;
+ regcache_cooked_read_unsigned (regcache, E_FN_RETURN_REGNUM,
+ &return_buffer);
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
}
}
@@ -591,7 +592,7 @@ iq2000_extract_return_value (struct type
static enum return_value_convention
iq2000_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache,
- void *readbuf, const void *writebuf)
+ gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (iq2000_use_struct_convention (type))
return RETURN_VALUE_STRUCT_CONVENTION;
diff -urNp gdb-orig/gdb/m32r-rom.c gdb-head/gdb/m32r-rom.c
--- gdb-orig/gdb/m32r-rom.c 2007-10-25 23:49:50.467218153 +0200
+++ gdb-head/gdb/m32r-rom.c 2007-10-25 23:50:15.786424261 +0200
@@ -85,7 +85,8 @@ m32r_load_section (bfd *abfd, asection *
*data_count += section_size;
printf_filtered ("Loading section %s, size 0x%lx lma ",
- bfd_section_name (abfd, s), section_size);
+ bfd_section_name (abfd, s),
+ (unsigned long) section_size);
deprecated_print_address_numeric (section_base, 1, gdb_stdout);
printf_filtered ("\n");
gdb_flush (gdb_stdout);
@@ -167,7 +168,8 @@ m32r_load (char *filename, int from_tty)
}
#endif
gettimeofday (&end_time, NULL);
- printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
+ printf_filtered ("Start address 0x%lx\n",
+ (unsigned long) bfd_get_start_address (abfd));
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
&end_time);
@@ -522,14 +524,16 @@ m32r_upload_command (char *args, int fro
data_count += section_size;
printf_filtered ("Loading section %s, size 0x%lx lma ",
- bfd_section_name (abfd, s), section_size);
+ bfd_section_name (abfd, s),
+ (unsigned long) section_size);
deprecated_print_address_numeric (section_base, 1, gdb_stdout);
printf_filtered ("\n");
gdb_flush (gdb_stdout);
}
/* Finally, make the PC point at the start address */
write_pc (bfd_get_start_address (abfd));
- printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
+ printf_filtered ("Start address 0x%lx\n",
+ (unsigned long) bfd_get_start_address (abfd));
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
&end_time);
}
diff -urNp gdb-orig/gdb/m68kbsd-tdep.c gdb-head/gdb/m68kbsd-tdep.c
--- gdb-orig/gdb/m68kbsd-tdep.c 2007-10-25 23:49:50.472217432 +0200
+++ gdb-head/gdb/m68kbsd-tdep.c 2007-10-25 23:50:15.791423540 +0200
@@ -25,6 +25,7 @@
#include "regset.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "gdbtypes.h"
#include "gdb_assert.h"
#include "gdb_string.h"
diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in 2007-10-25 23:49:50.487215270 +0200
+++ gdb-head/gdb/Makefile.in 2007-10-25 23:50:15.804421666 +0200
@@ -2308,8 +2308,8 @@ m68kbsd-nat.o: m68kbsd-nat.c $(defs_h) $
$(bsd_kvm_h)
m68kbsd-tdep.o: m68kbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
$(osabi_h) $(regcache_h) $(regset_h) $(trad_frame_h) \
- $(tramp_frame_h) $(gdb_assert_h) $(gdb_string_h) $(m68k_tdep_h) \
- $(solib_svr4_h)
+ $(tramp_frame_h) $(gdbtypes_h) $(gdb_assert_h) $(gdb_string_h) \
+ $(m68k_tdep_h) $(solib_svr4_h)
m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \
$(language_h) $(gdbcore_h) $(gdb_string_h) $(regcache_h) \
$(m68k_tdep_h) $(gdb_stat_h) $(floatformat_h) $(target_h) \
diff -urNp gdb-orig/gdb/mn10300-tdep.c gdb-head/gdb/mn10300-tdep.c
--- gdb-orig/gdb/mn10300-tdep.c 2007-10-25 23:49:50.494214261 +0200
+++ gdb-head/gdb/mn10300-tdep.c 2007-10-25 23:50:15.812420513 +0200
@@ -838,13 +838,16 @@ mn10300_frame_unwind_cache (struct frame
{
struct trad_frame_cache *cache;
CORE_ADDR pc, start, end;
+ void *cache_p;
if (*this_prologue_cache)
return (*this_prologue_cache);
- cache = trad_frame_cache_zalloc (next_frame);
+ cache_p = trad_frame_cache_zalloc (next_frame);
pc = gdbarch_unwind_pc (current_gdbarch, next_frame);
- mn10300_analyze_prologue (next_frame, (void **) &cache, pc);
+ mn10300_analyze_prologue (next_frame, &cache_p, pc);
+ cache = cache_p;
+
if (find_pc_partial_function (pc, NULL, &start, &end))
trad_frame_set_id (cache,
frame_id_build (trad_frame_get_this_base (cache),
diff -urNp gdb-orig/gdb/nto-tdep.c gdb-head/gdb/nto-tdep.c
--- gdb-orig/gdb/nto-tdep.c 2007-10-25 23:49:50.500213396 +0200
+++ gdb-head/gdb/nto-tdep.c 2007-10-25 23:50:15.817419792 +0200
@@ -264,9 +264,8 @@ LM_ADDR (struct so_list *so)
{
struct link_map_offsets *lmo = nto_fetch_link_map_offsets ();
- return (CORE_ADDR) extract_signed_integer (so->lm_info->lm +
- lmo->l_addr_offset,
- lmo->l_addr_size);
+ return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
+ builtin_type_void_data_ptr);
}
static CORE_ADDR
diff -urNp gdb-orig/gdb/remote-m32r-sdi.c gdb-head/gdb/remote-m32r-sdi.c
--- gdb-orig/gdb/remote-m32r-sdi.c 2007-10-25 23:49:50.508212243 +0200
+++ gdb-head/gdb/remote-m32r-sdi.c 2007-10-25 23:50:15.824418783 +0200
@@ -1053,11 +1053,11 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb
if (remote_debug)
{
if (write)
- fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%08lx,%d,write)\n",
- memaddr, len);
+ fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,write)\n",
+ paddr (memaddr), len);
else
- fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%08lx,%d,read)\n",
- memaddr, len);
+ fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,read)\n",
+ paddr (memaddr), len);
}
if (write)
@@ -1151,8 +1151,8 @@ m32r_insert_breakpoint (struct bp_target
int i, c;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_insert_breakpoint(%08lx,...)\n",
- addr);
+ fprintf_unfiltered (gdb_stdlog, "m32r_insert_breakpoint(%s,...)\n",
+ paddr (addr));
if (use_ib_breakpoints)
ib_breakpoints = max_ib_breakpoints;
@@ -1192,8 +1192,8 @@ m32r_remove_breakpoint (struct bp_target
int i;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_remove_breakpoint(%08lx)\n",
- addr);
+ fprintf_unfiltered (gdb_stdlog, "m32r_remove_breakpoint(%s)\n",
+ paddr (addr));
for (i = 0; i < MAX_BREAKPOINTS; i++)
{
@@ -1294,7 +1294,8 @@ m32r_load (char *args, int from_tty)
if (!quiet)
printf_filtered ("[Loading section %s at 0x%lx (%d bytes)]\n",
bfd_get_section_name (pbfd, section),
- section_address, (int) section_size);
+ (unsigned long) section_address,
+ (int) section_size);
fptr = 0;
@@ -1374,7 +1375,8 @@ m32r_load (char *args, int from_tty)
entry = bfd_get_start_address (pbfd);
if (!quiet)
- printf_unfiltered ("[Starting %s at 0x%lx]\n", filename, entry);
+ printf_unfiltered ("[Starting %s at 0x%lx]\n", filename,
+ (unsigned long) entry);
}
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
@@ -1415,8 +1417,8 @@ m32r_insert_watchpoint (CORE_ADDR addr,
int i;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%08lx,%d,%d)\n",
- addr, len, type);
+ fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n",
+ paddr (addr), len, type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
@@ -1439,8 +1441,8 @@ m32r_remove_watchpoint (CORE_ADDR addr,
int i;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%08lx,%d,%d)\n",
- addr, len, type);
+ fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n",
+ paddr (addr), len, type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
diff -urNp gdb-orig/gdb/xtensa-tdep.c gdb-head/gdb/xtensa-tdep.c
--- gdb-orig/gdb/xtensa-tdep.c 2007-10-25 23:49:50.518210802 +0200
+++ gdb-head/gdb/xtensa-tdep.c 2007-10-25 23:57:57.633033187 +0200
@@ -848,7 +848,7 @@ xtensa_regset_from_core_section (struct
{
DEBUGTRACE ("xtensa_regset_from_core_section "
"(..., sect_name==\"%s\", sect_size==%x) \n",
- sect_name, sect_size);
+ sect_name, (unsigned int) sect_size);
if (strcmp (sect_name, ".reg") == 0
&& sect_size >= sizeof(xtensa_elf_gregset_t))
@@ -1163,8 +1163,8 @@ xtensa_frame_this_id (struct frame_info
xtensa_frame_cache (next_frame, this_cache);
struct frame_id id;
- DEBUGTRACE ("xtensa_frame_this_id (next 0x%08x, *this 0x%08x)\n",
- (unsigned int) next_frame, (unsigned int) *this_cache);
+ DEBUGTRACE ("xtensa_frame_this_id (next 0x%lx, *this 0x%lx)\n",
+ (unsigned long) next_frame, (unsigned long) *this_cache);
if (cache->prev_sp == 0)
return;
@@ -1244,10 +1244,10 @@ xtensa_frame_prev_register (struct frame
CORE_ADDR saved_reg = 0;
int done = 1;
- DEBUGTRACE ("xtensa_frame_prev_register (next 0x%08x, "
- "*this 0x%08x, regnum %d (%s), ...)\n",
- (unsigned int) next_frame,
- *this_cache ? (unsigned int) *this_cache : 0, regnum,
+ DEBUGTRACE ("xtensa_frame_prev_register (next 0x%lx, "
+ "*this 0x%lx, regnum %d (%s), ...)\n",
+ (unsigned long) next_frame,
+ *this_cache ? (unsigned long) *this_cache : 0, regnum,
xtensa_register_name (regnum));
if (regnum ==gdbarch_pc_regnum (gdbarch))
@@ -1582,8 +1582,8 @@ xtensa_push_dummy_call (struct gdbarch *
{
struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg));
- fprintf_unfiltered (gdb_stdlog, "%2d: 0x%08x %3d ",
- i, (int) arg, TYPE_LENGTH (arg_type));
+ fprintf_unfiltered (gdb_stdlog, "%2d: 0x%lx %3d ",
+ i, (unsigned long) arg, TYPE_LENGTH (arg_type));
switch (TYPE_CODE (arg_type))
{
case TYPE_CODE_INT:
@@ -1596,8 +1596,8 @@ xtensa_push_dummy_call (struct gdbarch *
fprintf_unfiltered (gdb_stdlog, "%3d", TYPE_CODE (arg_type));
break;
}
- fprintf_unfiltered (gdb_stdlog, " 0x%08x\n",
- (unsigned int) value_contents (arg));
+ fprintf_unfiltered (gdb_stdlog, " 0x%lx\n",
+ (unsigned long) value_contents (arg));
}
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com