mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
Add bionutils support for DWARF v5's DW_OP_addrx.
This commit is contained in:
parent
cce0ae568c
commit
3ac9da4937
@ -1721,6 +1721,10 @@ decode_location_expression (unsigned char * data,
|
||||
printf ("DW_OP_GNU_parameter_ref: <0x%s>",
|
||||
dwarf_vmatoa ("x", cu_offset + uvalue));
|
||||
break;
|
||||
case DW_OP_addrx:
|
||||
READ_ULEB (uvalue, data, end);
|
||||
printf ("DW_OP_addrx <0x%s>", dwarf_vmatoa ("x", uvalue));
|
||||
break;
|
||||
case DW_OP_GNU_addr_index:
|
||||
READ_ULEB (uvalue, data, end);
|
||||
printf ("DW_OP_GNU_addr_index <0x%s>", dwarf_vmatoa ("x", uvalue));
|
||||
@ -2661,10 +2665,15 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
|
||||
uvalue = check_uvalue (block_start, uvalue, end);
|
||||
|
||||
if (do_loc)
|
||||
data = block_start + uvalue;
|
||||
else
|
||||
data = display_block (block_start, uvalue, end, delimiter);
|
||||
data = block_start + uvalue;
|
||||
if (!do_loc)
|
||||
{
|
||||
unsigned char op;
|
||||
|
||||
SAFE_BYTE_GET (op, block_start, sizeof (op), end);
|
||||
if (op != DW_OP_addrx)
|
||||
data = display_block (block_start, uvalue, end, delimiter);
|
||||
}
|
||||
break;
|
||||
|
||||
case DW_FORM_block1:
|
||||
|
@ -513,6 +513,47 @@ if { ![is_elf_format] } then {
|
||||
}
|
||||
}
|
||||
|
||||
# Test objdump -Wi on a file containing dwarf-5 encodings information.
|
||||
|
||||
if { ![is_elf_format] } then {
|
||||
unsupported "objdump DW_OP_* test"
|
||||
} elseif { ![binutils_assemble $srcdir/$subdir/dw5-op.S tmpdir/dw5-op.${obj}] } then {
|
||||
fail "objdump DW_OP_* test"
|
||||
} else {
|
||||
if [is_remote host] {
|
||||
set op_testfile [remote_download host tmpdir/dw5-op.${obj}]
|
||||
} else {
|
||||
set op_testfile tmpdir/dw5-op.${obj}
|
||||
}
|
||||
|
||||
set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Wi $op_testfile" "" "/dev/null" "objdump.out"]
|
||||
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
fail "objdump -Wi (reason: unexpected output)"
|
||||
send_log $got
|
||||
send_log "\n"
|
||||
}
|
||||
|
||||
set got [remote_exec host "tail -n +4 objdump.out" "" "/dev/null" "objdump.out"]
|
||||
set output [remote_upload host objdump.out]
|
||||
|
||||
if ![file size $output] then {
|
||||
# If the output file is empty, then this target does not
|
||||
# generate dwarf2 output. This is not a failure.
|
||||
verbose "No output from 'objdump -Wi'"
|
||||
untested "objdump -Wi"
|
||||
return
|
||||
}
|
||||
|
||||
if { [regexp_diff objdump.out $srcdir/$subdir/dw5-op.W] } then {
|
||||
fail "objdump -Wi for DW_OP_*"
|
||||
} else {
|
||||
pass "objdump -Wi for DW_OP_*"
|
||||
}
|
||||
|
||||
file_on_host delete $output
|
||||
}
|
||||
|
||||
proc test_build_id_debuglink {} {
|
||||
global srcdir
|
||||
global subdir
|
||||
@ -817,7 +858,7 @@ proc test_objdump_S { } {
|
||||
global OBJDUMP
|
||||
global OBJDUMPFLAGS
|
||||
global exe
|
||||
|
||||
|
||||
set test "objdump -S"
|
||||
|
||||
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog${exe} executable debug] != "" } {
|
||||
|
@ -488,11 +488,12 @@ if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then {
|
||||
readelf_test {--decompress --hex-dump .debug_loc} $tempfile readelf.z
|
||||
}
|
||||
|
||||
set hpux ""
|
||||
|
||||
# Skip the next test for the RISCV architectures because they
|
||||
# do not support .ULEB128 pseudo-ops with non-constant values.
|
||||
if ![istarget "riscv*-*-*"] then {
|
||||
|
||||
set hpux ""
|
||||
if [istarget "hppa*64*-*-hpux*"] {
|
||||
set hpux "--defsym HPUX=1"
|
||||
}
|
||||
@ -596,3 +597,22 @@ if ![is_remote host] {
|
||||
readelf_test {--debug-dump=macro -wN} $tempfile pr26112.r
|
||||
}
|
||||
}
|
||||
|
||||
# Check dwarf-5 support for DW_OP_addrx.
|
||||
if {![binutils_assemble_flags $srcdir/$subdir/dw5-op.S tmpdir/dw5-op.o $hpux]} then {
|
||||
unsupported "readelf -wi dw5-op (failed to assemble)"
|
||||
} else {
|
||||
|
||||
# Download it.
|
||||
if ![is_remote host] {
|
||||
set tempfile tmpdir/dw5-op.o
|
||||
} else {
|
||||
set tempfile [remote_download host tmpdir/dw5-op.o]
|
||||
}
|
||||
|
||||
# First, determine the size, so specific output matchers can be used.
|
||||
readelf_find_size $tempfile 2
|
||||
|
||||
# Make sure that readelf can decode the contents.
|
||||
readelf_test -wi $tempfile dw5-op.W
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user