bug: fetch wrong argument address, so fetch argument failed
Closed this issue · 0 comments
for example:
type Student struct {
name string;
age int;
}
func (s *Student) String() string {
return fmt.Sprintf("name: %s, age: %d", s.name, s.age)
}
for the s.name.len, we can use pahole
to check its padding and alignment:
struct string {
uint8 * str; /* 0 8 */
int len; /* 8 8 */
/* size: 16, cachelines: 1, members: 2 */
/* last cacheline: 16 bytes */
};
in jschwinger233/gofuncgraph, you cannot fetch the s.age
and the s.name.len
, you can just fetch s.name.
well, because it has bugs in calculate the effective address of argument to fetch, it wrongly deference the address+offset, which may already be an effective address.
Even if gofuncgraph looks like fetch the s.name correctly, actually not. Because it cannot fetch the s.name.len correctly, you cannot determine the length of s.name. And we cannot fetched the s.age for the same reason.
so we should extend the fetch argument pattern to differentiate whether deference is needed when calculating the effective address ... and add some demo and document to describe how to use this pattern to fetch args.