mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 13:23:00 +08:00
* utils.c (string_to_core_addr): If the executable format
indicates that addresses should be sign-extended and there are only 8 hex digits in the address, then do so. * Makefile.in (utils.o): Depend on $(gdbcore_h).
This commit is contained in:
15
gdb/utils.c
15
gdb/utils.c
@ -52,6 +52,7 @@
|
||||
#include "filenames.h"
|
||||
#include "symfile.h"
|
||||
#include "gdb_obstack.h"
|
||||
#include "gdbcore.h"
|
||||
#include "top.h"
|
||||
|
||||
#include "inferior.h" /* for signed_pointer_to_address */
|
||||
@ -2824,7 +2825,9 @@ core_addr_to_string_nz (const CORE_ADDR addr)
|
||||
CORE_ADDR
|
||||
string_to_core_addr (const char *my_string)
|
||||
{
|
||||
int addr_bit = gdbarch_addr_bit (current_gdbarch);
|
||||
CORE_ADDR addr = 0;
|
||||
|
||||
if (my_string[0] == '0' && tolower (my_string[1]) == 'x')
|
||||
{
|
||||
/* Assume that it is in hex. */
|
||||
@ -2838,6 +2841,17 @@ string_to_core_addr (const char *my_string)
|
||||
else
|
||||
error (_("invalid hex \"%s\""), my_string);
|
||||
}
|
||||
|
||||
/* Not very modular, but if the executable format expects
|
||||
addresses to be sign-extended, then do so if the address was
|
||||
specified with only 32 significant bits. Really this should
|
||||
be determined by the target architecture, not by the object
|
||||
file. */
|
||||
if (i - 2 == addr_bit / 4
|
||||
&& exec_bfd
|
||||
&& bfd_get_sign_extend_vma (exec_bfd))
|
||||
addr = (addr ^ ((CORE_ADDR) 1 << (addr_bit - 1)))
|
||||
- ((CORE_ADDR) 1 << (addr_bit - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2851,6 +2865,7 @@ string_to_core_addr (const char *my_string)
|
||||
error (_("invalid decimal \"%s\""), my_string);
|
||||
}
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user