Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: New ARI warning Wed May 23 01:55:03 UTC 2012
Date: Wed, 23 May 2012 07:10:00 -0000	[thread overview]
Message-ID: <CADPb22QBYSRjoqrgX7p0d5KdAZ+kEk4Ga2YrfHMrm_t_yKCE6w@mail.gmail.com> (raw)
In-Reply-To: <m3r4ubo7j0.fsf@redhat.com>

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);


  parent reply	other threads:[~2012-05-23  7:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23  1:55 GDB Administrator
2012-05-23  4:18 ` Sergio Durigan Junior
2012-05-23  7:10   ` Andreas Schwab
2012-05-23  7:10   ` Doug Evans [this message]
2012-05-23  7:27     ` Doug Evans
2012-05-23  8:19       ` Pierre Muller
2012-05-23 14:45       ` Sergio Durigan Junior
     [not found]       ` <4fbc9d77.0853b40a.641e.ffff90dbSMTPIN_ADDED@mx.google.com>
2012-05-23 14:46         ` Doug Evans
2012-05-23 15:01           ` Doug Evans
2012-05-23 15:27             ` Pedro Alves
2012-05-24 18:55           ` Tom Tromey
2012-05-28 20:44             ` Mark Kettenis
2012-05-28 21:59               ` Joel Brobecker
2012-05-29 13:29               ` Maciej W. Rozycki
2012-06-22 16:05               ` Tom Tromey
2012-06-22 17:19                 ` Joel Brobecker
2012-06-22 17:31                   ` Joel Brobecker
2012-06-22 17:41                     ` Tom Tromey
2012-06-22 19:02                       ` Joel Brobecker
2012-06-25 19:59                         ` Doug Evans
2012-06-26 13:31                         ` Mark Kettenis
2012-06-26 13:15                   ` Mark Kettenis
2012-06-26 11:51                 ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADPb22QBYSRjoqrgX7p0d5KdAZ+kEk4Ga2YrfHMrm_t_yKCE6w@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox