Skip to content

Commit

Permalink
2005-08-18 Roland McGrath <roland@redhat.com>
Browse files Browse the repository at this point in the history
	* loc2c.c (c_translate_addressof): Take TYPEDIE instead of TYPEATTR.
	* loc2c.h: Update decl.
	* loc2c-test.c (handle_variable): Handle DW_TAG_pointer_type target
	for fetch.
  • Loading branch information
roland committed Aug 18, 2005
1 parent 75a163d commit f0df19a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
28 changes: 22 additions & 6 deletions loc2c-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,29 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out,
error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1));
}

if (typetag != DW_TAG_base_type)
error (2, 0, _("fetch or store supported only for base type"));
switch (typetag)
{
case DW_TAG_base_type:
if (store)
c_translate_store (&pool, 1, cubias, die, typedie, &tail, "value");
else
c_translate_fetch (&pool, 1, cubias, die, typedie, &tail, "value");
break;

if (store)
c_translate_store (&pool, 1, cubias, die, typedie, &tail, "value");
else
c_translate_fetch (&pool, 1, cubias, die, typedie, &tail, "value");
case DW_TAG_pointer_type:
if (store)
error (2, 0, _("store not supported for pointer type"));
c_translate_pointer (&pool, 1, cubias, typedie, &tail);
c_translate_addressof (&pool, 1, cubias, die, typedie, &tail, "value");
break;

default:
if (store)
error (2, 0, _("store supported only for base type"));
else
error (2, 0, _("fetch supported only for base type or pointer"));
break;
}

printf ("#define PROBEADDR %#" PRIx64 "ULL\n", pc);

Expand Down
2 changes: 1 addition & 1 deletion loc2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ void
c_translate_addressof (struct obstack *pool, int indent,
Dwarf_Addr dwbias __attribute__ ((unused)),
Dwarf_Die *die,
Dwarf_Attribute *typeattr __attribute__ ((unused)),
Dwarf_Die *typedie __attribute__ ((unused)),
struct location **input, const char *target)
{
++indent;
Expand Down
2 changes: 1 addition & 1 deletion loc2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void c_translate_array (struct obstack *pool, int indent,
is a register or noncontiguous object. */
void c_translate_addressof (struct obstack *pool, int indent,
Dwarf_Addr dwbias, Dwarf_Die *die,
Dwarf_Attribute *typeattr,
Dwarf_Die *typedie,
struct location **input, const char *target);

/* Translate a fragment to fetch the value of variable or member DIE
Expand Down

0 comments on commit f0df19a

Please sign in to comment.