OVP Forums - A community of assistance, help, questions, and answers.
|
View previous topic :: View next topic |
Author |
Message |
MinSu
Joined: 10 Apr 2017 Posts: 3
|
Posted: Thu Nov 02, 2017 6:20 pm Post subject: How to trace instructions of user application on ARM_A9? |
|
|
Hi, I learn OVP these days.
I want to trace all instruction of my application(c source).
I checked the example (Example/SimulationControl/customProcessorTrace).
In harness.c, using some APIs can trace all instruction.
Code: |
opProcessorIcount()
opProcessorPC()
opProcessorDisassemble()
|
It works on or1k processor.
but When I change the processor to ARM_CORTEX_A9, it doesn't work.
Code: |
1580 : 0x0 : 00000000 andeq r0,r0,r0
1581 : 0x0 : 00000000 andeq r0,r0,r0
1582 : 0x0 : 00000000 andeq r0,r0,r0
1583 : 0x0 : 00000000 andeq r0,r0,r0
1584 : 0x0 : 00000000 andeq r0,r0,r0
1585 : 0x0 : 00000000 andeq r0,r0,r0
1586 : 0x0 : 00000000 andeq r0,r0,r0
1587 : 0x0 : 00000000 andeq r0,r0,r0
1588 : 0x0 : 00000000 andeq r0,r0,r0
1589 : 0x0 : 00000000 andeq r0,r0,r0
1590 : 0x0 : 00000000 andeq r0,r0,r0
|
If I modify harness/harness.exe ~~~~~ --trace in "example.sh",
It works properly.
Code: |
Info 'u1/cpu1_CPU0', 0x000000000000ad50(_fclose_r+88): 0a000005 beq ad6c
1580 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000ad6c(_fclose_r+a4): e5941044 ldr r1,[r4,#68]
1581 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000ad70(_fclose_r+a8): e3510000 cmp r1,#0
1582 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000ad74(_fclose_r+ac): 0a000003 beq ad88
1583 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000ad88(_fclose_r+c0): ebfffd8d bl a3c4
1584 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000a3c4(__sfp_lock_acquire): e12fff1e bx lr
1585 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000ad8c(_fclose_r+c4): e3a03000 mov r3,#0
1586 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000ad90(_fclose_r+c8): e1c430bc strh r3,[r4,#12]
1587 : 0x0 : 00000000 andeq r0,r0,r0
Info 'u1/cpu1_CPU0', 0x000000000000ad94(_fclose_r+cc): ebfffd8b bl a3c8
|
Could you help me to trace all instruction on ARM_CORTEX_A9??
Thank you |
|
Back to top |
|
 |
DuncGrah OVP Technologist

Joined: 27 Feb 2008 Posts: 1646 Location: United Kingdom
|
Posted: Fri Nov 03, 2017 2:22 am Post subject: |
|
|
Adding --trace to the simulator command line does create the tracing of all ARM instructions.
If, using any executable that supports the command line parser, you add --help and look under the tracing section you will see, several options
Here is what I got in an MSYS shell on Windows
Quote: | $ iss.exe --help | grep "\-trace"
--trace -t [processor] Trace instructions as they are executed
--traceafter string Start tracing instructions after this many have executed
--tracebuffer [processor] Enable the trace buffer
--tracechange [processor] Trace changed registers
--tracecount string Trace this number of instructions
--tracepse [pse] Trace instructions executed by this peripheral model
--traceregs [processor] Dump registers after each instruction is executed
--traceregsafter [processor] Dump registers after each instruction is executed
--traceregsbefore [processor] Dump registers before each instruction is executed
--traceshareddata [processor] Trace the use of vmirtWriteListeners
--traceshowicount [processor] Show instruction count with each instruction
|
So is there something else you are wanting to do that requires the use of the OP API? |
|
Back to top |
|
 |
MinSu
Joined: 10 Apr 2017 Posts: 3
|
Posted: Sat Nov 04, 2017 4:25 am Post subject: |
|
|
Thank you for your reply.
Adding --trace to the simulator command line does trace all instructions. but there is a problem to achieve my goal.
I would like to analyze the type and number of instructions used in each function. For example,
Code: |
void main()
{
Func1();
Func2();
Func3();
Func4();
}
|
I want to get the information like this.
Code: |
Func1()
MOV 412
ADD 325
SUB 234
....
Func2()
MOV 712
ADD 310
SUB 126
...
|
Simply, I added --trace option and copy the result into the text file.
Code: |
harness.exe ~~~ --trace >> result.txt
|
But my C program consists of more than 800 billion instructions. the size of report file is very big(few thousand GB) and difficult to extract the information I want.
If I use opProcessorDisassemble() in harness/harness.c, I can design the program to extract only the necessary information. That's why I hope to use some APIs to design harness. :D [/code][/quote] |
|
Back to top |
|
 |
DuncGrah OVP Technologist

Joined: 27 Feb 2008 Posts: 1646 Location: United Kingdom
|
Posted: Mon Nov 06, 2017 12:18 am Post subject: |
|
|
What you are trying to do is one of many features provided by the Interception technology of the Imperas professional Tools.
I see that you are a university user, the Imperas professional tools are available free of charge for educational usage under the Imperas University program. In the first instance please contact univ@imperas.com.
When you get access there is an example that shows how to accumulate the instructions that are executed in a program, a simple modification would allow you to accumulate instructions for each function. When you get access have a look at the example in Demo/Tools/imperas_intecept_instruction_profiling_Linux_MipsMalta which combined with identification of entry and exit from functions will give you exactly what you want. |
|
Back to top |
|
 |
YoudD
Joined: 15 Mar 2021 Posts: 22
|
Posted: Sat Nov 20, 2021 7:32 pm Post subject: |
|
|
MinSu wrote: | Thank you for your reply.
Adding --trace to the simulator command line does trace all instructions. but there is a problem to achieve my goal.
I would like to analyze the type and number of instructions used in each function. For example,
Code: |
void main()
{
Func1();
Func2();
Func3();
Func4();
}
|
I want to get the information like this.
Code: |
Func1()
MOV 412
ADD 325
SUB 234
....
Func2()
MOV 712
ADD 310
SUB 126
...
|
Simply, I added --trace option and copy the result into the text file.
Code: |
harness.exe ~~~ --trace >> result.txt
|
But my C program consists of more than 800 billion instructions. the size of report file is very big(few thousand GB) and difficult to extract the information I want.
If I use opProcessorDisassemble() in harness/harness.c, I can design the program to extract only the necessary information. That's why I hope to use some APIs to design harness. :D [/code] | [/quote]
Have you achieved the data you want? If you have already implemented it, would you please share some experience with me, because I am very interested in obtaining these dataļ¼
Code: |
Func1()
MOV 412
ADD 325
SUB 234
....
Func2()
MOV 712
ADD 310
SUB 126
...
|
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Information regarding OVP © 2008-2022 Imperas Software
|