mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
perf annotate-data: Check kind of stack variables
I sometimes see ("unknown type") in the result and it was because it didn't check the type of stack variables properly during the instruction tracking. The stack can carry constant values (without type info) and if the target instruction is accessing the stack location, it resulted in the "unknown type". Maybe we could pick one of integer types for the constant, but it doesn't really mean anything useful. Let's just drop the stack slot if it doesn't have a valid type info. Here's an example how it got the unknown type. Note that 0xffffff48 = -0xb8. ----------------------------------------------------------- find data type for 0xffffff48(reg6) at ... CU for ... frame base: cfa=0 fbreg=6 scope: [2/2] (die:11cb97f) bb: [37 - 3a] var [37] reg15 type='int' size=0x4 (die:0x1180633) bb: [40 - 4b] mov [40] imm=0x1 -> reg13 var [45] reg8 type='sigset_t*' size=0x8 (die:0x11a39ee) mov [45] imm=0x1 -> reg2 <--- here reg2 has a constant bb: [215 - 237] mov [218] reg2 -> -0xb8(stack) constant <--- and save it to the stack mov [225] reg13 -> -0xc4(stack) constant call [22f] find_task_by_vgpid call [22f] return -> reg0 type='struct task_struct*' size=0x8 (die:0x11881e8) bb: [5c8 - 5cf] bb: [2fb - 302] mov [2fb] -0xc4(stack) -> reg13 constant bb: [13b - 14d] mov [143] 0xd50(reg3) -> reg5 type='struct task_struct*' size=0x8 (die:0xa31f3c) bb: [153 - 153] chk [153] reg6 offset=0xffffff48 ok=0 kind=0 fbreg <--- access here found by insn track: 0xffffff48(reg6) type-offset=0 type='G<EF>^K<F6><AF>U' size=0 (die:0xffffffffffffffff) Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20240502060011.1838090-7-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
af89e8f2bd
commit
b7d4aacfc8
@ -1314,6 +1314,9 @@ static int check_matching_type(struct type_state *state,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stack->kind != TSR_KIND_TYPE)
|
||||
return 0;
|
||||
|
||||
*type_die = stack->type;
|
||||
/* Update the type offset from the start of slot */
|
||||
dloc->type_offset -= stack->offset;
|
||||
@ -1343,6 +1346,9 @@ static int check_matching_type(struct type_state *state,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stack->kind != TSR_KIND_TYPE)
|
||||
return 0;
|
||||
|
||||
*type_die = stack->type;
|
||||
/* Update the type offset from the start of slot */
|
||||
dloc->type_offset -= fboff + stack->offset;
|
||||
|
Loading…
Reference in New Issue
Block a user