lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cg_jek56XBqfW_rJMhOsD4vgq2-uEHeLr=QU6p6YgPNNQ@mail.gmail.com>
Date:   Wed, 22 Feb 2017 19:47:26 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Taeung Song <treeze.taeung@...il.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Jiri Olsa <jolsa@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Wang Nan <wangnan0@...wei.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>, Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH 1/4] perf annotate: Remove needless regular expression for filename:linenr

Hi Taeung,

On Wed, Feb 22, 2017 at 7:08 PM, Taeung Song <treeze.taeung@...il.com> wrote:
> The commit e592488c01d5 ("perf annotate: Support source line
> numbers in annotate") support source line numbers in annotate.
>
> But we can get filename:line number by symbol__get_source_line()
> Furthermore, the way can't exactly match source code lines
> to actual line numbers.
>
> For example,
> Actual source code is as below
>
> ...
>   21 };
>   22
>   23 unsigned int limited_wgt;
>   24
>   25 unsigned int get_cond_maxprice(int wgt)
>   26 {
> ...
>
> However, the output of annotate with the way about regmatch
> is as below.
>
>   4   Disassembly of section .text:
>
>   6   0000000000400966 <get_cond_maxprice>:
>   7   get_cond_maxprice():
>   26  };
>
>   28  unsigned int limited_wgt;
>
>   30  unsigned int get_cond_maxprice(int wgt)
>   31  {
>
> The root cause is from objdump -S.
> Because the source code of objdump used to print more code lines
> than actual one code line according to a particular line number.
> In the near future, I'll fix the problem about line numbers.

So what's the purpose of this patch?  You just removed the line
number from the output, it changed behavior for what?  If you want
to fix a problem of line number, please do it here..

Thanks,
Namhyung


>
> Cc: Andi Kleen <ak@...ux.intel.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Signed-off-by: Taeung Song <treeze.taeung@...il.com>
> ---
>  tools/perf/util/annotate.c | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 273f21f..bc54e41 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -19,14 +19,12 @@
>  #include "evsel.h"
>  #include "block-range.h"
>  #include "arch/common.h"
> -#include <regex.h>
>  #include <pthread.h>
>  #include <linux/bitops.h>
>  #include <sys/utsname.h>
>
>  const char     *disassembler_style;
>  const char     *objdump_path;
> -static regex_t  file_lineno;
>
>  static struct ins_ops *ins__find(struct arch *arch, const char *name);
>  static void ins__sort(struct arch *arch);
> @@ -1151,7 +1149,6 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
>         char *line = NULL, *parsed_line, *tmp, *tmp2, *c;
>         size_t line_len;
>         s64 line_ip, offset = -1;
> -       regmatch_t match[2];
>
>         if (getline(&line, &line_len, file) < 0)
>                 return -1;
> @@ -1169,12 +1166,6 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
>         line_ip = -1;
>         parsed_line = line;
>
> -       /* /filename:linenr ? Save line number and ignore. */
> -       if (regexec(&file_lineno, line, 2, match, 0) == 0) {
> -               *line_nr = atoi(line + match[1].rm_so);
> -               return 0;
> -       }
> -
>         /*
>          * Strip leading spaces:
>          */
> @@ -1235,11 +1226,6 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
>         return 0;
>  }
>
> -static __attribute__((constructor)) void symbol__init_regexpr(void)
> -{
> -       regcomp(&file_lineno, "^/[^:]+:([0-9]+)", REG_EXTENDED);
> -}
> -
>  static void delete_last_nop(struct symbol *sym)
>  {
>         struct annotation *notes = symbol__annotation(sym);
> @@ -1435,7 +1421,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na
>         snprintf(command, sizeof(command),
>                  "%s %s%s --start-address=0x%016" PRIx64
>                  " --stop-address=0x%016" PRIx64
> -                " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
> +                " -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
>                  objdump_path ? objdump_path : "objdump",
>                  disassembler_style ? "-M " : "",
>                  disassembler_style ? disassembler_style : "",
> --
> 2.7.4
>



-- 
Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