ladebug kernel debugging tutorial

29
Ladebug Kernel Ladebug Kernel Debugging Tutorial Debugging Tutorial Bob Lidral

Upload: saki

Post on 04-Feb-2016

78 views

Category:

Documents


0 download

DESCRIPTION

Ladebug Kernel Debugging Tutorial. Bob Lidral. Introduction. Kinds of kernel debugging How to use Ladebug for kernel debugging Not how to debug a kernel. Agenda. Preparing a Kernel for Debugging Local Kernel Debugging Standalone Ladebug Ladebug With kdbx Crash Dump Analysis - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Ladebug Kernel Debugging Tutorial

Ladebug Kernel Debugging Ladebug Kernel Debugging TutorialTutorial

Bob Lidral

Page 2: Ladebug Kernel Debugging Tutorial

Introduction Introduction

Kinds of kernel debuggingHow to use Ladebug for kernel debuggingNot how to debug a kernel

Page 3: Ladebug Kernel Debugging Tutorial

AgendaAgenda Preparing a Kernel for Debugging Local Kernel Debugging

– Standalone Ladebug– Ladebug With kdbx

Crash Dump Analysis– Standalone Ladebug– Ladebug with kdbx

Remote Kernel Debugging– Without Gateway System– With Gateway System

Page 4: Ladebug Kernel Debugging Tutorial

OverviewOverview

Who– System Engineers– System Administrators

When and Why– Kernel Development and Debugging– Crash Analysis and Troubleshooting– System Configuration and Tuning

Page 5: Ladebug Kernel Debugging Tutorial

Preparing a Kernel for Preparing a Kernel for Debugging (if possible)Debugging (if possible)

Not always possible if debugging a running kernel or a crash dump

Compile without full optimizationDo not strip symbol table information

Page 6: Ladebug Kernel Debugging Tutorial

Local Kernel Debugging Local Kernel Debugging (Standalone)(Standalone)

Debug running kernel on same node as Ladebug session

Must have superuser (root) permissions Enter command:

# ladebug -k /vmunix /dev/mem Some Ladebug commands are not available in this

mode (e.g., cont, next, rerun, run, step, and stop)

Page 7: Ladebug Kernel Debugging Tutorial

Local Kernel Debugging Local Kernel Debugging (with kdbx)(with kdbx)

Debug running kernel on same node as kdbx session

Same restrictions as for standalone LadebugEnter command: # kdbx –dbx /bin/ladebug \ –k /vmunix /dev/memSupports all valid Ladebug commands plus

some kdbx command extensions

Page 8: Ladebug Kernel Debugging Tutorial

Crash Dump Analysis Crash Dump Analysis (Standalone)(Standalone)

Determine cause of a crash or panic May not need superuser (root) permissions Crash dump files are created in

/var/adm/crash Named vmunix.n and vmcore.n where n is

the version number and must match Enter command:

# ladebug -k vmunix.1 vmcore.1

Page 9: Ladebug Kernel Debugging Tutorial

Crash Dump Analysis Crash Dump Analysis (with kdbx)(with kdbx)

Determine cause of a crash or panicSame restrictions as for standalone LadebugEnter command:

# kdbx –dbx /bin/ladebug \ -k vmunix.1 vmcore.1Supports all valid Ladebug commands plus

some kdbx extensions

Page 10: Ladebug Kernel Debugging Tutorial

Remote Kernel DebuggingRemote Kernel Debugging

Run kernel on a remote node under control of Ladebug running on local node

Supports breakpoints in kernel code Requires serial line physical connection between

Test System and either Build or Gateway System– Specific communication port (usually COM1) on Test

System (see documentation)– Communication port may be configurable on Build or

Gateway System

Page 11: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging TerminologyTerminology

Build System – system on which Ladebug executes

Test System – system on which kernel being debugged executes

Gateway System (optional) – between Build System and Test System, connected to– Test System by physical serial line– Build System over network

Page 12: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging System RequirementsSystem Requirements

Test System– Tru64 UNIX Version 2.0 or higher

Verify: % uname –a

– Kernel Debugging Tools subsetVerify: % setld -i | grep -i kernel | \ grep installed

– Kernel Breakpoint Debugger kernel optionVerify: % /sbin/sysconfig -s kdebug

Page 13: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging System RequirementsSystem Requirements

Build System– Tru64 UNIX Version 3.2 or higher– Copy of Test System kernel executable image– Copy of kernel source code (optional, recommended)

Gateway System– Tru64 UNIX Version 2.0 or higher– Kernel Debugging Tools subset

Verify by same methods as for Test System

Page 14: Ladebug Kernel Debugging Tutorial

Serial LineSerial Line

BC16E CableH8571-J DECconnect Passive Adapter

