Skip to content

llvm-dwarfdump does not handle DW_OP_implicit_pointer #53824

Open
@wcohen

Description

@wcohen

When using llvm-dwarfdump on some gcc generated code I found that it did not decode location information for items using DW_OP_implicit_pointer. I was able to reproduce the problems from a small example from https://patchwork.ozlabs.org/project/gcc/patch/20100812080522.GL702@tyan-ft48-01.lab.bos.redhat.com/#153158 , dw_op_implicit_pointer.c:

struct S
{
  int *x, y;
};

int u[6];

static inline void
add (struct S *a, struct S *b, int c)
{
  *a->x += *b->x;
  a->y += b->y;
  u[c + 0]++;
  a = (struct S *) 0;
  u[c + 1]++;
  a = b;
  u[c + 2]++;
}

int
foo (int i)
{
  int j = i;
  struct S p[2] = { {&i, i * 2}, {&j, j * 2} };
  add (&p[0], &p[1], 0);
  p[0].x = &j;
  p[1].x = &i;
  add (&p[0], &p[1], 3);
  return i + j;
}

int
bar (int i)
{
  int *j = &i;
  int **k = &j;
  int ***l = &k;
  i++;
  return i;
}

compiled with the following on Fedora 35 with gcc-11.2.1-7.fc35.x86_64:

gcc -g -O2 -c dw_op_implicit_pointer.c

Look through the resulting dw_op_implicit_pointer.o with llvm-13.0.0-4.fc35.x86_64

llvm-dwarfdump dw_op_implicit_pointer.o

See entries like the following where the DW_OP_implicit_pointer (a0) is not decoded:

0x00000153:       DW_TAG_formal_parameter
                    DW_AT_abstract_origin	(0x000001dd "b")
                    DW_AT_location	(0x00000081: 
                       [0x0000000000000000, 0x0000000000000018): <decoding error> a0 00 00 00 00 10)
                    DW_AT_GNU_entry_view	(0x0000007f)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions