38
Copyright 2005 Wind River Systems, Inc. VxWorks 소개 및 디버깅 환경 윈드리버 한국지사 백운철 차장 [email protected]

VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

Embed Size (px)

Citation preview

Page 1: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

Copyright 2005 Wind River Systems, Inc.

VxWorks 소개 및 디버깅 환경

윈드리버 한국지사백운철 차장

[email protected]

Page 2: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

2 Copyright 2005 Wind River Systems, Inc.

Wind River & VxWorks ?

350 million devices worldwide use Wind River technology

•Telematics– Vehicle tracking and airbag

deployment notification– Remote/mobile payment– Traffic and point-of-

interest information– Location-based services

•Infotainment– Audio, gaming, video– Navigation

•Powertrain / X-by-wire:steer, brake, drive

•Test & Measurement equipment

•Medical devices•Robotics•Power-generation equipment•Semiconductor equipment

•Smartphones

• Feature phones

•Portable media players

•Digital cameras•Set-top boxes

•IPTVs

•PVR/DVRs

•Digital televisions

•Home access/gateways•IP video security/monitors

•VoIP telephony

•Digital copiers

•Laser printers•Multifunction printers

• Media gateways

• Wireless access points

• WiMAX base stations

• Radio network controllers

• Broadband access systems

• Customer premises equipment

• VoIP phones

• Switches

• Avionics– Integrated Modular

Avionics (IMA) cores– Displays– Flight controls– Flight management

• Command and control• Communications

– Software Defined Radio• Intelligence, surveillance,

and reconnaissance• Radar, sonar• Space

– Instruments– Navigation– Propulsion

• Weapons systems

Network Equipment

30%

Industrial &Automotive

20%

Aerospace & Defense

25%

Consumer

25%

Page 3: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

Copyright 2005 Wind River Systems, Inc.

VxWorks 소개

Page 4: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

4 Copyright 2005 Wind River Systems, Inc.

VxWorks : Embedded Hard Real Time OS

• Scalable 마이크로 커널– 선택적으로 커널 컴포넌트를 포함– VxWorks 이미지의 크기 조정

• 멀티태스킹• 선점형 우선 순위 기반 스케쥴링 (=Linux의 SCHED_FIFO)• 선택적 라운드 로빈 스케쥴링 (=Linux의 SCHED_RR)

– 동일 우선 순위의 Task간에만 적용됨 (Linux와 다름)

• 전역 API 에러 상태(모듈+에러)• POSIX 인터페이스 호환

• Asymetric(AMP) 다중 프로세서 지원• SMP 기능 추가됨

Page 5: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

5 Copyright 2005 Wind River Systems, Inc.

VxWorks : Embedded Hard Real Time OS

• 빠른 문맥 전환

• 우선 순위 : 0(최상위)~255(최하위)• 자원 삭제 방지

• 우선 순위 계승• 함수 호출 방식의 API(트랩이나 점프 테이블이 아님)• 디폴트로 Supervisor Mode로 동작

– Function call 기반 (no trap, no jump table)– 옵션으로 User mode로 동작 : Protection (Linux Default)

• Nested 인터럽트 지원

• 짧은 인터럽트 응답 시간 및 latency

Page 6: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

6 Copyright 2005 Wind River Systems, Inc.

VxWorks vs. Linux Benchmark

VxWorks 6.5• 1.8G Hz Pentium4

• Interrupt Respone : 3.3 us

• Kernel Task 생성 : 7.4 us• User Task 생성 : 35 us

Vanilla-2.6.12• 2.8G Hz Pentium4

• Interrupt Respone : 5.8 us

• Fork : 97 us• Execve : 348 us

• http://www.opersys.com/lrtbf/

Page 7: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

7 Copyright 2005 Wind River Systems, Inc.

Task 관리

• Task ID : Task Control Block의 주소

• Task 이름과 ID간 변환 가능• Task 갯수 제한 : 없음

