[PATCH] tools/perf/tests: Fix objdump in Object code reading test to look for all sections

Athira Rajeev atrajeev at linux.vnet.ibm.com
Tue Jul 4 15:03:53 AEST 2023

Object code reading test fails intermittently with below logs:

   Reading object code for memory address: 0xc008000001dd34fc
   File is: /lib/modules/6.3.0-rc7+/kernel/fs/xfs/xfs.ko
   On file address is: 0x11359c
   Objdump command is: objdump -z -d --start-address=0x1134fc --stop-address=0x11357c /lib/modules/6.3.0-rc7+/kernel/fs/xfs/xfs.ko
   objdump read too few bytes: 128
   test child finished with -1
   ---- end ----
   Object code reading: FAILED!

This issue happens ramdomly depending on the sample ip
captured during the test run. In some cases, the same ip falls
in the xfs module. The test does an objdump on the xfs.ko file and
compares it with the dump from the dso that perf captures. But
since the range of ip address falls in debug info section, it fails
to find the address range with objdump. Fix the objdump option so
as to disasseble all sections to check the address range.

Signed-off-by: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
 tools/perf/tests/code-reading.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index ed3815163d1b..02132478856a 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -184,7 +184,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
 	FILE *f;
 	int ret;
-	fmt = "%s -z -d --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
+	fmt = "%s -z -D --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
 	ret = snprintf(cmd, sizeof(cmd), fmt, "objdump", addr, addr + len,
 	if (ret <= 0 || (size_t)ret >= sizeof(cmd))

More information about the Linuxppc-dev mailing list