From b2ccb6a465eba4ad89e2601961acd8447c784f10 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Wed, 18 Aug 1993 20:31:12 +0000 Subject: [PATCH] * printcmd.c (print_address), values.c (value_as_pointer): Don't use ADDR_BITS_REMOVE. --- gdb/ChangeLog | 3 +++ gdb/printcmd.c | 21 ++++++++++++++------- gdb/values.c | 7 +++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c85a369..798363e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ Wed Aug 18 12:03:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + * printcmd.c (print_address), values.c (value_as_pointer): Don't + use ADDR_BITS_REMOVE. + * blockframe.c (block_innermost_frame): Uncomment. Return NULL if passed NULL. * frame.h: Declare it. diff --git a/gdb/printcmd.c b/gdb/printcmd.c index cfe2e9b..8c5dc36 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -587,7 +587,9 @@ print_address (addr, stream) CORE_ADDR addr; FILE *stream; { -#ifdef ADDR_BITS_REMOVE +#if 0 && defined (ADDR_BITS_REMOVE) + /* This is wrong for pointer to char, in which we do want to print + the low bits. */ fprintf_filtered (stream, local_hex_format(), ADDR_BITS_REMOVE(addr)); #else fprintf_filtered (stream, local_hex_format(), addr); @@ -1628,7 +1630,14 @@ typedef struct { MAKEVA_EXTRA_INFO #endif - char arg_bytes[1]; + /* Some systems (mips, pa) would like this to be aligned, and it never + will hurt. */ + union + { + char arg_bytes[1]; + double force_double_align; + LONGEST force_long_align; + } aligner; } makeva_list; /* Tell the caller how many bytes to allocate for a makeva_list with NARGS @@ -1639,9 +1648,7 @@ makeva_size (nargs, max_arg_size) unsigned int nargs; unsigned int max_arg_size; { - return sizeof (makeva_list) + nargs * max_arg_size - /* The PA might need up to this much for alignment. */ - + max_arg_size - 1; + return sizeof (makeva_list) + nargs * max_arg_size; } /* Start working on LIST with NARGS arguments and whose largest @@ -1671,7 +1678,7 @@ makeva_arg (list, argaddr, argsize) #if defined (MAKEVA_ARG) MAKEVA_ARG (list, argaddr, argsize); #else - memcpy (&list->arg_bytes[list->argindex], argaddr, argsize); + memcpy (&list->aligner.arg_bytes[list->argindex], argaddr, argsize); list->argindex += argsize; #endif } @@ -1686,7 +1693,7 @@ makeva_end (list) MAKEVA_END (list); #else /* This works if a va_list is just a pointer to the arguments. */ - return (va_list) list->arg_bytes; + return (va_list) list->aligner.arg_bytes; #endif } diff --git a/gdb/values.c b/gdb/values.c index 337dd10..65ecb23 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -552,7 +552,14 @@ value_as_pointer (val) { /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure whether we want this to be true eventually. */ +#if 0 + /* ADDR_BITS_REMOVE is wrong if we are being called for a + non-address (e.g. argument to "signal", "info break", etc.), or + for pointers to char, in which the low bits *are* significant. */ return ADDR_BITS_REMOVE(value_as_long (val)); +#else + return value_as_long (val); +#endif } /* Unpack raw data (copied from debugee, target byte order) at VALADDR -- 2.7.4