• 우선 순위 : 0(최상위)~255(최하위)• 우선 순위 변경 가능

• Task별 스택 필요(크기 조정 가능)• 우선 순위 기반과 라운드 로빈 스케쥴링간 전환

Page 8: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

8 Copyright 2005 Wind River Systems, Inc.

Task 관리

• RR 타임 슬라이스 조정

• 스택 사용량 및 Task 정보 확인• Task 삭제 방지 가능

• 문맥 전환시마다 사용자 루틴 수행 가능• Task 예외 처리

– 시스템 또는 사용자정의핸들러

• 공유 코드와 재진입– 동적 스택 변수, Task 변수– 세마포어에 의한 전역/Static 변수의 보호

Page 9: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

9 Copyright 2005 Wind River Systems, Inc.

Task 상태 및 천이

PendedReady / Running

Pended &Delayed

Suspended& Delayed

Delayed

context switch

Delay Done

Suspended

Suspended& Pended& Delayed

Suspended& Pended

Delay

Wait somethingwith Timeout

Get somethingor Timed Out

Wait something

Get something

Suspend

Stop

Breakpoint HitOrError Detectedby ED&R

Page 10: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

10 Copyright 2005 Wind River Systems, Inc.

Typical 메모리 모델(~ VxWorks5.x)

VxWorks Kernel Environment

Task1

Driver2

Driver1

SemB

MsgQA

App DCode

App CCode

App BCode

App ACode

Heap

man

ager

Task3

Task2

SemA

VxWorks OS Modules

VxWorks BSP

Shared Environment:– 단일 주소 공간

– Program code & data– Kernel objects– Heap

• Supervisor privilege tasks• Direct device access

– 표준 I/O외에

Custom Dev Driver 가능

• 이해가 용이• 직관적인 프로그래밍

Challenges…• 사용자가 자원을 반환하지 않은 경우는? • Integration시 Symbols 충돌

• App errors 처리가 별도로 없어서 system errors로 처리되어야 함

• 다른 Application이나 커널에 영향을 줄 수 있다 (문제와 증상의 괴리)

Page 11: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

11 Copyright 2005 Wind River Systems, Inc.

RTP(Real Time Process) 모델

• Linux의 Process와 유사

• 하나 이상의 Task들의 Container– RTP내에서 생성된 objects를 소유 (semaphores, sockets, etc.)

• Task가 User mode로 동작– Kernel 영역 Access를 위해서는 System Call 사용

• 실행 / 스케쥴링 단위가 아님

• Protection 단위– RTP내의 Task는 RTP 내부의 메모리만 Direct Access 가능– 다른 RTP나 Kernel 영역의 메모리 접근 안됨 : Protection

• non-overlapped memory model

Page 12: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

12 Copyright 2005 Wind River Systems, Inc.

RTP(Real Time Process) 모델

• GREY: Supervisor only• REST: SUP + USR

• RTP private mapping은 다른RTP나 커널 영역과 overlap 되지않음

• RTP System Call을 통해Supervisor 권한을 가짐

• 그러나 Kernel task가 RTP 내부영역을 Access하기 위한 Published API는 없음

• RTP-private memory mappings:– rtpMemShow() – similar output as

vmContextShow() 쉘 명령어

Page 13: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

13 Copyright 2005 Wind River Systems, Inc.

RTP vs. Linux Process

• 유사성– System call 모델– 별도의 Address Space– 메모리 Protection : 다른 Processe나 Kernel Direct Access 금지– Process 내부 메모리 공유

– Etc.

• 설계의 방향 및 대상– VxWorks Task (thread) 모델에 Process 모델을 추가– Linux Process 모델에 Tasks (pthreads)를 추가– RTP 설계의 주안점

• Real Time / Determinism 특성 유지• 호환성 / 이식성

– Linux의 주안점 : Open & Generic

– VxWorks lightweight : Thread switching speed & latency

