trace32 - Memory dump of multiple address ranges to a single binary file
Asked Answered
B

2

5

I'm using the Lauterbach debugger to dump from different memory sections to binary files. So far I've managed to generate a binary file for each address range using

data.save.binary output1.txt var.Range(sDummyArray[startRange1..endRange1])

data.save.binary output2.txt var.Range(sDummyArray[startRange2..endRange2]) 

...

Is there a way for me to "stitch" multiple binary(memory dump) files together to give one binary file OR append each memory dump to a file using a trace32 command that I have missed?

Brach answered 7/1, 2017 at 4:23 Comment(0)
E
9

To save multiple address ranges from target memory to the same binary file use the command Data.SAVE.Binary with its option "/Append". The option appends the new data at the end of the given file.

E.g.:

Data.SAVE.Binary output1.txt Var.RANGE(sDummyArray[startRange1..endRange1])
Data.SAVE.Binary output1.txt Var.RANGE(sDummyArray[startRange2..endRange2]) /Append

For TRACE32 older build 63378 you can use the debugger's virtual memory (if not used for other things) like this:

PRIVATE &size1 &size2   
&size1=Var.VALUE((sDummyArray+endRange1)-(sDummyArray+startRange1))
&size2=Var.VALUE((sDummyArray+endRange2)-(sDummyArray+startRange2))
Data.COPY Var.RANGE(sDummyArray[startRange1..endRange1]) VM:0
Data.COPY Var.RANGE(sDummyArray[startRange2..endRange2]) VM:&size1
Data.SAVE.Binary output1.txt VM:0++(&size1+&size2-1)

So the idea is here to collect all the data via Data.COPY in the virtual memory and save it from there to a binary file.

Emunctory answered 8/1, 2017 at 23:3 Comment(2)
What version of trace32? I don't see this option in my "Release Feb 2015 (64-bit) version.Brach
For the /Append option you need TRACE32 build 63378. This is release Sep 2015 (or newer).Emunctory
B
0

Data.SAVE.Binary doesn't have a /Append option in TRACE32 versions released before Sep 2015.

I was able to append my output files using

OS.Command copy /b output1.txt + output2.txt output.txt
Brach answered 10/1, 2017 at 3:37 Comment(1)
Better use OS.Area instead of OS.Command, since OS.Command is no-blocking, while OS.Area will stall the execution of a PRACTICE script until the shell-command has finished.Emunctory

© 2022 - 2024 — McMap. All rights reserved.