Re: [PATCH 1/4] perf annotate-data: Improve debug message with location info
From: Arnaldo Carvalho de Melo
Date: Tue Apr 16 2024 - 10:27:08 EST
On Fri, Apr 12, 2024 at 11:33:07AM -0700, Namhyung Kim wrote:
> To verify it found the correct variable, let's add the location
> expression to the debug message.
Added the patch below, following your existing convention of casting
Dwarf_Offset/Darf_Word to long.
- Arnaldo
diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c
index c6eb5b2cc4d50d79..e53d66c46c540b75 100644
--- a/tools/perf/util/annotate-data.c
+++ b/tools/perf/util/annotate-data.c
@@ -110,24 +110,24 @@ static void pr_debug_location(Dwarf_Die *die, u64 pc, int reg)
break;
case DW_OP_breg0 ...DW_OP_breg31:
pr_info("base=reg%d, offset=%#lx\n",
- ops->atom - DW_OP_breg0, ops->number);
+ ops->atom - DW_OP_breg0, (long)ops->number);
break;
case DW_OP_regx:
- pr_info("reg%ld\n", ops->number);
+ pr_info("reg%ld\n", (long)ops->number);
break;
case DW_OP_bregx:
pr_info("base=reg%ld, offset=%#lx\n",
- ops->number, ops->number2);
+ (long)ops->number, (long)ops->number2);
break;
case DW_OP_fbreg:
- pr_info("use frame base, offset=%#lx\n", ops->number);
+ pr_info("use frame base, offset=%#lx\n", (long)ops->number);
break;
case DW_OP_addr:
- pr_info("address=%#lx\n", ops->number);
+ pr_info("address=%#lx\n", (long)ops->number);
break;
default:
pr_info("unknown: code=%#x, number=%#lx\n",
- ops->atom, ops->number);
+ ops->atom, (long)ops->number);
break;
}
break;