Page 14: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

14 Copyright 2005 Wind River Systems, Inc.

RTP vs. Linux Process

• Global scheduling– VxWorks에서는 RTP 여부와 상관없이 시스템 전체 범위로 Task Scheduling이 발생 : 상위 우선

순위 Task의 실행 보장– 하위 우선 순위 Task들에 대한 우선 순위 배열에 신경써야 함

• Create & load– Caller는 기본적인 RTP object & memory context 만 생성. 나머지는 RTP 내부적으로 Setup 및

로딩– Caller can wait for the RTP to be up & running, or continue running concurrently.– Linux와 달리 RTP 수행전 전체 파일을 로딩– Linux와 달리 Demand paging이 없음 : Determinism 보장 (No Page Fault)

• MMU/MMU-less support– Linux와 달리 VxWorks는 non-overlapped memory model 사용– Non-overlapped : RTP 자신의 virtual memory 영역을 가짐– MMU and MMU-less에서 동일한 programming model 가능– Linux overlapped memory model 사용 : requires an MMU– Non-overlapped fork/exec() 구현이 어려움. µClinux는 fork/exec 지원 안함

• Compatibility with VxWorks kernel APIs– Large subset of VxWorks kernel API (hardware 직접 Access나 BSP 또는 Processor feature를

직접 Access하는 API를 제외한 모든 것)– POSIX API 사용 가능

Page 15: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

15 Copyright 2005 Wind River Systems, Inc.

ED&R(Error Detection & Report)

• 타겟내의 에러나 Event 발생시 로그를 남김

• ED&R log는지정된 위치의 Circular buffer에 저장됨

• ED&R log는 Soft reboot시에는 지워지지 않음 (persistent memory)

– Exception으로 Rebooting되는 경우 Booting 완료후 확인 가능

– 디버거 연결이 없이도 문제의 원인 분석에 용이Stack Pages Program Pages Address Space

0x0

Readonly

Rawdata

Start

Stop

Stack

Heap Blocks

Page 16: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

16 Copyright 2005 Wind River Systems, Inc.

ED&R 예제 : Non-Executable Stack Pages (실행 불가능한 Stack내 Address 실행시)

void badFunc(FUNCPTR *tp)

{

WIND_TCB *pTcb;

pTcb = taskIdCurrent;

printf("Addr=0x%x, Stack=0x%x ~ 0x%x\n", &tp, pTcb->pStackBase, pTcb->pStackEnd);

/* &tp가 스택내 주소 영역임을 확인 */

(*(FUNCPTR) &tp)(); /* 함수 포인터 tp를 수행해야 하는데 &tp를수행함 */

}

FUNCPTR 값 tp&tp

Page 17: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

17 Copyright 2005 Wind River Systems, Inc.

ED&R 로그 : Non-Executable Stack Pages (실행 불가능한 Stack내 Address 실행시)

-> Addr=0x863f98, Stack=0x864000 ~ 0x863000 Æ &tp가 스택내의 주소 영역임을 확인

program

Exception current instruction address: 0x00863f98

Machine Status Register: 0x0008b032

Condition Register: 0x20000080

Task: 0x6dba48 "t54"

0x6dba48 (t54): task 0x6dba48 has had a failure and has been stopped.

0x6dba48 (t54): fatal kernel task-level exception!

Æ 잘못된 함수 포인터 사용으로 인한 exception 발생

-> edrShow

ERROR LOG

=========

Log Size: 32768 bytes (8 pages)

Record Size: 4096 bytes

Max Records: 7

CPU Type: 0x5a

Errors Missed: 0 (old) + 0 (recent)

Error count: 1

Boot count: 1

Generation count: 19

Page 18: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

18 Copyright 2005 Wind River Systems, Inc.

ED&R 로그 : Non-Executable Stack Pages (실행 불가능한 Stack내 Address 실행시)

==[1/1]==============================================================

