mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: elisabeth <paniii94@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: elisabeth <paniii94@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH] Subject: perf jit: Fix incorrect file name in DWARF line table
Date: Wed, 31 May 2023 16:35:33 +0200	[thread overview]
Message-ID: <20230531143533.196835-1-paniii94@gmail.com> (raw)

Fix an issue where an incorrect file name was added in the DWARF line table
due to not checking the filename against the repeated name marker (/xff/0).
This can be seen with `objdump --dwarf=line` on the ELF file after perf inject.

Signed-off-by: elisabeth <paniii94@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/genelf_debug.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/genelf_debug.c b/tools/perf/util/genelf_debug.c
index aa5dcc56b2ac..2928b59bb9a5 100644
--- a/tools/perf/util/genelf_debug.c
+++ b/tools/perf/util/genelf_debug.c
@@ -349,6 +349,7 @@ static void emit_lineno_info(struct buffer_ext *be,
 	 */
 
 	/* start state of the state machine we take care of */
+	char const repeated_name_marker[] = {'\xff', '\0'};
 	unsigned long last_vma = 0;
 	char const  *cur_filename = NULL;
 	unsigned long cur_file_idx = 0;
@@ -363,7 +364,8 @@ static void emit_lineno_info(struct buffer_ext *be,
 		/*
 		 * check if filename changed, if so add it
 		 */
-		if (!cur_filename || strcmp(cur_filename, ent->name)) {
+		if ((!cur_filename || strcmp(cur_filename, ent->name)) &&
+			memcmp(repeated_name_marker, ent->name, sizeof(repeated_name_marker)) != 0) {
 			emit_lne_define_filename(be, ent->name);
 			cur_filename = ent->name;
 			emit_set_file(be, ++cur_file_idx);
-- 
2.34.1


             reply	other threads:[~2023-05-31 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 14:35 elisabeth [this message]
     [not found] ` <CAM9d7cgsP9cBq_Ui9-53zO0nLzBUK67goO1UcnqZ93Z4E7QcFQ@mail.gmail.com>
     [not found]   ` <CAOh+m7w8uE-2HKi=+gXL6sFbsPRGBfKA4eNT+kJTVhHhJmMSLw@mail.gmail.com>
     [not found]     ` <CAM9d7cho4-JOWTex0GkScQA2kmg3ZU5bqbRbUb_mG3vsoQ9vng@mail.gmail.com>
2023-06-01 17:07       ` Elisabeth Panholzer
2023-06-01 17:19 ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531143533.196835-1-paniii94@gmail.com \
    --to=paniii94@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®