H8571-J DECconnect Passive Adapter

Page 15: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging Without Gateway SystemWithout Gateway System

Specify Build System communication port to use for kdebug by appropriate entry in /etc/remote:– Default (COM1):

kdebug:dv=/dev/tty00:br#9600:pa=none:– Override in order to use as any of Build, Gateway, or

Test System (COM2):

kdebug:dv=/dev/tty01:br#9600:pa=none:

Note: the label “kdebug” must match the value of the Ladebug debugger variable $kdebug_line

Page 16: Ladebug Kernel Debugging Tutorial

kernel

CO

M1

CO

M2

kdebug

Test System

Remote Kernel Debugging Remote Kernel Debugging Without Gateway SystemWithout Gateway System

kdebugd

CO

M1

CO

M2

Ladebug

Build System

Serial Line

Page 17: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging With Console Serial LineWith Console Serial Line

Connect second serial line– Must be connected to COM1 communication

port on Test System– Configurable communication port on Build or

Gateway System

Test System: redirect console input and output at console prompt

>>> set console serial

Page 18: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging With Console Serial LineWith Console Serial Line

Build (or Gateway) System: add entry to /etc/remote for console serial line

tstsys:dv=/dev/tty00:br#9600:pa=none:Build (or Gateway) System: create a new

window for the Test System console and establish connection

% tip tstsys

Page 19: Ladebug Kernel Debugging Tutorial

kernel

CO

M1

CO

M2

kdebug

Test System

Remote Kernel Debugging Remote Kernel Debugging With Console Serial LineWith Console Serial Line

kdebugd

CO

M1

CO

M2

Ladebug

Build System

kdebugSerial Line

ConsoleSerial Line

Page 20: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging With Console Serial LineWith Console Serial Line

Restore Test System console communication to its console:

>>> set console graphicsExit from tip session:

~.

Page 21: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging With Gateway SystemWith Gateway System

Gateway System: specify communication port for kdebug by appropriate entry in /etc/remote:– Default (COM1):

kdebug:dv=/dev/tty00:br#9600:pa=none:– Override in order to use as any of Build, Gateway, or

Test System (COM2):

kdebug:dv=/dev/tty01:br#9600:pa=none:

Page 22: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging With Gateway SystemWith Gateway System

Gateway System: open window to display kdebugd/kdebug communication traffic:– execute tty command to get pathname of

device corresponding to this window– Use this pathname for the value of the Ladebug

debugger variable $kdebug_dbgtty on the Build System

Page 23: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging With Gateway SystemWith Gateway System

Build System: set Ladebug debugger variables describing connections:– $kdebug_host – node name of Gateway System

(default: localhost => no Gateway System)– $kdebug_line – label of /etc/remote entry on

Gateway System for kdebug communication port (default: kdebug)

– $kdebug_dbgtty – terminal window on Gateway System used to display kdebug communication traffic (output of tty command in that window)

(default: null => no Gateway System)

Page 24: Ladebug Kernel Debugging Tutorial

kernel

CO

M1

CO

M2

kdebug

Test System

Remote Kernel Debugging Remote Kernel Debugging With Gateway SystemWith Gateway System

kdebugd

Ladebug

Build System

kdebugdC

OM

1C

OM

2

Gateway System

Serial Line

Network

Page 25: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging StartupStartup

On Build System% ladebug –remote ./vmunix.test

(ladebug) stop in ttyretype

(ladebug) stop in panic

On Test System– If not at console prompt (>>>) # shutdown –h now

Page 26: Ladebug Kernel Debugging Tutorial

Remote Kernel Debugging Remote Kernel Debugging StartupStartup

Then, in either order– On Build System

(ladebug) run– On Test System

>>> boot –flags k

Once started, typing ^R on the Test System will trigger the ttyretype breakpoint. There is no way for Ladebug to gain control except at a breakpoint or other interruption of the kernel.

Page 27: Ladebug Kernel Debugging Tutorial

Where to Get More Where to Get More InformationInformation

Ladebug Debugger Manual– Kernel Debugging

Local Kernel Debugging Crash Dump Analysis

– Remote Kernel Debugging with the kdebug Debugger

Compaq Tru64 Unix Reference Page– ladebug(1)

Page 28: Ladebug Kernel Debugging Tutorial

Other Compaq Tru64 Unix Other Compaq Tru64 Unix ManualsManuals

Kernel Debugging– crashdc– kdbx– kdebug

System AdministrationSystem Configuration and Tuning

Page 29: Ladebug Kernel Debugging Tutorial

Other Compaq Tru64 Unix Other Compaq Tru64 Unix Reference PagesReference Pages

crashdc(8)ikdebug(8)kdbx(8)