Severity/Facility: FATAL/KERNEL

Boot Cycle: 1

OS Version: 6.0.0

Time: THU JAN 01 06:40:34 1970 (ticks = 1442068)

Task: "t54" (0x006dba48) Æ t54 task에서 에러 발생

Injection Point: excArchLib.c:2532

fatal kernel task-level exception!

<<<<<Memory Map>>>>>

0x00100000 -> 0x00268f28: kernel

0x0087b000 -> 0x00000000: ed_stack_exe.out

Page 19: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

19 Copyright 2005 Wind River Systems, Inc.

ED&R 로그 : Non-Executable Stack Pages (실행 불가능한 Stack내 Address 실행시)

<<<<<Exception Information>>>>>

program

Exception current instruction address: 0x00863f98

Machine Status Register: 0x0008b032

Condition Register: 0x20000080

<<<<<Registers>>>>>

r0 = 0x0087b0cc sp = 0x00863f90 r2 = 0x00000000

r3 = 0x00000029 r4 = 0x00000000 r5 = 0x00000001

r6 = 0x006dba48 r7 = 0x0000000a r8 = 0x00000000

r9 = 0x00000000 r10 = 0x00000001 r11 = 0x00863f98

r12 = 0x00000029 r13 = 0x00000000 r14 = 0x00000000

r15 = 0x00000000 r16 = 0x00000000 r17 = 0x00000000

r18 = 0x00000000 r19 = 0x00000000 r20 = 0x00000000

r21 = 0x00000000 r22 = 0x00000000 r23 = 0x00000000

r24 = 0x00000000 r25 = 0x00000000 r26 = 0x00000000

r27 = 0x00000000 r28 = 0x00000000 r29 = 0x00000000

r30 = 0x0087b094 r31 = 0x006dba48 msr = 0x0008b032

lr = 0x0087b0d8 ctr = 0x00863f98 pc = 0x00863f98

cr = 0x20000080 xer = 0x20000000 pgTblPtr = 0x00649000

scSrTblPtr = 0x0069bccc srTblPtr = 0x0069bccc

Page 20: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

20 Copyright 2005 Wind River Systems, Inc.

ED&R 로그 : Non-Executable Stack Pages (실행 불가능한 Stack내 Address 실행시)

<<<<<Disassembly>>>>>

0x863f78 04000dee .long 04000dee

0x863f7c 00863f98 .long 00863f98

0x863f80 00863f18 .long 00863f18

0x863f84 eeeeeeee .long eeeeeeee

0x863f88 eeeeeeee .long eeeeeeee

0x863f8c eeeeeeee .long eeeeeeee

0x863f90 00863fa0 .long 00863fa0

0x863f94 0087b0cc .long 0087b0cc

*0x863f98 001b9048 .long 001b9048 Æ 에러 발생 위치

0x863f9c 00000000 .long 00000000

0x863fa0 00863fc0 .long 00863fc0

0x863fa4 00111f60 .long 00111f60

0x863fa8 00000000 .long 00000000

0x863fac 00000000 .long 00000000

0x863fb0 eeeeeeee .long eeeeeeee

0x863fb4 eeeeeeee .long eeeeeeee

Page 21: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

21 Copyright 2005 Wind River Systems, Inc.

ED&R 로그 : Non-Executable Stack Pages (실행 불가능한 Stack내 Address 실행시)

<<<<<Traceback>>>>>

0x00111f60 vxTaskEntry +0x54 : 0x00863f98 ()

Æ vxTaskEntry는 task spawn시 수행되는 wrapper 함수로 쉘에서 “sp stackExe, 0x001b9048”에서호출됨

value = 0 = 0x0

->

Cf. 함수의 Entry Point가 Symbol Table에 있는 경우는 함수 이름을 표시함

<<<<<Traceback>>>>>

0x00111f60 vxTaskEntry +0x54 : badFunc () Æ 에러를 발생시킨 함수를 확인할 수 있음.

