aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/s390/Debugging390.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/s390/Debugging390.txt')
-rw-r--r--Documentation/s390/Debugging390.txt93
1 files changed, 46 insertions, 47 deletions
diff --git a/Documentation/s390/Debugging390.txt b/Documentation/s390/Debugging390.txt
index 844c03fe7921..4dd25ee549e9 100644
--- a/Documentation/s390/Debugging390.txt
+++ b/Documentation/s390/Debugging390.txt
@@ -8,8 +8,8 @@
8Overview of Document: 8Overview of Document:
9===================== 9=====================
10This document is intended to give an good overview of how to debug 10This document is intended to give an good overview of how to debug
11Linux for s/390 & z/Architecture it isn't intended as a complete reference & not a 11Linux for s/390 & z/Architecture. It isn't intended as a complete reference & not a
12tutorial on the fundamentals of C & assembly, it dosen't go into 12tutorial on the fundamentals of C & assembly. It doesn't go into
13390 IO in any detail. It is intended to complement the documents in the 13390 IO in any detail. It is intended to complement the documents in the
14reference section below & any other worthwhile references you get. 14reference section below & any other worthwhile references you get.
15 15
@@ -88,7 +88,7 @@ s/390 z/Architecture
880 0 Reserved ( must be 0 ) otherwise specification exception occurs. 880 0 Reserved ( must be 0 ) otherwise specification exception occurs.
89 89
901 1 Program Event Recording 1 PER enabled, 901 1 Program Event Recording 1 PER enabled,
91 PER is used to facilititate debugging e.g. single stepping. 91 PER is used to facilitate debugging e.g. single stepping.
92 92
932-4 2-4 Reserved ( must be 0 ). 932-4 2-4 Reserved ( must be 0 ).
94 94
@@ -163,7 +163,7 @@ s/390 z/Architecture
163 1 1 64 bit 163 1 1 64 bit
164 164
16532 1=31 bit addressing mode 0=24 bit addressing mode (for backward 16532 1=31 bit addressing mode 0=24 bit addressing mode (for backward
166 compatibility ), linux always runs with this bit set to 1 166 compatibility), linux always runs with this bit set to 1
167 167
16833-64 Instruction address. 16833-64 Instruction address.
169 33-63 Reserved must be 0 169 33-63 Reserved must be 0
@@ -188,7 +188,7 @@ Bytes 0-512 ( 200 hex ) on s/390 & 0-512,4096-4544,4604-5119 currently on z/Arch
188are used by the processor itself for holding such information as exception indications & 188are used by the processor itself for holding such information as exception indications &
189entry points for exceptions. 189entry points for exceptions.
190Bytes after 0xc00 hex are used by linux for per processor globals on s/390 & z/Architecture 190Bytes after 0xc00 hex are used by linux for per processor globals on s/390 & z/Architecture
191( there is a gap on z/Architecure too currently between 0xc00 & 1000 which linux uses ). 191( there is a gap on z/Architecture too currently between 0xc00 & 1000 which linux uses ).
192The closest thing to this on traditional architectures is the interrupt 192The closest thing to this on traditional architectures is the interrupt
193vector table. This is a good thing & does simplify some of the kernel coding 193vector table. This is a good thing & does simplify some of the kernel coding
194however it means that we now cannot catch stray NULL pointers in the 194however it means that we now cannot catch stray NULL pointers in the
@@ -239,7 +239,7 @@ they go to 64 Bit.
239 239
240On 390 our limitations & strengths make us slightly different. 240On 390 our limitations & strengths make us slightly different.
241For backward compatibility we are only allowed use 31 bits (2GB) 241For backward compatibility we are only allowed use 31 bits (2GB)
242of our 32 bit addresses,however, we use entirely separate address 242of our 32 bit addresses, however, we use entirely separate address
243spaces for the user & kernel. 243spaces for the user & kernel.
244 244
245This means we can support 2GB of non Extended RAM on s/390, & more 245This means we can support 2GB of non Extended RAM on s/390, & more
@@ -317,9 +317,9 @@ Each process/thread under Linux for S390 has its own kernel task_struct
317defined in linux/include/linux/sched.h 317defined in linux/include/linux/sched.h
318The S390 on initialisation & resuming of a process on a cpu sets 318The S390 on initialisation & resuming of a process on a cpu sets
319the __LC_KERNEL_STACK variable in the spare prefix area for this cpu 319the __LC_KERNEL_STACK variable in the spare prefix area for this cpu
320( which we use for per processor globals). 320(which we use for per-processor globals).
321 321
322The kernel stack pointer is intimately tied with the task stucture for 322The kernel stack pointer is intimately tied with the task structure for
323each processor as follows. 323each processor as follows.
324 324
325 s/390 325 s/390
@@ -354,7 +354,7 @@ static inline struct task_struct * get_current(void)
354} 354}
355 355
356i.e. just anding the current kernel stack pointer with the mask -8192. 356i.e. just anding the current kernel stack pointer with the mask -8192.
357Thankfully because Linux dosen't have support for nested IO interrupts 357Thankfully because Linux doesn't have support for nested IO interrupts
358& our devices have large buffers can survive interrupts being shut for 358& our devices have large buffers can survive interrupts being shut for
359short amounts of time we don't need a separate stack for interrupts. 359short amounts of time we don't need a separate stack for interrupts.
360 360
@@ -366,8 +366,8 @@ Register Usage & Stackframes on Linux for s/390 & z/Architecture
366Overview: 366Overview:
367--------- 367---------
368This is the code that gcc produces at the top & the bottom of 368This is the code that gcc produces at the top & the bottom of
369each function, it usually is fairly consistent & similar from 369each function. It usually is fairly consistent & similar from
370function to function & if you know its layout you can probalby 370function to function & if you know its layout you can probably
371make some headway in finding the ultimate cause of a problem 371make some headway in finding the ultimate cause of a problem
372after a crash without a source level debugger. 372after a crash without a source level debugger.
373 373
@@ -394,7 +394,7 @@ i.e they aren't in registers & they aren't static.
394back-chain: 394back-chain:
395This is a pointer to the stack pointer before entering a 395This is a pointer to the stack pointer before entering a
396framed functions ( see frameless function ) prologue got by 396framed functions ( see frameless function ) prologue got by
397deferencing the address of the current stack pointer, 397dereferencing the address of the current stack pointer,
398 i.e. got by accessing the 32 bit value at the stack pointers 398 i.e. got by accessing the 32 bit value at the stack pointers
399current location. 399current location.
400 400
@@ -724,7 +724,7 @@ This is useful for debugging because
7241) You can double check whether the files you expect to be included are the ones 7241) You can double check whether the files you expect to be included are the ones
725that are being included ( e.g. double check that you aren't going to the i386 asm directory ). 725that are being included ( e.g. double check that you aren't going to the i386 asm directory ).
7262) Check that macro definitions aren't clashing with typedefs, 7262) Check that macro definitions aren't clashing with typedefs,
7273) Check that definitons aren't being used before they are being included. 7273) Check that definitions aren't being used before they are being included.
7284) Helps put the line emitting the error under the microscope if it contains macros. 7284) Helps put the line emitting the error under the microscope if it contains macros.
729 729
730For convenience the Linux kernel's makefile will do preprocessing automatically for you 730For convenience the Linux kernel's makefile will do preprocessing automatically for you
@@ -840,12 +840,11 @@ using the strip command to make it a more reasonable size to boot it.
840 840
841A source/assembly mixed dump of the kernel can be done with the line 841A source/assembly mixed dump of the kernel can be done with the line
842objdump --source vmlinux > vmlinux.lst 842objdump --source vmlinux > vmlinux.lst
843Also if the file isn't compiled -g this will output as much debugging information 843Also, if the file isn't compiled -g, this will output as much debugging information
844as it can ( e.g. function names ), however, this is very slow as it spends lots 844as it can (e.g. function names). This is very slow as it spends lots
845of time searching for debugging info, the following self explanitory line should be used 845of time searching for debugging info. The following self explanatory line should be used
846instead if the code isn't compiled -g. 846instead if the code isn't compiled -g, as it is much faster:
847objdump --disassemble-all --syms vmlinux > vmlinux.lst 847objdump --disassemble-all --syms vmlinux > vmlinux.lst
848as it is much faster
849 848
850As hard drive space is valuble most of us use the following approach. 849As hard drive space is valuble most of us use the following approach.
8511) Look at the emitted psw on the console to find the crash address in the kernel. 8501) Look at the emitted psw on the console to find the crash address in the kernel.
@@ -861,7 +860,7 @@ Linux source tree.
8616) rm /arch/s390/kernel/signal.o 8606) rm /arch/s390/kernel/signal.o
8627) make /arch/s390/kernel/signal.o 8617) make /arch/s390/kernel/signal.o
8638) watch the gcc command line emitted 8628) watch the gcc command line emitted
8649) type it in again or alernatively cut & paste it on the console adding the -g option. 8639) type it in again or alternatively cut & paste it on the console adding the -g option.
86510) objdump --source arch/s390/kernel/signal.o > signal.lst 86410) objdump --source arch/s390/kernel/signal.o > signal.lst
866This will output the source & the assembly intermixed, as the snippet below shows 865This will output the source & the assembly intermixed, as the snippet below shows
867This will unfortunately output addresses which aren't the same 866This will unfortunately output addresses which aren't the same
@@ -913,8 +912,8 @@ If you wanted to know does ping work but didn't have the source
913strace ping -c 1 127.0.0.1 912strace ping -c 1 127.0.0.1
914& then look at the man pages for each of the syscalls below, 913& then look at the man pages for each of the syscalls below,
915( In fact this is sometimes easier than looking at some spagetti 914( In fact this is sometimes easier than looking at some spagetti
916source which conditionally compiles for several architectures ) 915source which conditionally compiles for several architectures ).
917Not everything that it throws out needs to make sense immeadiately 916Not everything that it throws out needs to make sense immediately.
918 917
919Just looking quickly you can see that it is making up a RAW socket 918Just looking quickly you can see that it is making up a RAW socket
920for the ICMP protocol. 919for the ICMP protocol.
@@ -974,8 +973,9 @@ through the pipe for each line containing the string open.
974 973
975Example 3 974Example 3
976--------- 975---------
977Getting sophistocated 976Getting sophisticated
978telnetd crashes on & I don't know why 977telnetd crashes & I don't know why
978
979Steps 979Steps
980----- 980-----
9811) Replace the following line in /etc/inetd.conf 9811) Replace the following line in /etc/inetd.conf
@@ -1085,8 +1085,7 @@ Notes
1085----- 1085-----
1086Addresses & values in the VM debugger are always hex never decimal 1086Addresses & values in the VM debugger are always hex never decimal
1087Address ranges are of the format <HexValue1>-<HexValue2> or <HexValue1>.<HexValue2> 1087Address ranges are of the format <HexValue1>-<HexValue2> or <HexValue1>.<HexValue2>
1088e.g. The address range 0x2000 to 0x3000 can be described described as 1088e.g. The address range 0x2000 to 0x3000 can be described as 2000-3000 or 2000.1000
10892000-3000 or 2000.1000
1090 1089
1091The VM Debugger is case insensitive. 1090The VM Debugger is case insensitive.
1092 1091
@@ -1311,7 +1310,7 @@ for finding out when a particular variable changes.
1311 1310
1312An alternative way of finding the STD of a currently running process 1311An alternative way of finding the STD of a currently running process
1313is to do the following, ( this method is more complex but 1312is to do the following, ( this method is more complex but
1314could be quite convient if you aren't updating the kernel much & 1313could be quite convenient if you aren't updating the kernel much &
1315so your kernel structures will stay constant for a reasonable period of 1314so your kernel structures will stay constant for a reasonable period of
1316time ). 1315time ).
1317 1316
@@ -1413,7 +1412,7 @@ SMP Specific commands
1413To find out how many cpus you have 1412To find out how many cpus you have
1414Q CPUS displays all the CPU's available to your virtual machine 1413Q CPUS displays all the CPU's available to your virtual machine
1415To find the cpu that the current cpu VM debugger commands are being directed at do 1414To find the cpu that the current cpu VM debugger commands are being directed at do
1416Q CPU to change the current cpu cpu VM debugger commands are being directed at do 1415Q CPU to change the current cpu VM debugger commands are being directed at do
1417CPU <desired cpu no> 1416CPU <desired cpu no>
1418 1417
1419On a SMP guest issue a command to all CPUs try prefixing the command with cpu all. 1418On a SMP guest issue a command to all CPUs try prefixing the command with cpu all.
@@ -1674,8 +1673,8 @@ channel is idle & the second for device end ( secondary status ) sometimes you g
1674concurrently, you check how the IO went on by issuing a TEST SUBCHANNEL at each interrupt, 1673concurrently, you check how the IO went on by issuing a TEST SUBCHANNEL at each interrupt,
1675from which you receive an Interruption response block (IRB). If you get channel & device end 1674from which you receive an Interruption response block (IRB). If you get channel & device end
1676status in the IRB without channel checks etc. your IO probably went okay. If you didn't you 1675status in the IRB without channel checks etc. your IO probably went okay. If you didn't you
1677probably need a doctorto examine the IRB & extended status word etc. 1676probably need a doctor to examine the IRB & extended status word etc.
1678If an error occurs more sophistocated control units have a facitity known as 1677If an error occurs, more sophistocated control units have a facitity known as
1679concurrent sense this means that if an error occurs Extended sense information will 1678concurrent sense this means that if an error occurs Extended sense information will
1680be presented in the Extended status word in the IRB if not you have to issue a 1679be presented in the Extended status word in the IRB if not you have to issue a
1681subsequent SENSE CCW command after the test subchannel. 1680subsequent SENSE CCW command after the test subchannel.
@@ -1704,7 +1703,7 @@ concentrate on data processing.
1704IOP's can use one or more links ( known as channel paths ) to talk to each 1703IOP's can use one or more links ( known as channel paths ) to talk to each
1705IO device. It first checks for path availability & chooses an available one, 1704IO device. It first checks for path availability & chooses an available one,
1706then starts ( & sometimes terminates IO ). 1705then starts ( & sometimes terminates IO ).
1707There are two types of channel path ESCON & the Paralell IO interface. 1706There are two types of channel path: ESCON & the Parallel IO interface.
1708 1707
1709IO devices are attached to control units, control units provide the 1708IO devices are attached to control units, control units provide the
1710logic to interface the channel paths & channel path IO protocols to 1709logic to interface the channel paths & channel path IO protocols to
@@ -1743,11 +1742,11 @@ controllers or a control unit which connects to 1000 3270 terminals ).
1743 1742
1744The 390 IO systems come in 2 flavours the current 390 machines support both 1743The 390 IO systems come in 2 flavours the current 390 machines support both
1745 1744
1746The Older 360 & 370 Interface,sometimes called the paralell I/O interface, 1745The Older 360 & 370 Interface,sometimes called the Parallel I/O interface,
1747sometimes called Bus-and Tag & sometimes Original Equipment Manufacturers 1746sometimes called Bus-and Tag & sometimes Original Equipment Manufacturers
1748Interface (OEMI). 1747Interface (OEMI).
1749 1748
1750This byte wide paralell channel path/bus has parity & data on the "Bus" cable 1749This byte wide Parallel channel path/bus has parity & data on the "Bus" cable
1751& control lines on the "Tag" cable. These can operate in byte multiplex mode for 1750& control lines on the "Tag" cable. These can operate in byte multiplex mode for
1752sharing between several slow devices or burst mode & monopolize the channel for the 1751sharing between several slow devices or burst mode & monopolize the channel for the
1753whole burst. Upto 256 devices can be addressed on one of these cables. These cables are 1752whole burst. Upto 256 devices can be addressed on one of these cables. These cables are
@@ -1777,7 +1776,7 @@ Consoles 3270 & 3215 ( a teletype emulated under linux for a line mode console )
1777DASD's direct access storage devices ( otherwise known as hard disks ). 1776DASD's direct access storage devices ( otherwise known as hard disks ).
1778Tape Drives. 1777Tape Drives.
1779CTC ( Channel to Channel Adapters ), 1778CTC ( Channel to Channel Adapters ),
1780ESCON or Paralell Cables used as a very high speed serial link 1779ESCON or Parallel Cables used as a very high speed serial link
1781between 2 machines. We use 2 cables under linux to do a bi-directional serial link. 1780between 2 machines. We use 2 cables under linux to do a bi-directional serial link.
1782 1781
1783 1782
@@ -1803,8 +1802,8 @@ OSA 7C09 ON OSA 7C09 SUBCHANNEL = 0001
1803OSA 7C14 ON OSA 7C14 SUBCHANNEL = 0002 1802OSA 7C14 ON OSA 7C14 SUBCHANNEL = 0002
1804OSA 7C15 ON OSA 7C15 SUBCHANNEL = 0003 1803OSA 7C15 ON OSA 7C15 SUBCHANNEL = 0003
1805 1804
1806If you have a guest with certain priviliges you may be able to see devices 1805If you have a guest with certain privileges you may be able to see devices
1807which don't belong to you to avoid this do add the option V. 1806which don't belong to you. To avoid this, add the option V.
1808e.g. 1807e.g.
1809Q V OSA 1808Q V OSA
1810 1809
@@ -1837,7 +1836,7 @@ RDRLIST
1837RECEIVE / LOG TXT A1 ( replace 1836RECEIVE / LOG TXT A1 ( replace
18388) 18378)
1839filel & press F11 to look at it 1838filel & press F11 to look at it
1840You should see someting like. 1839You should see something like:
1841 1840
184200020942' SSCH B2334000 0048813C CC 0 SCH 0000 DEV 7C08 184100020942' SSCH B2334000 0048813C CC 0 SCH 0000 DEV 7C08
1843 CPA 000FFDF0 PARM 00E2C9C4 KEY 0 FPI C0 LPM 80 1842 CPA 000FFDF0 PARM 00E2C9C4 KEY 0 FPI C0 LPM 80
@@ -1916,7 +1915,7 @@ Assembly
1916-------- 1915--------
1917info registers: displays registers other than floating point. 1916info registers: displays registers other than floating point.
1918info all-registers: displays floating points as well. 1917info all-registers: displays floating points as well.
1919disassemble: dissassembles 1918disassemble: disassembles
1920e.g. 1919e.g.
1921disassemble without parameters will disassemble the current function 1920disassemble without parameters will disassemble the current function
1922disassemble $pc $pc+10 1921disassemble $pc $pc+10
@@ -1935,7 +1934,7 @@ undisplay : undo's display's
1935 1934
1936info breakpoints: shows all current breakpoints 1935info breakpoints: shows all current breakpoints
1937 1936
1938info stack: shows stack back trace ( if this dosent work too well, I'll show you the 1937info stack: shows stack back trace ( if this doesn't work too well, I'll show you the
1939stacktrace by hand below ). 1938stacktrace by hand below ).
1940 1939
1941info locals: displays local variables. 1940info locals: displays local variables.
@@ -2045,13 +2044,13 @@ what gdb does when the victim receives certain signals.
2045list: 2044list:
2046e.g. 2045e.g.
2047list lists current function source 2046list lists current function source
2048list 1,10 list first 10 lines of curret file. 2047list 1,10 list first 10 lines of current file.
2049list test.c:1,10 2048list test.c:1,10
2050 2049
2051 2050
2052directory: 2051directory:
2053Adds directories to be searched for source if gdb cannot find the source. 2052Adds directories to be searched for source if gdb cannot find the source.
2054(note it is a bit sensititive about slashes ) 2053(note it is a bit sensititive about slashes)
2055e.g. To add the root of the filesystem to the searchpath do 2054e.g. To add the root of the filesystem to the searchpath do
2056directory // 2055directory //
2057 2056
@@ -2123,9 +2122,9 @@ p/x (*(**$sp+56))&0x7fffffff
2123 2122
2124Disassembling instructions without debug info 2123Disassembling instructions without debug info
2125--------------------------------------------- 2124---------------------------------------------
2126gdb typically compains if there is a lack of debugging 2125gdb typically complains if there is a lack of debugging
2127symbols in the disassemble command with 2126symbols in the disassemble command with
2128"No function contains specified address." to get around 2127"No function contains specified address." To get around
2129this do 2128this do
2130x/<number lines to disassemble>xi <address> 2129x/<number lines to disassemble>xi <address>
2131e.g. 2130e.g.
@@ -2184,7 +2183,7 @@ ps -aux | grep gdb
2184kill -SIGSEGV <gdb's pid> 2183kill -SIGSEGV <gdb's pid>
2185or alternatively use killall -SIGSEGV gdb if you have the killall command. 2184or alternatively use killall -SIGSEGV gdb if you have the killall command.
2186Now look at the core dump. 2185Now look at the core dump.
2187./gdb ./gdb core 2186./gdb core
2188Displays the following 2187Displays the following
2189GNU gdb 4.18 2188GNU gdb 4.18
2190Copyright 1998 Free Software Foundation, Inc. 2189Copyright 1998 Free Software Foundation, Inc.
@@ -2316,7 +2315,7 @@ Showing us the shared libraries init uses where they are in memory
2316/proc/1/mem is the current running processes memory which you 2315/proc/1/mem is the current running processes memory which you
2317can read & write to like a file. 2316can read & write to like a file.
2318strace uses this sometimes as it is a bit faster than the 2317strace uses this sometimes as it is a bit faster than the
2319rather inefficent ptrace interface for peeking at DATA. 2318rather inefficient ptrace interface for peeking at DATA.
2320 2319
2321 2320
2322cat status 2321cat status
@@ -2446,7 +2445,7 @@ displays the following lines as it executes them.
2446+ RELSTATUS=release 2445+ RELSTATUS=release
2447+ MACHTYPE=i586-pc-linux-gnu 2446+ MACHTYPE=i586-pc-linux-gnu
2448 2447
2449perl -d <scriptname> runs the perlscript in a fully intercative debugger 2448perl -d <scriptname> runs the perlscript in a fully interactive debugger
2450<like gdb>. 2449<like gdb>.
2451Type 'h' in the debugger for help. 2450Type 'h' in the debugger for help.
2452 2451
@@ -2477,7 +2476,7 @@ Lcrash is a perfectly normal program,however, it requires 2
2477additional files, Kerntypes which is built using a patch to the 2476additional files, Kerntypes which is built using a patch to the
2478linux kernel sources in the linux root directory & the System.map. 2477linux kernel sources in the linux root directory & the System.map.
2479 2478
2480Kerntypes is an an objectfile whose sole purpose in life 2479Kerntypes is an objectfile whose sole purpose in life
2481is to provide stabs debug info to lcrash, to do this 2480is to provide stabs debug info to lcrash, to do this
2482Kerntypes is built from kerntypes.c which just includes the most commonly 2481Kerntypes is built from kerntypes.c which just includes the most commonly
2483referenced header files used when debugging, lcrash can then read the 2482referenced header files used when debugging, lcrash can then read the