This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New ARI warning Wed May 23 01:55:03 UTC 2012


Well, blech.
src/include/leb128.h uses long long per request, so that's what I used here.
src/include/anything obviously cannot use LONGEST/ULONGEST.

Are long long's really verboten?

I suppose I could create a gdb-leb128.h that used LONGEST/ULONGEST,
but blech.


On Tue, May 22, 2012 at 9:17 PM, Sergio Durigan Junior
<sergiodj@redhat.com> wrote:
> WDYT about the following patch? ?I would like you to take a look at the
> gdb/dwarf2expr.h's castings that I had to make in order to get the
> compilation right.
>
> Thanks,
>
> --
> Sergio
>
> diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
> index 96fa451..fd463ed 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;
> + ? ? ?ULONGEST utmp, reg;
> + ? ? ?LONGEST 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;
> + ? ? ? ULONGEST 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;
> + ? ? ? LONGEST 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;
> + ?LONGEST sleb128;
> + ?ULONGEST 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;
> + ? ? ? ? ULONGEST 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;
> + ? ? ? ? ULONGEST length;
>
> ? ? ? ? ?buf = gdb_read_uleb128 (buf, end, &length);
> ? ? ? ? ?if (buf == NULL)
> diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
> index 80c6e17..fc29637 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)
> + ? ? ? ? ? ? ? ? ?ULONGEST *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)
> + ? ? ? ? ? ? ? ? ?LONGEST *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;
> + ?ULONGEST 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;
> + ?ULONGEST dwarf_reg;
> + ?LONGEST 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;
> + ?LONGEST 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;
> + ?ULONGEST dwarf_reg;
> + ?LONGEST 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;
> + ? ? ?ULONGEST uoffset, reg;
> + ? ? ?LONGEST 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;
> + ? ? ? ? ? ULONGEST 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;
> + ? ? ? ? ? LONGEST 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;
> + ? ? ? ? ? ?ULONGEST 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;
> + ? ? ? ? ? ULONGEST 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;
> + ? ? ? ? ? ULONGEST len;
> ? ? ? ? ? ?int dwarf_reg;
> ? ? ? ? ? ?CORE_ADDR deref_size;
>
> diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
> index 82a5a93..57fe39e 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)
> + ? ? ? ? ? ? ? ? ULONGEST *r)
> ?{
> - ?size_t bytes_read = read_uleb128_to_ull (buf, buf_end, r);
> + ?size_t bytes_read = read_uleb128_to_ull (buf, buf_end, (unsigned long long *) 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)
> + ? ? ? ? ? ? ? ? LONGEST *r)
> ?{
> - ?size_t bytes_read = read_sleb128_to_ll (buf, buf_end, r);
> + ?size_t bytes_read = read_sleb128_to_ll (buf, buf_end, (long long *) 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);
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ULONGEST *r);
>
> ?extern const gdb_byte *safe_read_sleb128 (const gdb_byte *buf,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const gdb_byte *buf_end,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? long long *r);
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LONGEST *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..14af020 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;
> + ?ULONGEST 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;
> + ? ? ?ULONGEST uoffset, reg;
> + ? ? ?LONGEST 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;
> + ? ? ? ? ? ULONGEST 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;
> + ? ? ? ? ? ULONGEST 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;
> + ? ? ?ULONGEST reg;
>
> ? ? ? data = safe_read_uleb128 (data + 1, end, &reg);
> ? ? ? 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;
> + ? ? ?LONGEST frame_offset;
> ? ? ? const gdb_byte *base_data, *new_data, *save_data = data;
> ? ? ? size_t base_size;
> - ? ? ?long long base_offset = 0;
> + ? ? ?LONGEST 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;
> + ? ? ?LONGEST 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;
> + ? ? ?ULONGEST ul;
> + ? ? ?LONGEST 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;
> + ? ? ? ? ? ULONGEST 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;
> + ? ? ? ? ? ULONGEST 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;
> + ? ? ? ? ? ? ULONGEST 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;
> + ? ? ? ? ? ? ULONGEST bits, offset;
>
> ? ? ? ? ? ? ?data = safe_read_uleb128 (data + 1, end, &bits);
> ? ? ? ? ? ? ?data = safe_read_uleb128 (data, end, &offset);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]