diff options
author | Doug Evans <dje@google.com> | 2012-05-22 18:45:22 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2012-05-22 18:45:22 +0000 |
commit | f664829eae5325405ce4e7f064c7be02352ce1f6 (patch) | |
tree | 2cbd8db92d387d8f924b1c6f0fed4e2977ff7e22 /gdb/dwarf2expr.h | |
parent | dfc8a1a28522a59bb4d3fc39a843b32469c6f7d5 (diff) | |
download | gdb-f664829eae5325405ce4e7f064c7be02352ce1f6.zip gdb-f664829eae5325405ce4e7f064c7be02352ce1f6.tar.gz gdb-f664829eae5325405ce4e7f064c7be02352ce1f6.tar.bz2 |
* dwarf2-frame.c (struct dwarf2_cie): Make initial_instructions, end
"const gdb_byte *".
(struct dwarf2_fde): Make instructions, end "const gdb_byte *".
(execute_cfa_program): Update to match API of leb128 functions.
(read_1_byte, read_4_bytes, read_8_bytes): Make buf parameter
"const gdb_byte *".
(read_unsigned_leb128, read_signed_leb128): Delete.
(read_initial_length): Change type of buf argument to
"const gdb_byte *".
(read_encoded_value): Update to match API of leb128 functions.
(decode_frame_entry): Change result to "const gdb_byte *", and
similarly for "start" parameter.
(decode_frame_entry_1): Ditto. Use new leb128 reader functions.
(dwarf2_build_frame_info): Change local frame_ptr to
"const gdb_byte *".
* dwarf2expr.c (safe_read_uleb128, safe_read_sleb128): Replaces
read_uleb128, read_sleb128. All callers updated.
(safe_skip_leb128): New function.
(dwarf_block_to_dwarf_reg): Update to match API of leb128 functions.
Call gdb_read_uleb128, gdb_skip_leb128 instead of read_uleb128.
(dwarf_block_to_dwarf_reg_deref): Update to match API of leb128
functions. Call gdb_read_uleb128, gdb_read_sleb128 instead of
read_uleb128, read_sleb128.
(dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): Ditto.
(execute_stack_op): Update to match API of leb128 functions.
* dwarf2expr.h: #include "leb128.h".
(read_uleb128, read_sleb128): Delete.
(gdb_read_uleb128, gdb_read_sleb128, gdb_skip_leb128): New functions.
(safe_read_uleb128, safe_read_sleb128, safe_skip_leb128): Declare.
* dwarf2loc.c (debug_loc_kind): New enum.
(decode_debug_loc_addresses): New function.
(decode_debug_loc_dwo_addresses): New function.
(dwarf2_find_location_expression): Rewrite.
(dwarf2_compile_expr_to_ax): Update to match API of leb128 functions.
(locexpr_describe_location_piece): Ditto.
(disassemble_dwarf_expression): Ditto.
(locexpr_describe_location_1): Ditto.
(loclist_describe_location): Rewrite.
* dwarf2loc.h (dwarf2_loclist_baton): New member "from_dwo".
* dwarf2read.c (die_reader_specs): New member "buffer_end".
(dwarf2_section_buffer_overflow_complaint): Renamed from
dwarf2_macros_too_long_complaint. All callers updated.
(skip_leb128): Delete.
(init_cu_die_reader): Initialize reader->buffer_end.
(skip_one_die): Replace call to skip_leb128 with safe_skip_leb128.
(skip_form_bytes): New arg buffer_end. All callers updated.
Replace call to skip_leb128 with gdb_skip_leb128.
(skip_unknown_opcode): New arg mac_end. All callers updated.
(fill_in_loclist_baton): Initialize baton->from_dwo.
Diffstat (limited to 'gdb/dwarf2expr.h')
-rw-r--r-- | gdb/dwarf2expr.h | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h index 3699dbb..82a5a93 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h @@ -23,6 +23,8 @@ #if !defined (DWARF2EXPR_H) #define DWARF2EXPR_H +#include "leb128.h" + struct dwarf_expr_context; /* Offset relative to the start of its containing CU (compilation unit). */ @@ -273,12 +275,6 @@ struct value *dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n); CORE_ADDR dwarf_expr_fetch_address (struct dwarf_expr_context *ctx, int n); int dwarf_expr_fetch_in_stack_memory (struct dwarf_expr_context *ctx, int n); - -const gdb_byte *read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - ULONGEST * r); -const gdb_byte *read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - LONGEST * r); - void dwarf_expr_require_composition (const gdb_byte *, const gdb_byte *, const char *); @@ -310,4 +306,50 @@ int dwarf_block_to_sp_offset (struct gdbarch *gdbarch, const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *sp_offset_return); +/* Wrappers around the leb128 reader routines to simplify them for our + purposes. */ + +static inline const gdb_byte * +gdb_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, + unsigned long long *r) +{ + size_t bytes_read = read_uleb128_to_ull (buf, buf_end, r); + + if (bytes_read == 0) + return NULL; + return buf + bytes_read; +} + +static inline const gdb_byte * +gdb_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, + long long *r) +{ + size_t bytes_read = read_sleb128_to_ll (buf, buf_end, r); + + if (bytes_read == 0) + return NULL; + return buf + bytes_read; +} + +static inline const gdb_byte * +gdb_skip_leb128 (const gdb_byte *buf, const gdb_byte *buf_end) +{ + size_t bytes_read = skip_leb128 (buf, buf_end); + + if (bytes_read == 0) + return NULL; + return buf + bytes_read; +} + +extern const gdb_byte *safe_read_uleb128 (const gdb_byte *buf, + const gdb_byte *buf_end, + unsigned long long *r); + +extern const gdb_byte *safe_read_sleb128 (const gdb_byte *buf, + const gdb_byte *buf_end, + long long *r); + +extern const gdb_byte *safe_skip_leb128 (const gdb_byte *buf, + const gdb_byte *buf_end); + #endif /* dwarf2expr.h */ |