* [PATCH] tools/perf: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data
@ 2022-11-05 3:01 Masami Hiramatsu (Google)
2022-11-07 21:09 ` Namhyung Kim
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu (Google) @ 2022-11-05 3:01 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, linux-perf-users, linux-kernel,
Masami Hiramatsu, Steven Rostedt
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Dwarf version 5 standard Sec 2.14 says that
Any debugging information entry representing the declaration of an object,
module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and
DW_AT_decl_column attributes, each of whose value is an unsigned integer
constant.
So it should be an unsigned integer data. Also, even though the standard
doesn't clearly say the DW_AT_call_file is signed or unsigned, the
elfutils (eu-readelf) interprets it as unsigned integer data and it is
natural to handle it as unsigned integer data as same as DW_AT_decl_file.
This changes the DW_AT_call_file as unsigned integer data too.
Fixes: 3f4460a28fb2 ("perf probe: Filter out redundant inline-instances")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
tools/perf/util/dwarf-aux.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 30b36b525681..b07414409771 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -315,19 +315,6 @@ static int die_get_attr_udata(Dwarf_Die *tp_die, unsigned int attr_name,
return 0;
}
-/* Get attribute and translate it as a sdata */
-static int die_get_attr_sdata(Dwarf_Die *tp_die, unsigned int attr_name,
- Dwarf_Sword *result)
-{
- Dwarf_Attribute attr;
-
- if (dwarf_attr_integrate(tp_die, attr_name, &attr) == NULL ||
- dwarf_formsdata(&attr, result) != 0)
- return -ENOENT;
-
- return 0;
-}
-
/**
* die_is_signed_type - Check whether a type DIE is signed or not
* @tp_die: a DIE of a type
@@ -467,9 +454,9 @@ int die_get_data_member_location(Dwarf_Die *mb_die, Dwarf_Word *offs)
/* Get the call file index number in CU DIE */
static int die_get_call_fileno(Dwarf_Die *in_die)
{
- Dwarf_Sword idx;
+ Dwarf_Word idx;
- if (die_get_attr_sdata(in_die, DW_AT_call_file, &idx) == 0)
+ if (die_get_attr_udata(in_die, DW_AT_call_file, &idx) == 0)
return (int)idx;
else
return -ENOENT;
@@ -478,9 +465,9 @@ static int die_get_call_fileno(Dwarf_Die *in_die)
/* Get the declared file index number in CU DIE */
static int die_get_decl_fileno(Dwarf_Die *pdie)
{
- Dwarf_Sword idx;
+ Dwarf_Word idx;
- if (die_get_attr_sdata(pdie, DW_AT_decl_file, &idx) == 0)
+ if (die_get_attr_udata(pdie, DW_AT_decl_file, &idx) == 0)
return (int)idx;
else
return -ENOENT;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/perf: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data
2022-11-05 3:01 [PATCH] tools/perf: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data Masami Hiramatsu (Google)
@ 2022-11-07 21:09 ` Namhyung Kim
2022-11-08 21:08 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2022-11-07 21:09 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Mark Rutland, Alexander Shishkin, Jiri Olsa, linux-perf-users,
linux-kernel, Steven Rostedt
Hi Masami,
On Fri, Nov 4, 2022 at 8:01 PM Masami Hiramatsu (Google)
<mhiramat@kernel.org> wrote:
>
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Dwarf version 5 standard Sec 2.14 says that
>
> Any debugging information entry representing the declaration of an object,
> module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and
> DW_AT_decl_column attributes, each of whose value is an unsigned integer
> constant.
>
> So it should be an unsigned integer data. Also, even though the standard
> doesn't clearly say the DW_AT_call_file is signed or unsigned, the
> elfutils (eu-readelf) interprets it as unsigned integer data and it is
> natural to handle it as unsigned integer data as same as DW_AT_decl_file.
> This changes the DW_AT_call_file as unsigned integer data too.
>
> Fixes: 3f4460a28fb2 ("perf probe: Filter out redundant inline-instances")
> Cc: stable@vger.kernel.org
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> tools/perf/util/dwarf-aux.c | 21 ++++-----------------
> 1 file changed, 4 insertions(+), 17 deletions(-)
>
> diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> index 30b36b525681..b07414409771 100644
> --- a/tools/perf/util/dwarf-aux.c
> +++ b/tools/perf/util/dwarf-aux.c
> @@ -315,19 +315,6 @@ static int die_get_attr_udata(Dwarf_Die *tp_die, unsigned int attr_name,
> return 0;
> }
>
> -/* Get attribute and translate it as a sdata */
> -static int die_get_attr_sdata(Dwarf_Die *tp_die, unsigned int attr_name,
> - Dwarf_Sword *result)
> -{
> - Dwarf_Attribute attr;
> -
> - if (dwarf_attr_integrate(tp_die, attr_name, &attr) == NULL ||
> - dwarf_formsdata(&attr, result) != 0)
> - return -ENOENT;
> -
> - return 0;
> -}
> -
> /**
> * die_is_signed_type - Check whether a type DIE is signed or not
> * @tp_die: a DIE of a type
> @@ -467,9 +454,9 @@ int die_get_data_member_location(Dwarf_Die *mb_die, Dwarf_Word *offs)
> /* Get the call file index number in CU DIE */
> static int die_get_call_fileno(Dwarf_Die *in_die)
> {
> - Dwarf_Sword idx;
> + Dwarf_Word idx;
>
> - if (die_get_attr_sdata(in_die, DW_AT_call_file, &idx) == 0)
> + if (die_get_attr_udata(in_die, DW_AT_call_file, &idx) == 0)
> return (int)idx;
> else
> return -ENOENT;
> @@ -478,9 +465,9 @@ static int die_get_call_fileno(Dwarf_Die *in_die)
> /* Get the declared file index number in CU DIE */
> static int die_get_decl_fileno(Dwarf_Die *pdie)
> {
> - Dwarf_Sword idx;
> + Dwarf_Word idx;
>
> - if (die_get_attr_sdata(pdie, DW_AT_decl_file, &idx) == 0)
> + if (die_get_attr_udata(pdie, DW_AT_decl_file, &idx) == 0)
> return (int)idx;
> else
> return -ENOENT;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/perf: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data
2022-11-07 21:09 ` Namhyung Kim
@ 2022-11-08 21:08 ` Arnaldo Carvalho de Melo
2022-11-08 23:35 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-11-08 21:08 UTC (permalink / raw)
To: Namhyung Kim
Cc: Masami Hiramatsu (Google),
Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, linux-perf-users, linux-kernel, Steven Rostedt
Em Mon, Nov 07, 2022 at 01:09:00PM -0800, Namhyung Kim escreveu:
> Hi Masami,
>
> On Fri, Nov 4, 2022 at 8:01 PM Masami Hiramatsu (Google)
> <mhiramat@kernel.org> wrote:
> >
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
> > Dwarf version 5 standard Sec 2.14 says that
> >
> > Any debugging information entry representing the declaration of an object,
> > module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and
> > DW_AT_decl_column attributes, each of whose value is an unsigned integer
> > constant.
> >
> > So it should be an unsigned integer data. Also, even though the standard
> > doesn't clearly say the DW_AT_call_file is signed or unsigned, the
> > elfutils (eu-readelf) interprets it as unsigned integer data and it is
> > natural to handle it as unsigned integer data as same as DW_AT_decl_file.
> > This changes the DW_AT_call_file as unsigned integer data too.
> >
> > Fixes: 3f4460a28fb2 ("perf probe: Filter out redundant inline-instances")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks, applied.
- Arnaldo
> Thanks,
> Namhyung
>
>
> > ---
> > tools/perf/util/dwarf-aux.c | 21 ++++-----------------
> > 1 file changed, 4 insertions(+), 17 deletions(-)
> >
> > diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> > index 30b36b525681..b07414409771 100644
> > --- a/tools/perf/util/dwarf-aux.c
> > +++ b/tools/perf/util/dwarf-aux.c
> > @@ -315,19 +315,6 @@ static int die_get_attr_udata(Dwarf_Die *tp_die, unsigned int attr_name,
> > return 0;
> > }
> >
> > -/* Get attribute and translate it as a sdata */
> > -static int die_get_attr_sdata(Dwarf_Die *tp_die, unsigned int attr_name,
> > - Dwarf_Sword *result)
> > -{
> > - Dwarf_Attribute attr;
> > -
> > - if (dwarf_attr_integrate(tp_die, attr_name, &attr) == NULL ||
> > - dwarf_formsdata(&attr, result) != 0)
> > - return -ENOENT;
> > -
> > - return 0;
> > -}
> > -
> > /**
> > * die_is_signed_type - Check whether a type DIE is signed or not
> > * @tp_die: a DIE of a type
> > @@ -467,9 +454,9 @@ int die_get_data_member_location(Dwarf_Die *mb_die, Dwarf_Word *offs)
> > /* Get the call file index number in CU DIE */
> > static int die_get_call_fileno(Dwarf_Die *in_die)
> > {
> > - Dwarf_Sword idx;
> > + Dwarf_Word idx;
> >
> > - if (die_get_attr_sdata(in_die, DW_AT_call_file, &idx) == 0)
> > + if (die_get_attr_udata(in_die, DW_AT_call_file, &idx) == 0)
> > return (int)idx;
> > else
> > return -ENOENT;
> > @@ -478,9 +465,9 @@ static int die_get_call_fileno(Dwarf_Die *in_die)
> > /* Get the declared file index number in CU DIE */
> > static int die_get_decl_fileno(Dwarf_Die *pdie)
> > {
> > - Dwarf_Sword idx;
> > + Dwarf_Word idx;
> >
> > - if (die_get_attr_sdata(pdie, DW_AT_decl_file, &idx) == 0)
> > + if (die_get_attr_udata(pdie, DW_AT_decl_file, &idx) == 0)
> > return (int)idx;
> > else
> > return -ENOENT;
> >
--
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/perf: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data
2022-11-08 21:08 ` Arnaldo Carvalho de Melo
@ 2022-11-08 23:35 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2022-11-08 23:35 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Namhyung Kim, Masami Hiramatsu (Google),
Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, linux-perf-users, linux-kernel, Steven Rostedt
On Tue, 8 Nov 2022 18:08:27 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Em Mon, Nov 07, 2022 at 01:09:00PM -0800, Namhyung Kim escreveu:
> > Hi Masami,
> >
> > On Fri, Nov 4, 2022 at 8:01 PM Masami Hiramatsu (Google)
> > <mhiramat@kernel.org> wrote:
> > >
> > > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > >
> > > Dwarf version 5 standard Sec 2.14 says that
> > >
> > > Any debugging information entry representing the declaration of an object,
> > > module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and
> > > DW_AT_decl_column attributes, each of whose value is an unsigned integer
> > > constant.
> > >
> > > So it should be an unsigned integer data. Also, even though the standard
> > > doesn't clearly say the DW_AT_call_file is signed or unsigned, the
> > > elfutils (eu-readelf) interprets it as unsigned integer data and it is
> > > natural to handle it as unsigned integer data as same as DW_AT_decl_file.
> > > This changes the DW_AT_call_file as unsigned integer data too.
> > >
> > > Fixes: 3f4460a28fb2 ("perf probe: Filter out redundant inline-instances")
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
> > Acked-by: Namhyung Kim <namhyung@kernel.org>
>
> Thanks, applied.
Thanks Namhyung and Arnaldo!
>
> - Arnaldo
>
>
> > Thanks,
> > Namhyung
> >
> >
> > > ---
> > > tools/perf/util/dwarf-aux.c | 21 ++++-----------------
> > > 1 file changed, 4 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> > > index 30b36b525681..b07414409771 100644
> > > --- a/tools/perf/util/dwarf-aux.c
> > > +++ b/tools/perf/util/dwarf-aux.c
> > > @@ -315,19 +315,6 @@ static int die_get_attr_udata(Dwarf_Die *tp_die, unsigned int attr_name,
> > > return 0;
> > > }
> > >
> > > -/* Get attribute and translate it as a sdata */
> > > -static int die_get_attr_sdata(Dwarf_Die *tp_die, unsigned int attr_name,
> > > - Dwarf_Sword *result)
> > > -{
> > > - Dwarf_Attribute attr;
> > > -
> > > - if (dwarf_attr_integrate(tp_die, attr_name, &attr) == NULL ||
> > > - dwarf_formsdata(&attr, result) != 0)
> > > - return -ENOENT;
> > > -
> > > - return 0;
> > > -}
> > > -
> > > /**
> > > * die_is_signed_type - Check whether a type DIE is signed or not
> > > * @tp_die: a DIE of a type
> > > @@ -467,9 +454,9 @@ int die_get_data_member_location(Dwarf_Die *mb_die, Dwarf_Word *offs)
> > > /* Get the call file index number in CU DIE */
> > > static int die_get_call_fileno(Dwarf_Die *in_die)
> > > {
> > > - Dwarf_Sword idx;
> > > + Dwarf_Word idx;
> > >
> > > - if (die_get_attr_sdata(in_die, DW_AT_call_file, &idx) == 0)
> > > + if (die_get_attr_udata(in_die, DW_AT_call_file, &idx) == 0)
> > > return (int)idx;
> > > else
> > > return -ENOENT;
> > > @@ -478,9 +465,9 @@ static int die_get_call_fileno(Dwarf_Die *in_die)
> > > /* Get the declared file index number in CU DIE */
> > > static int die_get_decl_fileno(Dwarf_Die *pdie)
> > > {
> > > - Dwarf_Sword idx;
> > > + Dwarf_Word idx;
> > >
> > > - if (die_get_attr_sdata(pdie, DW_AT_decl_file, &idx) == 0)
> > > + if (die_get_attr_udata(pdie, DW_AT_decl_file, &idx) == 0)
> > > return (int)idx;
> > > else
> > > return -ENOENT;
> > >
>
> --
>
> - Arnaldo
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-08 23:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-05 3:01 [PATCH] tools/perf: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data Masami Hiramatsu (Google)
2022-11-07 21:09 ` Namhyung Kim
2022-11-08 21:08 ` Arnaldo Carvalho de Melo
2022-11-08 23:35 ` Masami Hiramatsu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.