mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
gdb: include the end address in in-memory bfd filenames
Commit
66984afd29
gdb: include the base address in in-memory bfd filenames
added the base address to in-memory bfd filenames. Also add the end
address to allow dumping the in-memory bfd using the 'dump memory'
command.
This commit is contained in:
parent
998a4f589d
commit
c96ceed9dc
@ -227,8 +227,9 @@ struct target_buffer : public gdb_bfd_iovec_base
|
||||
target_buffer (CORE_ADDR base, ULONGEST size)
|
||||
: m_base (base),
|
||||
m_size (size),
|
||||
m_filename (xstrprintf ("<in-memory@%s>",
|
||||
core_addr_to_string_nz (m_base)))
|
||||
m_filename (xstrprintf ("<in-memory@%s-%s>",
|
||||
core_addr_to_string_nz (m_base),
|
||||
core_addr_to_string_nz (m_base + m_size)))
|
||||
{
|
||||
}
|
||||
|
||||
@ -241,7 +242,7 @@ struct target_buffer : public gdb_bfd_iovec_base
|
||||
{ return m_base; }
|
||||
|
||||
/* Return a generated filename for the in-memory BFD file. The generated
|
||||
name will include the M_BASE value. */
|
||||
name will include the begin and end address of the in-memory file. */
|
||||
const char *filename () const
|
||||
{ return m_filename.get (); }
|
||||
|
||||
|
@ -102,7 +102,7 @@ gdb_test_multiple "maint info symtabs" "" {
|
||||
-re "^\\\}\\s*\r\n" {
|
||||
exp_continue
|
||||
}
|
||||
-re "^\\\{ objfile <in-memory@($hex)>\\s+\[^\r\n\]+\r\n" {
|
||||
-re "^\\\{ objfile <in-memory@($hex-$hex)>\\s+\[^\r\n\]+\r\n" {
|
||||
lappend bfd_name_addrs $expect_out(1,string)
|
||||
exp_continue
|
||||
}
|
||||
@ -133,12 +133,19 @@ foreach addr $symfile_addrs len $symfile_lengths {
|
||||
# Check that each of the expected jit symfile addresses was mentioned
|
||||
# in an in-memory BFD filename.
|
||||
set count 1
|
||||
foreach addr $symfile_addrs {
|
||||
foreach addr $symfile_addrs len $symfile_lengths {
|
||||
# Drop any loading zeros from the symfile address.
|
||||
set addr [format 0x%x $addr]
|
||||
|
||||
# Calculate the end address.
|
||||
set end [format 0x%x [expr $addr + $len]]
|
||||
|
||||
# This is what we expect the address range to look like in the BFD
|
||||
# filename.
|
||||
set rng "$start-$end"
|
||||
|
||||
# Check there was a BFD with the expected address in its name.
|
||||
gdb_assert { [expr [lsearch -exact $bfd_name_addrs $addr] != -1] } \
|
||||
gdb_assert { [expr [lsearch -exact $bfd_name_addrs $rng] != -1] } \
|
||||
"check for in-memory bfd $count"
|
||||
incr count
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user