From 3771a44cf0e0b3a1017bcdce1eb0596bb1109296 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 14 Jun 2012 22:56:47 +0000 Subject: [PATCH] * dwarf2loc.c (debug_loc_kind): Add DEBUG_LOC_START_LENGTH. (DEBUG_LOC_START_END): Renamed from DEBUG_LOC_NORMAL. All uses updated. (decode_debug_loc_dwo_addresses): New arg "byte_order". All callers updated. Handle DEBUG_LOC_START_LENGTH. (dwarf2_find_location_expression): Handle DEBUG_LOC_START_LENGTH. (loclist_describe_location): Ditto. --- gdb/ChangeLog | 10 ++++++++++ gdb/dwarf2loc.c | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 006123b..3e94952 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2012-06-14 Doug Evans + + * dwarf2loc.c (debug_loc_kind): Add DEBUG_LOC_START_LENGTH. + (DEBUG_LOC_START_END): Renamed from DEBUG_LOC_NORMAL. + All uses updated. + (decode_debug_loc_dwo_addresses): New arg "byte_order". All callers + updated. Handle DEBUG_LOC_START_LENGTH. + (dwarf2_find_location_expression): Handle DEBUG_LOC_START_LENGTH. + (loclist_describe_location): Ditto. + 2012-06-14 Maciej W. Rozycki PR backtrace/13866 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 8c97f19..5edcd2b 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -75,7 +75,13 @@ enum debug_loc_kind /* This is followed by two unsigned LEB128 numbers that are indices into .debug_addr and specify the beginning and ending addresses, and then a normal location expression as in .debug_loc. */ - DEBUG_LOC_NORMAL = 2, + DEBUG_LOC_START_END = 2, + + /* This is followed by an unsigned LEB128 number that is an index into + .debug_addr and specifies the beginning address, and a 4 byte unsigned + number that specifies the length, and then a normal location expression + as in .debug_loc. */ + DEBUG_LOC_START_LENGTH = 3, /* An internal value indicating there is insufficient data. */ DEBUG_LOC_BUFFER_OVERFLOW = -1, @@ -124,7 +130,7 @@ decode_debug_loc_addresses (const gdb_byte *loc_ptr, const gdb_byte *buf_end, if (*low == 0 && *high == 0) return DEBUG_LOC_END_OF_LIST; - return DEBUG_LOC_NORMAL; + return DEBUG_LOC_START_END; } /* Decode the addresses in .debug_loc.dwo entry. @@ -137,7 +143,8 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu, const gdb_byte *loc_ptr, const gdb_byte *buf_end, const gdb_byte **new_ptr, - CORE_ADDR *low, CORE_ADDR *high) + CORE_ADDR *low, CORE_ADDR *high, + enum bfd_endian byte_order) { uint64_t low_index, high_index; @@ -157,7 +164,7 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu, *high = dwarf2_read_addr_index (per_cu, high_index); *new_ptr = loc_ptr; return DEBUG_LOC_BASE_ADDRESS; - case DEBUG_LOC_NORMAL: + case DEBUG_LOC_START_END: loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index); if (loc_ptr == NULL) return DEBUG_LOC_BUFFER_OVERFLOW; @@ -167,7 +174,18 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu, return DEBUG_LOC_BUFFER_OVERFLOW; *high = dwarf2_read_addr_index (per_cu, high_index); *new_ptr = loc_ptr; - return DEBUG_LOC_NORMAL; + return DEBUG_LOC_START_END; + case DEBUG_LOC_START_LENGTH: + loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index); + if (loc_ptr == NULL) + return DEBUG_LOC_BUFFER_OVERFLOW; + *low = dwarf2_read_addr_index (per_cu, low_index); + if (loc_ptr + 4 > buf_end) + return DEBUG_LOC_BUFFER_OVERFLOW; + *high = *low; + *high += extract_unsigned_integer (loc_ptr, 4, byte_order); + *new_ptr = loc_ptr + 4; + return DEBUG_LOC_START_LENGTH; default: return DEBUG_LOC_INVALID_ENTRY; } @@ -208,7 +226,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton, if (baton->from_dwo) kind = decode_debug_loc_dwo_addresses (baton->per_cu, loc_ptr, buf_end, &new_ptr, - &low, &high); + &low, &high, byte_order); else kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr, &low, &high, @@ -223,7 +241,8 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton, case DEBUG_LOC_BASE_ADDRESS: base_address = high + base_offset; continue; - case DEBUG_LOC_NORMAL: + case DEBUG_LOC_START_END: + case DEBUG_LOC_START_LENGTH: break; case DEBUG_LOC_BUFFER_OVERFLOW: case DEBUG_LOC_INVALID_ENTRY: @@ -3979,7 +3998,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, if (dlbaton->from_dwo) kind = decode_debug_loc_dwo_addresses (dlbaton->per_cu, loc_ptr, buf_end, &new_ptr, - &low, &high); + &low, &high, byte_order); else kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr, &low, &high, @@ -3996,7 +4015,8 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, fprintf_filtered (stream, _(" Base address %s"), paddress (gdbarch, base_address)); continue; - case DEBUG_LOC_NORMAL: + case DEBUG_LOC_START_END: + case DEBUG_LOC_START_LENGTH: break; case DEBUG_LOC_BUFFER_OVERFLOW: case DEBUG_LOC_INVALID_ENTRY: -- 2.7.4