value = 0 = 0x0

Page 22: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

22 Copyright 2005 Wind River Systems, Inc.

Task간 / Process간 통신 및 동기화

• Shared Memory• 세마포어• 상호 배제 세마포어(Mutual Exclution Sema : Mutex)

– 우선 순위 역전 방지가능– 세마포어를 소유한태스크 삭제 방지 가능

• 메시지 큐 / 파이프• 시그날

– ISR이나 태스크가 다른 태스크로송신– 비동기적 특성때문에에러나 예외 처리에 주로사용

• Event– Task-to-Task, ISR-to-Task Synch ( ≈ light-weight Binary Sema)– 메시지 도착 / 세마포어 유효 상태를 Task에 알림

• Message Channel (Single / Multi-Processor용)• 네트워크를 통한 태스크간 통신 (Socket, RPC)• VxMP (Asymmetric Multi-Processor용 CPU간 통신)

Page 23: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

23 Copyright 2005 Wind River Systems, Inc.

타이머 관리

• 태스크 지연– System Tick 단위 (Default 60 tick)– taskDelay()또는 객체 대기시

• Watchdog 타이머– Tick 단위– 지정된 시간이후 특정 루틴 수행

– ISR에서 수행되므로 가장 신뢰성 있는 지연

– 모니터 용도로 사용 가능

• 보조 클럭을 이용한 미세 시간 지연

Page 24: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

24 Copyright 2005 Wind River Systems, Inc.

인터럽트 관리

• Managed ISR 지원– OS가 문맥 저장 => ISR 수행 => OS가 문맥 복구– C 언어로 구현 가능

– 제한적 시스템 콜허용

• Unmanaged ISR 지원– 대부분 어셈블리로 구현되어야 함

• 시스템 레벨 인터럽트 활성화/비활성화

• ISR과 태스크간 통신– 공유 메모리, 링 버퍼, 메시지 큐, 파이프, 시그날

Page 25: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

Copyright 2005 Wind River Systems, Inc.

디버깅 환경

Page 26: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

26 Copyright 2005 Wind River Systems, Inc.

WindShell

• C 번역기(Interpreter) 내장• 전역 변수 작업 가능 (생성, 접근, 삭제)• 태스크 관리 및 정보보기• 커널 오브젝트정보 보기 (MsgQ, Sema etc.)• 커맨드 라인 편집 (vi 호환)

-> x = (8 * 6) / 4x = 0x20ff378: value = 12 = 0xc-> Nom = “Nelson”new symbol “Nom” added to symbol table.Nom = 0x23fe798: value = 37742496 = 0x23fe7a0 = Nom + 0x8-> printf (“Hello %s, number is %d.\n”, Nom, 0x20)Hello Nelson, number is 32.value = 28 = 0x1c-> &xvalue = 34599800 = 0x20ff378 = x

Page 27: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

27 Copyright 2005 Wind River Systems, Inc.

WindShell• 간단한 디버깅 (b, s, tt, c)

– b Display breakpoints and eventpoints– b addr[,task[,count]] Set breakpoint– c [task[,addr[,addr1]]] Continue from breakpoint– cret [task] Continue to subroutine return– s [task[,addr[,addr1]]] Single step– so [task] Single step/step over subroutine– l [adr[,nInst]] List disassembled memory– tt [task] Do stack trace on task

-> b printfvalue = 0 = 0x0-> b# Breakpoint Address Ctx Ctx Id Cnt Stops N Hard

--- ----------------------------- ----- ---------- --- ------- - ------------47 0x13EC78: printf any n/a 0 task y -

value = 0 = 0x0-> sp maintask spawned: id = 0x4eb3b0, name = s18u0value = 5157808 = 0x4eb3b0-> Break at 0x13EC78: printf Task: 0x4EB3B0 (s18u0)cHello World!->

Page 28: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

28 Copyright 2005 Wind River Systems, Inc.

