lkml.org 
[lkml]   [2013]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/3] Support for perf to probe into SDT markers:
On 10/19/2013 09:18 PM, Masami Hiramatsu wrote:
> [...]
> +
> + /*
> + * Find out the .stapsdt.base section.
> + * This scn will help us to handle prelinking (if present).
> + * Compare the retrieved file offset of the base section with the
> + * base address in the description of the SDT note. If its different,
> + * then accordingly, adjust the note location.
> + */
> + if (elf_section_by_name(elf, &ehdr, &shdr, SDT_BASE_SCN, NULL))
> + base_off = shdr.sh_offset;
> + if (base_off) {
> + if (tmp->bit32)
> + key->addr.a32[0] = tmp->addr.a32[0] + base_off -
> + tmp->addr.a32[1];
> + else
> + key->addr.a64[0] = tmp->addr.a64[0] + base_off -
> + tmp->addr.a64[1];
> + }
> + key->bit32 = tmp->bit32;
> +}
> +
> +int search_sdt_note(struct sdt_note *key, struct list_head *sdt_notes,
> + const char *target)
> Hmm, this interface looks very odd.
> - This just finds the first matched sdt_note entry instead of the list.
> In that case, we don't need to pass the list_head.
> - If the purpose is just counting the number of matched entries (or just
> checking existence), we also don't need the list. Just returning the
> number is enough.
>
> I recommend you to remove the "sdt_notes", and make the caller check
> key->addr is set.

Yeah, list isn't required in this case. Thanks for pointing that out.
Will change that.

> [...]
>
--
Thanks
Hemant Kumar



\
 
 \ /
  Last update: 2013-10-20 10:01    [W:0.046 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site