From 9fccedf7604a4d0c6b460c69ba5a006e02a3e0de Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 24 May 2012 01:26:15 +0000 Subject: [PATCH] * dwarf2-frame.c (execute_cfa_program): Update to handle long long -> int64_t change to leb128 API. (read_encoded_value, decode_frame_entry_1): Ditto. * dwarf2expr.c (safe_read_uleb128, safe_read_sleb128): Ditto. (dwarf_block_to_dwarf_reg, dwarf_block_to_dwarf_reg_deref): Ditto. (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): Ditto. (execute_stack_op): Ditto. * dwarf2expr.h (gdb_read_uleb128, gdb_read_sleb128): Ditto. (safe_read_uleb128, safe_read_sleb128): Ditto. * dwarf2loc.c (decode_debug_loc_dwo_addresses): Ditto. (dwarf2_compile_expr_to_ax): Ditto. (locexpr_describe_location_piece): Ditto. (disassemble_dwarf_expression): Ditto. (locexpr_describe_location_1): Ditto. --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/dwarf2-frame.c | 16 ++++++++-------- gdb/dwarf2expr.c | 30 +++++++++++++++--------------- gdb/dwarf2expr.h | 12 ++++++------ gdb/dwarf2loc.c | 30 +++++++++++++++--------------- 5 files changed, 61 insertions(+), 44 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 335450e..55917f4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2012-05-23 Doug Evans + + * dwarf2-frame.c (execute_cfa_program): Update to handle long long -> + int64_t change to leb128 API. + (read_encoded_value, decode_frame_entry_1): Ditto. + * dwarf2expr.c (safe_read_uleb128, safe_read_sleb128): Ditto. + (dwarf_block_to_dwarf_reg, dwarf_block_to_dwarf_reg_deref): Ditto. + (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): Ditto. + (execute_stack_op): Ditto. + * dwarf2expr.h (gdb_read_uleb128, gdb_read_sleb128): Ditto. + (safe_read_uleb128, safe_read_sleb128): Ditto. + * dwarf2loc.c (decode_debug_loc_dwo_addresses): Ditto. + (dwarf2_compile_expr_to_ax): Ditto. + (locexpr_describe_location_piece): Ditto. + (disassemble_dwarf_expression): Ditto. + (locexpr_describe_location_1): Ditto. + 2012-05-23 Stan Shebs Kwok Cheung Yeung diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 96fa451..01786ef 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -416,8 +416,8 @@ execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr, while (insn_ptr < insn_end && fs->pc <= pc) { gdb_byte insn = *insn_ptr++; - unsigned long long utmp, reg; - long long offset; + uint64_t utmp, reg; + int64_t offset; if ((insn & 0xc0) == DW_CFA_advance_loc) fs->pc += (insn & 0x3f) * fs->code_align; @@ -1628,7 +1628,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding, { case DW_EH_PE_uleb128: { - unsigned long long value; + uint64_t value; const gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7; *bytes_read_ptr += safe_read_uleb128 (buf, end_buf, &value) - buf; @@ -1645,7 +1645,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding, return (base + bfd_get_64 (unit->abfd, (bfd_byte *) buf)); case DW_EH_PE_sleb128: { - long long value; + int64_t value; const gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7; *bytes_read_ptr += safe_read_sleb128 (buf, end_buf, &value) - buf; @@ -1830,8 +1830,8 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, int dwarf64_p; ULONGEST cie_id; ULONGEST cie_pointer; - long long sleb128; - unsigned long long uleb128; + int64_t sleb128; + uint64_t uleb128; buf = start; length = read_initial_length (unit->abfd, buf, &bytes_read); @@ -1978,7 +1978,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, cie->saw_z_augmentation = (*augmentation == 'z'); if (cie->saw_z_augmentation) { - unsigned long long length; + uint64_t length; buf = gdb_read_uleb128 (buf, end, &length); if (buf == NULL) @@ -2095,7 +2095,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, can skip the whole thing. */ if (fde->cie->saw_z_augmentation) { - unsigned long long length; + uint64_t length; buf = gdb_read_uleb128 (buf, end, &length); if (buf == NULL) diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 80c6e17..e0aafc7 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -373,7 +373,7 @@ dwarf_expr_eval (struct dwarf_expr_context *ctx, const gdb_byte *addr, const gdb_byte * safe_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - unsigned long long *r) + uint64_t *r) { buf = gdb_read_uleb128 (buf, buf_end, r); if (buf == NULL) @@ -385,7 +385,7 @@ safe_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, const gdb_byte * safe_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - long long *r) + int64_t *r) { buf = gdb_read_sleb128 (buf, buf_end, r); if (buf == NULL) @@ -465,7 +465,7 @@ dwarf_get_base_type (struct dwarf_expr_context *ctx, cu_offset die, int size) int dwarf_block_to_dwarf_reg (const gdb_byte *buf, const gdb_byte *buf_end) { - unsigned long long dwarf_reg; + uint64_t dwarf_reg; if (buf_end <= buf) return -1; @@ -509,8 +509,8 @@ int dwarf_block_to_dwarf_reg_deref (const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *deref_size_return) { - unsigned long long dwarf_reg; - long long offset; + uint64_t dwarf_reg; + int64_t offset; if (buf_end <= buf) return -1; @@ -568,7 +568,7 @@ int dwarf_block_to_fb_offset (const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *fb_offset_return) { - long long fb_offset; + int64_t fb_offset; if (buf_end <= buf) return 0; @@ -595,8 +595,8 @@ int dwarf_block_to_sp_offset (struct gdbarch *gdbarch, const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *sp_offset_return) { - unsigned long long dwarf_reg; - long long sp_offset; + uint64_t dwarf_reg; + int64_t sp_offset; if (buf_end <= buf) return 0; @@ -665,8 +665,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, This is just an optimization, so it's always ok to punt and leave this as 0. */ int in_stack_memory = 0; - unsigned long long uoffset, reg; - long long offset; + uint64_t uoffset, reg; + int64_t offset; struct value *result_val = NULL; /* The DWARF expression might have a bug causing an infinite @@ -839,7 +839,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_implicit_value: { - unsigned long long len; + uint64_t len; op_ptr = safe_read_uleb128 (op_ptr, op_end, &len); if (op_ptr + len > op_end) @@ -860,7 +860,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_GNU_implicit_pointer: { - long long len; + int64_t len; if (ctx->ref_addr_size == -1) error (_("DWARF-2 expression error: DW_OP_GNU_implicit_pointer " @@ -1291,7 +1291,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_piece: { - unsigned long long size; + uint64_t size; /* Record the piece. */ op_ptr = safe_read_uleb128 (op_ptr, op_end, &size); @@ -1308,7 +1308,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_bit_piece: { - unsigned long long size, offset; + uint64_t size, offset; /* Record the piece. */ op_ptr = safe_read_uleb128 (op_ptr, op_end, &size); @@ -1354,7 +1354,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_GNU_entry_value: { - unsigned long long len; + uint64_t len; int dwarf_reg; CORE_ADDR deref_size; diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h index 82a5a93..f39ef3c 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h @@ -311,9 +311,9 @@ int dwarf_block_to_sp_offset (struct gdbarch *gdbarch, const gdb_byte *buf, static inline const gdb_byte * gdb_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - unsigned long long *r) + uint64_t *r) { - size_t bytes_read = read_uleb128_to_ull (buf, buf_end, r); + size_t bytes_read = read_uleb128_to_uint64 (buf, buf_end, r); if (bytes_read == 0) return NULL; @@ -322,9 +322,9 @@ gdb_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, static inline const gdb_byte * gdb_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - long long *r) + int64_t *r) { - size_t bytes_read = read_sleb128_to_ll (buf, buf_end, r); + size_t bytes_read = read_sleb128_to_int64 (buf, buf_end, r); if (bytes_read == 0) return NULL; @@ -343,11 +343,11 @@ gdb_skip_leb128 (const gdb_byte *buf, const gdb_byte *buf_end) extern const gdb_byte *safe_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - unsigned long long *r); + uint64_t *r); extern const gdb_byte *safe_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, - long long *r); + int64_t *r); extern const gdb_byte *safe_skip_leb128 (const gdb_byte *buf, const gdb_byte *buf_end); diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 9bd7741..8c97f19 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -139,7 +139,7 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu, const gdb_byte **new_ptr, CORE_ADDR *low, CORE_ADDR *high) { - unsigned long long low_index, high_index; + uint64_t low_index, high_index; if (loc_ptr == buf_end) return DEBUG_LOC_BUFFER_OVERFLOW; @@ -2566,8 +2566,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, while (op_ptr < op_end) { enum dwarf_location_atom op = *op_ptr; - unsigned long long uoffset, reg; - long long offset; + uint64_t uoffset, reg; + int64_t offset; int i; offsets[op_ptr - base] = expr->len; @@ -2725,7 +2725,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, case DW_OP_implicit_value: { - unsigned long long len; + uint64_t len; op_ptr = safe_read_uleb128 (op_ptr, op_end, &len); if (op_ptr + len > op_end) @@ -3075,7 +3075,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, case DW_OP_piece: case DW_OP_bit_piece: { - unsigned long long size, offset; + uint64_t size, offset; if (op_ptr - 1 == previous_piece) error (_("Cannot translate empty pieces to agent expressions")); @@ -3267,7 +3267,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, } else if (data[0] == DW_OP_regx) { - unsigned long long reg; + uint64_t reg; data = safe_read_uleb128 (data + 1, end, ®); fprintf_filtered (stream, _("a variable in $%s"), @@ -3278,10 +3278,10 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, struct block *b; struct symbol *framefunc; int frame_reg = 0; - long long frame_offset; + int64_t frame_offset; const gdb_byte *base_data, *new_data, *save_data = data; size_t base_size; - long long base_offset = 0; + int64_t base_offset = 0; new_data = safe_read_sleb128 (data + 1, end, &frame_offset); if (!piece_end_p (new_data, end)) @@ -3335,7 +3335,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, else if (data[0] >= DW_OP_breg0 && data[0] <= DW_OP_breg31 && piece_end_p (data, end)) { - long long offset; + int64_t offset; data = safe_read_sleb128 (data + 1, end, &offset); @@ -3409,8 +3409,8 @@ disassemble_dwarf_expression (struct ui_file *stream, || (data[0] != DW_OP_piece && data[0] != DW_OP_bit_piece))) { enum dwarf_location_atom op = *data++; - unsigned long long ul; - long long l; + uint64_t ul; + int64_t l; const char *name; name = get_DW_OP_name (op); @@ -3630,7 +3630,7 @@ disassemble_dwarf_expression (struct ui_file *stream, case DW_OP_bit_piece: { - unsigned long long offset; + uint64_t offset; data = safe_read_uleb128 (data, end, &ul); data = safe_read_uleb128 (data, end, &offset); @@ -3685,7 +3685,7 @@ disassemble_dwarf_expression (struct ui_file *stream, case DW_OP_GNU_regval_type: { - unsigned long long reg; + uint64_t reg; cu_offset type_die; struct type *type; @@ -3794,7 +3794,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, fprintf_filtered (stream, " "); if (data[0] == DW_OP_piece) { - unsigned long long bytes; + uint64_t bytes; data = safe_read_uleb128 (data + 1, end, &bytes); @@ -3807,7 +3807,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, } else if (data[0] == DW_OP_bit_piece) { - unsigned long long bits, offset; + uint64_t bits, offset; data = safe_read_uleb128 (data + 1, end, &bits); data = safe_read_uleb128 (data, end, &offset); -- 2.7.4