WindShell

• 여러 개의 쉘 동시 사용 (Host Shell)• 몇가지 유용한 명령들

– Ctrl-d, TAB: 심볼/파일 이름 완성, 명령어 문법 표시

– Ctrl-w: 명령에 대한 HTML 도움말 표시– w: 태스크의 자세한 정보표시

• 파일 리다이렉션을 이용한 스크립팅– (-> < myScript)

• Tornado/Workbench (호스트)에 의한 심볼 테이블 관리(타겟 메모리에 심볼 테이블 불필요)

Page 29: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

29 Copyright 2005 Wind River Systems, Inc.

WR debugger : GUI 기반 Debugger

– Task / System(커널포함)모드 가능

– 하나의 디버거 세션에서• Multi Core/Processor• Multi Task / Process• Multi Target Connection 가능

Page 30: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

30 Copyright 2005 Wind River Systems, Inc.

System Viewer

• 런타임 소프트웨어 아날라이저– Deadlock / Race condition 체크– 타이밍 문제 체크

Page 31: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

31 Copyright 2005 Wind River Systems, Inc.

StethoScope : RealTime Data Monitor

Signals BarInstalled

Signals List

LegendUsed Signal

DumpShows

Value for every

timestamp

MonitorShows

RealtimeValue& Modify

Page 32: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

32 Copyright 2005 Wind River Systems, Inc.

TraceScope : Code Execution Tracer

Overview

Global View of Task/Fuction Interactions

Trace View

TimestampSequence IDSpend TimeReturn Value

Detail View

Columns of Tasks

Function Traces

Function Callstack

Global View of Task/Fuction Interactions

Page 33: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

33 Copyright 2005 Wind River Systems, Inc.

ProfileScope : Statistical Profiling

%CPU Total

%CPU Current Graphical

Usage Meter

Task & Function Call Tree

Profilescope Status

View Selection

Stoplight Toggle

Page 34: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

34 Copyright 2005 Wind River Systems, Inc.

Memory Scope : Mem Leak Detection

Memory Leak

Which Task?

Which Function (Full Call Stack)?

Alloc#Free#

IndivisualAlloc/Free

Page 35: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

35 Copyright 2005 Wind River Systems, Inc.

CoverageScope : Code Coverage Info

This code was Never Executed

Page 36: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

36 Copyright 2005 Wind River Systems, Inc.

Diagnostics : Sensor Point

• 타겟 보드 메모리 상의 임의의함수를 Dynamic patch– No Rebooting– No Func Recompile– Ex. Printf 삽입

• Access variables within the scope of the function

– 변수 메모리로 로깅– 변수 수정

• Monitor, configure, control

foo ( arg1)

{

int error;

if (arg1 < 500)

{

error = 0;

}

else error = 1;

return (error)

}

log($arg1);

$arg1 = 501;

log($error);

Page 37: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

37 Copyright 2005 Wind River Systems, Inc.

Diagnostics : Core Image Dump

• Core Image– 시스템 메모리 스냅샷– Kernel Fatal System Exception, Panic, Task-level

exception시 생성됨(사용자 요구로 생성 가능)– Persistent Memory에 압축 저장됨

• Core image의 호스트 컴퓨터로의 전송– 재부팅시 자동으로 전송– 수동 전송

• Workbench IDE– Workbench Debugger로 Core Image 분석– Stack Backtrace로 문제의 부분 호출 과정 파악– Exception 당시의 메모리 값, 레지스터 값

변수 값, 태스크 상태 등을 확인 가능

Stack Backtrace

Page 38: VxWorks소개 및 디버깅 환경 - cfs2.tistory.comcfs2.tistory.com/upload_control/download.blog?fhandle... · – rtpMemShow() – similar output as vmContextShow()

Copyright 2005 Wind River Systems, Inc.

감사합니다

세미나 이후 질문이 있으시면[email protected]

보내시면 됩니다.