break;
case DW_TAG_pointer_type:
- if (e->components[i].first == target_symbol::comp_literal_array_index)
- throw semantic_error ("cannot index pointer", e->tok);
- // XXX: of course, we should support this the same way C does,
- // by explicit pointer arithmetic etc. PR4166.
-
c_translate_pointer (pool, 1, 0 /* PR9768*/, die, tail);
- break;
+ if (e->components[i].first != target_symbol::comp_literal_array_index)
+ break;
+ /* else fall through as an array access */
case DW_TAG_array_type:
if (e->components[i].first == target_symbol::comp_literal_array_index)
if (dwarf_attr_integrate (die, DW_AT_type, attr_mem) == NULL)
throw semantic_error ("cannot get type of field: " + string(dwarf_errmsg (-1)), e->tok);
}
+
+ /* For an array index, we need to dereference the final DIE */
+ if (e->components.back().first == target_symbol::comp_literal_array_index)
+ die = dwarf_formref_die (attr_mem, die_mem);
+
return die;
}
Dwarf_Die *typedie, struct location **input,
const char *idx, Dwarf_Word const_idx)
{
- assert (dwarf_tag (typedie) == DW_TAG_array_type);
+ assert (dwarf_tag (typedie) == DW_TAG_array_type ||
+ dwarf_tag (typedie) == DW_TAG_pointer_type);
++indent;
--- /dev/null
+set test "pointer_array"
+set ::result_string {/bin/true
+/
+b
+i
+n
+/
+t
+r
+u
+e
+0}
+stap_run2 $srcdir/$subdir/$test.stp -c/bin/true
--- /dev/null
+probe syscall.execve
+{
+ if (pid() == target()) {
+ println(user_string($argv[0]))
+ printf("%c\n", $argv[0][0])
+ printf("%c\n", $argv[0][1])
+ printf("%c\n", $argv[0][2])
+ printf("%c\n", $argv[0][3])
+ printf("%c\n", $argv[0][4])
+ printf("%c\n", $argv[0][5])
+ printf("%c\n", $argv[0][6])
+ printf("%c\n", $argv[0][7])
+ printf("%c\n", $argv[0][8])
+ println($argv[0][9])
+ }
+}