On 11/07/2023 11:40, Suzuki K Poulose wrote:
On 11/07/2023 10:26, Pandey, Radhey Shyam wrote:
Hi all,
I am trying off Target Trace Decoding using arm-cs-trace-disasm.py but it doesn’t show
proper disassembly. There is unexpected warning "could not read first record".
Any pointers on what the issue could be?
Meanwhile I am trying to do trace decoding on aarch64 target and see if that helps.
I have taken simple example mentioned in [1].
[1]: http://events17.linuxfoundation.org/sites/events/files/slides/ELC-E16.pdf http://events17.linuxfoundation.org/sites/events/files/slides/ELC-E16.pdf
#include int coresight_test1(int val);
int main(void) {
int val; val = coresight_test1(10);
printf("val: %d\n", val);
return 0;
}
perf record -e cs_etm/@tmc_etf0/u --filter 'filter0x5a8/0x5e4@/home/root/libcstest.so.1.0' --per-thread ./main
tar czf cs_example.tgz perf.data ~/.debug
Off Target Trace Decoding: “perf report”
tar xf cs_example.tgz
$ rm -rf ~/.debug // remove previous trace data
$ cp -dpR .debug ~/ // copy the current trace data
$ perf report --stdio
linux-xlnx/tools/perf/perf --exec-path= <snip>/linux-xlnx/tools/perf script tools/perf/scripts/python/arm-cs-trace-disasm.py -- -d ${XTOOL_PATH}/aarch64-linux-gnu-objdump -v
I believe the perf script doesn't work with coresight trace decoding as we need a two pass approach for decoding the stream for figuring out the parameters for the queues. James Clark can give you the exact reason.
Suzuki
No that script is still working, I just tried it on and off target and it's all fine.
I didn't use --exec-path=, I'm not sure why that's in that linked pdf, but it didn't cause the same issue that you see if I added it.
The "could not read first record" errors actually come from the addr2line part of Perf rather than this script. Do you have perf report/annotate working without the script?
Or does something like this work:
$ echo "12345" | addr2line -e \ ~/.debug/.build-id/b7/b30ba2c0f618615a8d32d86813718bb2fdb567/debug
fpioconst.c:?
I also just set the path to objdump directly rather than with a variable, but I assume XTOOL_PATH is set? Although I think it must be because you get a different error if objdump is missing.
-d /usr/bin/aarch64-linux-gnu-objdump
James
ARM CoreSight Trace Data Assembler Dump
addr2line /home/root/libcstest.so.1.0: could not read first record
main 748/748 [0000] 0.000000000 ffffad8c05d8 /home/root/libcstest.so.1.0
addr2line /home/root/libcstest.so.1.0: could not send request
main 748/748 [0000] 0.000000000 ffffad8c05d8
addr2line /home/root/libcstest.so.1.0: could not send request
main 748/748 [0000] 0.000000000 ffffad8c05d8
addr2line /home/root/libcstest.so.1.0: could not send request
main 748/748 [0000] 0.000000000 ffffad8c05d8
addr2line /home/root/libcstest.so.1.0: could not send request
main 748/748 [0000] 0.000000000 ffffad8c05d8
addr2line /home/root/libcstest.so.1.0: could not send request
main 748/748 [0000] 0.000000000 ffffad8c05e4
End
tools/perf/perf report -D
<snip>
0x680 [0x30]: PERF_RECORD_AUXTRACE size: 0x90 offset: 0 ref: 0x2890bdbd7cad6b6f idx: 0 tid: 748 cpu: -1
. ... CoreSight ETMV4I Trace data: size 0x20 bytes
Idx:0; ID:10; I_ASYNC : Alignment Synchronisation.
Idx:12; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }
. ... CoreSight ETMV4I Trace data: size 0x20 bytes
Idx:32; ID:10; I_ASYNC : Alignment Synchronisation.
Idx:44; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }
. ... CoreSight ETMV4I Trace data: size 0x50 bytes
Idx:64; ID:10; I_ASYNC : Alignment Synchronisation.
Idx:76; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }
Idx:81; ID:10; I_TRACE_ON : Trace On.
Idx:82; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000FFFFAD8C05A8; Ctxt: AArch64,EL0, NS;
Idx:92; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEN
Idx:93; ID:10; I_ATOM_F1 : Atom format 1.; E
Idx:94; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000AAAAAC9107E8;
Idx:104; ID:10; I_TRACE_ON : Trace On.
Idx:105; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000FFFFAD8C05E8; Ctxt: AArch64,EL0, NS;
Idx:116; ID:10; I_ATOM_F1 : Atom format 1.; E
Idx:117; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000FFFFAD8EB4E4;
0x740@perf.data mailto:0x740@perf.data [0x8]: event: 68
.
. ... raw event: size 8 bytes
. 0000: 44 00 00 00 00 00 08 00 D.......
0x740 [0x8]: PERF_RECORD_FINISHED_ROUND
Aggregated stats: (excludes AUX area (e.g. instruction trace) decoded / synthesized events)
Thanks,
Radhey
CoreSight mailing list -- coresight@lists.linaro.org To unsubscribe send an email to coresight-leave@lists.linaro.org