Re: [PATCH v2 06/10] perf annotate: Track arithmetic instructions on pointers

From: Zecheng Li
Date: Wed Sep 03 2025 - 16:27:15 EST


> I was thinking we can use TSR_KIND_POINTER here. Probably we need to
> distinguish it from the existing percpu base use case. Maybe you want
> to rename it. Then you don't need to find a pointer type in the DWARF.

Hi Namhyung, thanks for the review.

Yes. I think that's a better way to represent a pointer to a type.
With that tag we can also support registers representing addresses
(is_reg_var_addr == true). And when moving an address register to a
memory location we probably can simply add the * to denote a pointer
without finding the exact pointer type.

>
> > + tsr->offset = 0;
>
> I think it can refer to a member in a struct. How about this?
>
> tsr->offset = state->offset - offset;

True, it may load an address of a struct member. Do you mean
stack->offset - offset?

> > @@ -388,6 +493,7 @@ static void update_insn_state_x86(struct type_state *state,
> > tsr->type = state->regs[src->reg1].type;
> > tsr->kind = state->regs[src->reg1].kind;
> > tsr->imm_value = state->regs[src->reg1].imm_value;
> > + tsr->offset = 0;
> > tsr->ok = true;

I also find for mov register to register this should be

tsr->offset = state->regs[src->reg1].offset;

Let me update the patch.

Zecheng