mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 22:51:37 +00:00
perf probe: Support function@filename syntax for --line
Since "perf probe --add" supports function@filename syntax, --line option should also support it. Cc: 2nddept-manager@sdl.hitachi.co.jp Cc: Franck Bui-Huu <fbuihuu@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: linux-kernel@vger.kernel.org LKML-Reference: <20110210090810.1809.26913.stgit@ltc236.sdl.hitachi.co.jp> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
4187e262bc
commit
e116dfa1c3
2 changed files with 16 additions and 6 deletions
|
@ -595,11 +595,11 @@ static int parse_line_num(char **ptr, int *val, const char *what)
|
|||
* The line range syntax is described by:
|
||||
*
|
||||
* SRC[:SLN[+NUM|-ELN]]
|
||||
* FNC[:SLN[+NUM|-ELN]]
|
||||
* FNC[@SRC][:SLN[+NUM|-ELN]]
|
||||
*/
|
||||
int parse_line_range_desc(const char *arg, struct line_range *lr)
|
||||
{
|
||||
char *range, *name = strdup(arg);
|
||||
char *range, *file, *name = strdup(arg);
|
||||
int err;
|
||||
|
||||
if (!name)
|
||||
|
@ -649,7 +649,16 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
|
|||
}
|
||||
}
|
||||
|
||||
if (strchr(name, '.'))
|
||||
file = strchr(name, '@');
|
||||
if (file) {
|
||||
*file = '\0';
|
||||
lr->file = strdup(++file);
|
||||
if (lr->file == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
lr->function = name;
|
||||
} else if (strchr(name, '.'))
|
||||
lr->file = name;
|
||||
else
|
||||
lr->function = name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue