본문 바로가기

JOB Tips/Trace32

Trace32에서 소스가 안보일 경우 - y.path strippart

출처 : http://www.altera.com/support/kdb/solutions/rd03052008_123.html


Trace32에서
다중 APP 심볼 로드 : /noclear
경로 재설정 : /strippart 3
경로 추가  : y.spath.srd +

d.load.elf ../../test.elf /nocode /noclear /gcc3 /cpp /strippart 6.
y.spath.srd

 cd *   : 이때 선택한 폴더가 d:\source\model
 pwd
 entry &SourcePath
 print "&SourcePath"

   sYmbol.spath +  "&SourcePathdv/3ginfra/modules/as3gtracer/srce"
   sYmbol.spath +  "&SourcePathdv/3ginfra/modules/debugsupport/srce"

(&SourcePath 뒤에 "/" 를 뺐습니다)



안녕하세요. MDS테크놀로지 기술지원팀입니다.

연구원님이 말씀하신 것처럼 TRACE32에서는 만들어진 symbol 경로를 이용하여
code를 display시킵니다. 상대 경로를 이용하지 않는 이유중에 하나가 실제 elf 파일을
일정한 위치에 두고 사용하는 것이 아니기 때문에(다른 사람의 PC에서 copy한다든지)
만들어지 경로를 그대로 사용합니다.
연구원님과 같은 경우를 지원하기 위해 제공하는 옵션이 있습니다.

예를 들어, 컴파일 시 code의 경로가 다음과 같은 경우
C:\project\s3c6400\src\main.c
C:\project\device\lcd\src\lcd.c
C:\project\lib\cam\src\camera.c
당연히 symbol 정보도 해당 경로로 만들어 집니다.

그러나 만약 연구원님이 code를 D:\test 아래에 code를 두고 있다면

data.load.elf test.elf /strippart 1. /path D:\test\
와 같이 사용할 경우
strippart 옵션에 의해 주어진 숫자만큼 앞에서 부터 폴더를 제거합니다.
s3c6400\src\main.c
이후 path 옵션을 통해서 제거된 경로에서 앞부분에 D:\test가 추가됩니다.
그래서 최종적으로
D:\test\s3c6400\src\main.c
로 모든 경로가 만들어 집니다.


1.
일반적으로,
Linux machine 등에서 컴파일 하고,
Windows host에서 network drive를 통해 access하는 경우에,
Linux : A\B\C\D\E\XXX.C
Windows : Z:\F\D\E\XXX.C
와 같이 나타나는 경우가 있습니다.
결과적으로 잘 맞지 않는 부분(A\B\C)를 잘라내고,
잘라낸 부분에 새로운 부분(Z:\F)을 끼워 넣으면 되는데,
그럴때는 아래와 같이 하시면 됩니다.

data.load.elf <file name> /strippart 3. /path "Z:\F"
/strippart 뒤에는 잘라내고 싶은 경로의 갯수를 집어 넣고,
/path 뒤에는 잘라낸 부분에 끼워넣고 싶은 경로를 집어넣어주면 됩니다.

... 으로 표시하신 부분 때문에 정확한 경로를 알 수 없어 약간의 시행착오가 예상되지만,
연구원님의 경우에는
K:\TEMP\tmp2\Console2\WORKPROJECT\1\2\3\ROOT\Target\..\System\ECOM.c 를
"d:\work\dev\System\ECOM.c" 로 맞추셔야 하므로,

d.load.elf <file name> /NOCODE /strippart 10. /path "D:"
와 같은 형태로 맞추시면 됩니다.


2.
단순히 위의 경로에서,
...\ROOT 까지만 잘라내고 싶다면,
data.load.elf <file name> /nocode /strippart 9.
처럼 하시면 되고요,


Problem

Why does Lauterbach Trace32 not find the source code for my elf image?

Solution

The cygwin C compiler/linker tools build an elf file with '/cygdrive/c'.  You will need to strip out the /cygdrive/c from the elf file, using parameters for the Lauterbach Trace32 data.load.elf command.

Load your elf into Lauterbach Trace32, specifying the following parameters:

data.load.elf <elf_image> /PLUSVM /StripPART 3 /PATH C:\

<elf_image> should contain the drive, path, and file name for your elf image.  For example, <elf_image> could be:

C:\NEEK\mictor_test\software\hello_world_mictor\Release\hello_world_small.elf

/StripPART does the stripping, and /PATH does the replacement of the stripped portion of the path, providing a root directory for searching for source code.

The StripPART value of "3" specifies that the drive letter (first part) and first two subdirectories (parts two and three, "cygdrive" and "c", respectively) be removed from all source file paths indicated in the .elf file.

The speed with which Lauterbach is able to find files is proportional to the number of files and directories located under the directory specified via /PATH.  In the data.load.elf example above, the entire C:\ drive is specified as the source code repository. 

If you strip additional parts (directories) off of the elf specified source code locations, and add the corresponding directory to the /PATH switch, the size of the source file tree is reduced.  However, any source code not located under the /PATH directory will not be found.

For example, modify the above data.load.elf command to increase /StripPART parameter to 4, and changing the /PATH parameter to include the NEEK directory:

data.load.elf <elf_image> /PLUSVM /StripPART 4 /PATH C:\NEEK\

would not locate any source code not under the C:\NEEK directory, such as Altera® HAL device drivers.