diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2015-01-09 03:49:20 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-01-15 05:11:12 -0500 |
commit | bae2a3cc4f5e2cd5b1902a040e6d3ff1f21f488a (patch) | |
tree | 38def1132bf7cace9036d7becda2732491e5104d /Documentation/s390 | |
parent | d97d929f06d0e072cd36fba6bd9d25b29bae34fd (diff) |
s390/docs: Break long lines in Debugging390.txt
There are a lot of lines that are longer than 80 columns in this file,
rendering it hard to read in a terminal window. This patch fixes most
of these long lines, and while we're at it, also makes some sentences
more readable, e.g. by replacing "&" with "and", adding proper
punctuation, removing superfluous clauses, etc.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'Documentation/s390')
-rw-r--r-- | Documentation/s390/Debugging390.txt | 464 |
1 files changed, 237 insertions, 227 deletions
diff --git a/Documentation/s390/Debugging390.txt b/Documentation/s390/Debugging390.txt index 08911b5c6b0e..ae75366cc3d0 100644 --- a/Documentation/s390/Debugging390.txt +++ b/Documentation/s390/Debugging390.txt | |||
@@ -1,14 +1,14 @@ | |||
1 | 1 | ||
2 | Debugging on Linux for s/390 & z/Architecture | 2 | Debugging on Linux for s/390 & z/Architecture |
3 | by | 3 | by |
4 | Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 4 | Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) |
5 | Copyright (C) 2000-2001 IBM Deutschland Entwicklung GmbH, IBM Corporation | 5 | Copyright (C) 2000-2001 IBM Deutschland Entwicklung GmbH, IBM Corporation |
6 | Best viewed with fixed width fonts | 6 | Best viewed with fixed width fonts |
7 | 7 | ||
8 | Overview of Document: | 8 | Overview of Document: |
9 | ===================== | 9 | ===================== |
10 | This document is intended to give a good overview of how to debug | 10 | This document is intended to give a good overview of how to debug Linux for |
11 | Linux for s/390 & z/Architecture. It isn't intended as a complete reference & not a | 11 | s/390 and z/Architecture. It is not intended as a complete reference and not a |
12 | tutorial on the fundamentals of C & assembly. It doesn't go into | 12 | tutorial on the fundamentals of C & assembly. It doesn't go into |
13 | 390 IO in any detail. It is intended to complement the documents in the | 13 | 390 IO in any detail. It is intended to complement the documents in the |
14 | reference section below & any other worthwhile references you get. | 14 | reference section below & any other worthwhile references you get. |
@@ -44,18 +44,20 @@ Register Set | |||
44 | ============ | 44 | ============ |
45 | The current architectures have the following registers. | 45 | The current architectures have the following registers. |
46 | 46 | ||
47 | 16 General propose registers, 32 bit on s/390 64 bit on z/Architecture, r0-r15 or gpr0-gpr15 used for arithmetic & addressing. | 47 | 16 General propose registers, 32 bit on s/390 and 64 bit on z/Architecture, |
48 | 48 | r0-r15 (or gpr0-gpr15), used for arithmetic and addressing. | |
49 | 16 Control registers, 32 bit on s/390 64 bit on z/Architecture, ( cr0-cr15 kernel usage only ) used for memory management, | 49 | |
50 | interrupt control,debugging control etc. | 50 | 16 Control registers, 32 bit on s/390 and 64 bit on z/Architecture, cr0-cr15, |
51 | 51 | kernel usage only, used for memory management, interrupt control, debugging | |
52 | 16 Access registers ( ar0-ar15 ) 32 bit on s/390 & z/Architecture | 52 | control etc. |
53 | not used by normal programs but potentially could | 53 | |
54 | be used as temporary storage. Their main purpose is their 1 to 1 | 54 | 16 Access registers (ar0-ar15), 32 bit on both s/390 and z/Architecture, |
55 | association with general purpose registers and are used in | 55 | normally not used by normal programs but potentially could be used as |
56 | the kernel for copying data between kernel & user address spaces. | 56 | temporary storage. These registers have a 1:1 association with general |
57 | Access register 0 ( & access register 1 on z/Architecture ( needs 64 bit | 57 | purpose registers and are designed to be used in the so-called access |
58 | pointer ) ) is currently used by the pthread library as a pointer to | 58 | register mode to select different address spaces. |
59 | Access register 0 (and access register 1 on z/Architecture, which needs a | ||
60 | 64 bit pointer) is currently used by the pthread library as a pointer to | ||
59 | the current running threads private area. | 61 | the current running threads private area. |
60 | 62 | ||
61 | 16 64 bit floating point registers (fp0-fp15 ) IEEE & HFP floating | 63 | 16 64 bit floating point registers (fp0-fp15 ) IEEE & HFP floating |
@@ -90,18 +92,19 @@ s/390 z/Architecture | |||
90 | 92 | ||
91 | 6 6 Input/Output interrupt Mask | 93 | 6 6 Input/Output interrupt Mask |
92 | 94 | ||
93 | 7 7 External interrupt Mask used primarily for interprocessor signalling & | 95 | 7 7 External interrupt Mask used primarily for interprocessor |
94 | clock interrupts. | 96 | signalling and clock interrupts. |
95 | 97 | ||
96 | 8-11 8-11 PSW Key used for complex memory protection mechanism not used under linux | 98 | 8-11 8-11 PSW Key used for complex memory protection mechanism |
99 | (not used under linux) | ||
97 | 100 | ||
98 | 12 12 1 on s/390 0 on z/Architecture | 101 | 12 12 1 on s/390 0 on z/Architecture |
99 | 102 | ||
100 | 13 13 Machine Check Mask 1=enable machine check interrupts | 103 | 13 13 Machine Check Mask 1=enable machine check interrupts |
101 | 104 | ||
102 | 14 14 Wait State set this to 1 to stop the processor except for interrupts & give | 105 | 14 14 Wait State. Set this to 1 to stop the processor except for |
103 | time to other LPARS used in CPU idle in the kernel to increase overall | 106 | interrupts and give time to other LPARS. Used in CPU idle in |
104 | usage of processor resources. | 107 | the kernel to increase overall usage of processor resources. |
105 | 108 | ||
106 | 15 15 Problem state ( if set to 1 certain instructions are disabled ) | 109 | 15 15 Problem state ( if set to 1 certain instructions are disabled ) |
107 | all linux user programs run with this bit 1 | 110 | all linux user programs run with this bit 1 |
@@ -165,21 +168,23 @@ s/390 z/Architecture | |||
165 | when loading the address with LPSWE otherwise a | 168 | when loading the address with LPSWE otherwise a |
166 | specification exception occurs, LPSW is fully backward | 169 | specification exception occurs, LPSW is fully backward |
167 | compatible. | 170 | compatible. |
168 | 171 | ||
169 | 172 | ||
170 | Prefix Page(s) | 173 | Prefix Page(s) |
171 | -------------- | 174 | -------------- |
172 | This per cpu memory area is too intimately tied to the processor not to mention. | 175 | This per cpu memory area is too intimately tied to the processor not to mention. |
173 | It exists between the real addresses 0-4096 on s/390 & 0-8192 z/Architecture & is exchanged | 176 | It exists between the real addresses 0-4096 on s/390 and between 0-8192 on |
174 | with a 1 page on s/390 or 2 pages on z/Architecture in absolute storage by the set | 177 | z/Architecture and is exchanged with one page on s/390 or two pages on |
175 | prefix instruction in linux'es startup. | 178 | z/Architecture in absolute storage by the set prefix instruction during Linux |
176 | This page is mapped to a different prefix for each processor in an SMP configuration | 179 | startup. |
177 | ( assuming the os designer is sane of course :-) ). | 180 | This page is mapped to a different prefix for each processor in an SMP |
178 | Bytes 0-512 ( 200 hex ) on s/390 & 0-512,4096-4544,4604-5119 currently on z/Architecture | 181 | configuration (assuming the OS designer is sane of course). |
179 | are used by the processor itself for holding such information as exception indications & | 182 | Bytes 0-512 (200 hex) on s/390 and 0-512, 4096-4544, 4604-5119 currently on |
180 | entry points for exceptions. | 183 | z/Architecture are used by the processor itself for holding such information |
181 | Bytes after 0xc00 hex are used by linux for per processor globals on s/390 & z/Architecture | 184 | as exception indications and entry points for exceptions. |
182 | ( there is a gap on z/Architecture too currently between 0xc00 & 1000 which linux uses ). | 185 | Bytes after 0xc00 hex are used by linux for per processor globals on s/390 and |
186 | z/Architecture (there is a gap on z/Architecture currently between 0xc00 and | ||
187 | 0x1000, too, which is used by Linux). | ||
183 | The closest thing to this on traditional architectures is the interrupt | 188 | The closest thing to this on traditional architectures is the interrupt |
184 | vector table. This is a good thing & does simplify some of the kernel coding | 189 | vector table. This is a good thing & does simplify some of the kernel coding |
185 | however it means that we now cannot catch stray NULL pointers in the | 190 | however it means that we now cannot catch stray NULL pointers in the |
@@ -192,26 +197,26 @@ Address Spaces on Intel Linux | |||
192 | 197 | ||
193 | The traditional Intel Linux is approximately mapped as follows forgive | 198 | The traditional Intel Linux is approximately mapped as follows forgive |
194 | the ascii art. | 199 | the ascii art. |
195 | 0xFFFFFFFF 4GB Himem ***************** | 200 | 0xFFFFFFFF 4GB Himem ***************** |
196 | * * | 201 | * * |
197 | * Kernel Space * | 202 | * Kernel Space * |
198 | * * | 203 | * * |
199 | ***************** **************** | 204 | ***************** **************** |
200 | User Space Himem (typically 0xC0000000 3GB )* User Stack * * * | 205 | User Space Himem * User Stack * * * |
201 | ***************** * * | 206 | (typically 0xC0000000 3GB ) ***************** * * |
202 | * Shared Libs * * Next Process * | 207 | * Shared Libs * * Next Process * |
203 | ***************** * to * | 208 | ***************** * to * |
204 | * * <== * Run * <== | 209 | * * <== * Run * <== |
205 | * User Program * * * | 210 | * User Program * * * |
206 | * Data BSS * * * | 211 | * Data BSS * * * |
207 | * Text * * * | 212 | * Text * * * |
208 | * Sections * * * | 213 | * Sections * * * |
209 | 0x00000000 ***************** **************** | 214 | 0x00000000 ***************** **************** |
210 | 215 | ||
211 | Now it is easy to see that on Intel it is quite easy to recognise a kernel address | 216 | Now it is easy to see that on Intel it is quite easy to recognise a kernel |
212 | as being one greater than user space himem ( in this case 0xC0000000). | 217 | address as being one greater than user space himem (in this case 0xC0000000), |
213 | & addresses of less than this are the ones in the current running program on this | 218 | and addresses of less than this are the ones in the current running program on |
214 | processor ( if an smp box ). | 219 | this processor (if an smp box). |
215 | If using the virtual machine ( VM ) as a debugger it is quite difficult to | 220 | If using the virtual machine ( VM ) as a debugger it is quite difficult to |
216 | know which user process is running as the address space you are looking at | 221 | know which user process is running as the address space you are looking at |
217 | could be from any process in the run queue. | 222 | could be from any process in the run queue. |
@@ -247,8 +252,8 @@ Our addressing scheme is basically as follows: | |||
247 | Himem 0x7fffffff 2GB on s/390 ***************** **************** | 252 | Himem 0x7fffffff 2GB on s/390 ***************** **************** |
248 | currently 0x3ffffffffff (2^42)-1 * User Stack * * * | 253 | currently 0x3ffffffffff (2^42)-1 * User Stack * * * |
249 | on z/Architecture. ***************** * * | 254 | on z/Architecture. ***************** * * |
250 | * Shared Libs * * * | 255 | * Shared Libs * * * |
251 | ***************** * * | 256 | ***************** * * |
252 | * * * Kernel * | 257 | * * * Kernel * |
253 | * User Program * * * | 258 | * User Program * * * |
254 | * Data BSS * * * | 259 | * Data BSS * * * |
@@ -301,10 +306,10 @@ Virtual Addresses on s/390 & z/Architecture | |||
301 | =========================================== | 306 | =========================================== |
302 | 307 | ||
303 | A virtual address on s/390 is made up of 3 parts | 308 | A virtual address on s/390 is made up of 3 parts |
304 | The SX ( segment index, roughly corresponding to the PGD & PMD in linux terminology ) | 309 | The SX (segment index, roughly corresponding to the PGD & PMD in Linux |
305 | being bits 1-11. | 310 | terminology) being bits 1-11. |
306 | The PX ( page index, corresponding to the page table entry (pte) in linux terminology ) | 311 | The PX (page index, corresponding to the page table entry (pte) in Linux |
307 | being bits 12-19. | 312 | terminology) being bits 12-19. |
308 | The remaining bits BX (the byte index are the offset in the page ) | 313 | The remaining bits BX (the byte index are the offset in the page ) |
309 | i.e. bits 20 to 31. | 314 | i.e. bits 20 to 31. |
310 | 315 | ||
@@ -368,9 +373,9 @@ each processor as follows. | |||
368 | * ( 8K ) * | 373 | * ( 8K ) * |
369 | 16K aligned ************************ | 374 | 16K aligned ************************ |
370 | 375 | ||
371 | What this means is that we don't need to dedicate any register or global variable | 376 | What this means is that we don't need to dedicate any register or global |
372 | to point to the current running process & can retrieve it with the following | 377 | variable to point to the current running process & can retrieve it with the |
373 | very simple construct for s/390 & one very similar for z/Architecture. | 378 | following very simple construct for s/390 & one very similar for z/Architecture. |
374 | 379 | ||
375 | static inline struct task_struct * get_current(void) | 380 | static inline struct task_struct * get_current(void) |
376 | { | 381 | { |
@@ -403,8 +408,8 @@ Note: To follow stackframes requires a knowledge of C or Pascal & | |||
403 | limited knowledge of one assembly language. | 408 | limited knowledge of one assembly language. |
404 | 409 | ||
405 | It should be noted that there are some differences between the | 410 | It should be noted that there are some differences between the |
406 | s/390 & z/Architecture stack layouts as the z/Architecture stack layout didn't have | 411 | s/390 and z/Architecture stack layouts as the z/Architecture stack layout |
407 | to maintain compatibility with older linkage formats. | 412 | didn't have to maintain compatibility with older linkage formats. |
408 | 413 | ||
409 | Glossary: | 414 | Glossary: |
410 | --------- | 415 | --------- |
@@ -440,7 +445,7 @@ The code generated by the compiler to return to the caller. | |||
440 | 445 | ||
441 | frameless-function | 446 | frameless-function |
442 | A frameless function in Linux for s390 & z/Architecture is one which doesn't | 447 | A frameless function in Linux for s390 & z/Architecture is one which doesn't |
443 | need more than the register save area ( 96 bytes on s/390, 160 on z/Architecture ) | 448 | need more than the register save area (96 bytes on s/390, 160 on z/Architecture) |
444 | given to it by the caller. | 449 | given to it by the caller. |
445 | A frameless function never: | 450 | A frameless function never: |
446 | 1) Sets up a back chain. | 451 | 1) Sets up a back chain. |
@@ -588,8 +593,8 @@ A sample program with comments. | |||
588 | 593 | ||
589 | Comments on the function test | 594 | Comments on the function test |
590 | ----------------------------- | 595 | ----------------------------- |
591 | 1) It didn't need to set up a pointer to the constant pool gpr13 as it isn't used | 596 | 1) It didn't need to set up a pointer to the constant pool gpr13 as it is not |
592 | ( :-( ). | 597 | used ( :-( ). |
593 | 2) This is a frameless function & no stack is bought. | 598 | 2) This is a frameless function & no stack is bought. |
594 | 3) The compiler was clever enough to recognise that it could return the | 599 | 3) The compiler was clever enough to recognise that it could return the |
595 | value in r2 as well as use it for the passed in parameter ( :-) ). | 600 | value in r2 as well as use it for the passed in parameter ( :-) ). |
@@ -743,35 +748,34 @@ Debugging under VM | |||
743 | Notes | 748 | Notes |
744 | ----- | 749 | ----- |
745 | Addresses & values in the VM debugger are always hex never decimal | 750 | Addresses & values in the VM debugger are always hex never decimal |
746 | Address ranges are of the format <HexValue1>-<HexValue2> or <HexValue1>.<HexValue2> | 751 | Address ranges are of the format <HexValue1>-<HexValue2> or |
747 | e.g. The address range 0x2000 to 0x3000 can be described as 2000-3000 or 2000.1000 | 752 | <HexValue1>.<HexValue2> |
753 | For example, the address range 0x2000 to 0x3000 can be described as 2000-3000 | ||
754 | or 2000.1000 | ||
748 | 755 | ||
749 | The VM Debugger is case insensitive. | 756 | The VM Debugger is case insensitive. |
750 | 757 | ||
751 | VM's strengths are usually other debuggers weaknesses you can get at any resource | 758 | VM's strengths are usually other debuggers weaknesses you can get at any |
752 | no matter how sensitive e.g. memory management resources,change address translation | 759 | resource no matter how sensitive e.g. memory management resources, change |
753 | in the PSW. For kernel hacking you will reap dividends if you get good at it. | 760 | address translation in the PSW. For kernel hacking you will reap dividends if |
754 | 761 | you get good at it. | |
755 | The VM Debugger displays operators but not operands, probably because some | 762 | |
756 | of it was written when memory was expensive & the programmer was probably proud that | 763 | The VM Debugger displays operators but not operands, and also the debugger |
757 | it fitted into 2k of memory & the programmers & didn't want to shock hardcore VM'ers by | 764 | displays useful information on the same line as the author of the code probably |
758 | changing the interface :-), also the debugger displays useful information on the same line & | 765 | felt that it was a good idea not to go over the 80 columns on the screen. |
759 | the author of the code probably felt that it was a good idea not to go over | 766 | This isn't as unintuitive as it may seem as the s/390 instructions are easy to |
760 | the 80 columns on the screen. | 767 | decode mentally and you can make a good guess at a lot of them as all the |
761 | 768 | operands are nibble (half byte aligned). | |
762 | As some of you are probably in a panic now this isn't as unintuitive as it may seem | 769 | So if you have an objdump listing by hand, it is quite easy to follow, and if |
763 | as the 390 instructions are easy to decode mentally & you can make a good guess at a lot | 770 | you don't have an objdump listing keep a copy of the s/390 Reference Summary |
764 | of them as all the operands are nibble ( half byte aligned ) & if you have an objdump listing | 771 | or alternatively the s/390 principles of operation next to you. |
765 | also it is quite easy to follow, if you don't have an objdump listing keep a copy of | ||
766 | the s/390 Reference Summary & look at between pages 2 & 7 or alternatively the | ||
767 | s/390 principles of operation. | ||
768 | e.g. even I can guess that | 772 | e.g. even I can guess that |
769 | 0001AFF8' LR 180F CC 0 | 773 | 0001AFF8' LR 180F CC 0 |
770 | is a ( load register ) lr r0,r15 | 774 | is a ( load register ) lr r0,r15 |
771 | 775 | ||
772 | Also it is very easy to tell the length of a 390 instruction from the 2 most significant | 776 | Also it is very easy to tell the length of a 390 instruction from the 2 most |
773 | bits in the instruction ( not that this info is really useful except if you are trying to | 777 | significant bits in the instruction (not that this info is really useful except |
774 | make sense of a hexdump of code ). | 778 | if you are trying to make sense of a hexdump of code). |
775 | Here is a table | 779 | Here is a table |
776 | Bits Instruction Length | 780 | Bits Instruction Length |
777 | ------------------------------------------ | 781 | ------------------------------------------ |
@@ -780,9 +784,6 @@ Bits Instruction Length | |||
780 | 10 4 Bytes | 784 | 10 4 Bytes |
781 | 11 6 Bytes | 785 | 11 6 Bytes |
782 | 786 | ||
783 | |||
784 | |||
785 | |||
786 | The debugger also displays other useful info on the same line such as the | 787 | The debugger also displays other useful info on the same line such as the |
787 | addresses being operated on destination addresses of branches & condition codes. | 788 | addresses being operated on destination addresses of branches & condition codes. |
788 | e.g. | 789 | e.g. |
@@ -853,8 +854,8 @@ Displaying & modifying Registers | |||
853 | -------------------------------- | 854 | -------------------------------- |
854 | D G will display all the gprs | 855 | D G will display all the gprs |
855 | Adding a extra G to all the commands is necessary to access the full 64 bit | 856 | Adding a extra G to all the commands is necessary to access the full 64 bit |
856 | content in VM on z/Architecture obviously this isn't required for access registers | 857 | content in VM on z/Architecture. Obviously this isn't required for access |
857 | as these are still 32 bit. | 858 | registers as these are still 32 bit. |
858 | e.g. DGG instead of DG | 859 | e.g. DGG instead of DG |
859 | D X will display all the control registers | 860 | D X will display all the control registers |
860 | D AR will display all the access registers | 861 | D AR will display all the access registers |
@@ -870,10 +871,11 @@ Displaying Memory | |||
870 | ----------------- | 871 | ----------------- |
871 | To display memory mapped using the current PSW's mapping try | 872 | To display memory mapped using the current PSW's mapping try |
872 | D <range> | 873 | D <range> |
873 | To make VM display a message each time it hits a particular address & continue try | 874 | To make VM display a message each time it hits a particular address and |
875 | continue try | ||
874 | D I<range> will disassemble/display a range of instructions. | 876 | D I<range> will disassemble/display a range of instructions. |
875 | ST addr 32 bit word will store a 32 bit aligned address | 877 | ST addr 32 bit word will store a 32 bit aligned address |
876 | D T<range> will display the EBCDIC in an address ( if you are that way inclined ) | 878 | D T<range> will display the EBCDIC in an address (if you are that way inclined) |
877 | D R<range> will display real addresses ( without DAT ) but with prefixing. | 879 | D R<range> will display real addresses ( without DAT ) but with prefixing. |
878 | There are other complex options to display if you need to get at say home space | 880 | There are other complex options to display if you need to get at say home space |
879 | but are in primary space the easiest thing to do is to temporarily | 881 | but are in primary space the easiest thing to do is to temporarily |
@@ -884,8 +886,8 @@ restore it. | |||
884 | 886 | ||
885 | Hints | 887 | Hints |
886 | ----- | 888 | ----- |
887 | If you want to issue a debugger command without halting your virtual machine with the | 889 | If you want to issue a debugger command without halting your virtual machine |
888 | PA1 key try prefixing the command with #CP e.g. | 890 | with the PA1 key try prefixing the command with #CP e.g. |
889 | #cp tr i pswa 2000 | 891 | #cp tr i pswa 2000 |
890 | also suffixing most debugger commands with RUN will cause them not | 892 | also suffixing most debugger commands with RUN will cause them not |
891 | to stop just display the mnemonic at the current instruction on the console. | 893 | to stop just display the mnemonic at the current instruction on the console. |
@@ -903,9 +905,10 @@ This sends a message to your own console each time do_signal is entered. | |||
903 | script with breakpoints on every kernel procedure, this isn't a good idea | 905 | script with breakpoints on every kernel procedure, this isn't a good idea |
904 | because there are thousands of these routines & VM can only set 255 breakpoints | 906 | because there are thousands of these routines & VM can only set 255 breakpoints |
905 | at a time so you nearly had to spend as long pruning the file down as you would | 907 | at a time so you nearly had to spend as long pruning the file down as you would |
906 | entering the msg's by hand ),however, the trick might be useful for a single object file. | 908 | entering the msgs by hand), however, the trick might be useful for a single |
907 | On linux'es 3270 emulator x3270 there is a very useful option under the file ment | 909 | object file. In the 3270 terminal emulator x3270 there is a very useful option |
908 | Save Screens In File this is very good of keeping a copy of traces. | 910 | in the file menu called "Save Screen In File" - this is very good for keeping a |
911 | copy of traces. | ||
909 | 912 | ||
910 | From CMS help <command name> will give you online help on a particular command. | 913 | From CMS help <command name> will give you online help on a particular command. |
911 | e.g. | 914 | e.g. |
@@ -920,7 +923,8 @@ SET PF9 IMM B | |||
920 | This does a single step in VM on pressing F8. | 923 | This does a single step in VM on pressing F8. |
921 | SET PF10 ^ | 924 | SET PF10 ^ |
922 | This sets up the ^ key. | 925 | This sets up the ^ key. |
923 | which can be used for ^c (ctrl-c),^z (ctrl-z) which can't be typed directly into some 3270 consoles. | 926 | which can be used for ^c (ctrl-c),^z (ctrl-z) which can't be typed directly |
927 | into some 3270 consoles. | ||
924 | SET PF11 ^- | 928 | SET PF11 ^- |
925 | This types the starting keystrokes for a sysrq see SysRq below. | 929 | This types the starting keystrokes for a sysrq see SysRq below. |
926 | SET PF12 RETRIEVE | 930 | SET PF12 RETRIEVE |
@@ -1014,8 +1018,8 @@ Tracing Program Exceptions | |||
1014 | -------------------------- | 1018 | -------------------------- |
1015 | If you get a crash which says something like | 1019 | If you get a crash which says something like |
1016 | illegal operation or specification exception followed by a register dump | 1020 | illegal operation or specification exception followed by a register dump |
1017 | You can restart linux & trace these using the tr prog <range or value> trace option. | 1021 | You can restart linux & trace these using the tr prog <range or value> trace |
1018 | 1022 | option. | |
1019 | 1023 | ||
1020 | 1024 | ||
1021 | The most common ones you will normally be tracing for is | 1025 | The most common ones you will normally be tracing for is |
@@ -1057,9 +1061,10 @@ TR GOTO INITIAL | |||
1057 | 1061 | ||
1058 | Tracing linux syscalls under VM | 1062 | Tracing linux syscalls under VM |
1059 | ------------------------------- | 1063 | ------------------------------- |
1060 | Syscalls are implemented on Linux for S390 by the Supervisor call instruction (SVC) there 256 | 1064 | Syscalls are implemented on Linux for S390 by the Supervisor call instruction |
1061 | possibilities of these as the instruction is made up of a 0xA opcode & the second byte being | 1065 | (SVC). There 256 possibilities of these as the instruction is made up of a 0xA |
1062 | the syscall number. They are traced using the simple command. | 1066 | opcode and the second byte being the syscall number. They are traced using the |
1067 | simple command: | ||
1063 | TR SVC <Optional value or range> | 1068 | TR SVC <Optional value or range> |
1064 | the syscalls are defined in linux/arch/s390/include/asm/unistd.h | 1069 | the syscalls are defined in linux/arch/s390/include/asm/unistd.h |
1065 | e.g. to trace all file opens just do | 1070 | e.g. to trace all file opens just do |
@@ -1070,12 +1075,12 @@ SMP Specific commands | |||
1070 | --------------------- | 1075 | --------------------- |
1071 | To find out how many cpus you have | 1076 | To find out how many cpus you have |
1072 | Q CPUS displays all the CPU's available to your virtual machine | 1077 | Q CPUS displays all the CPU's available to your virtual machine |
1073 | To find the cpu that the current cpu VM debugger commands are being directed at do | 1078 | To find the cpu that the current cpu VM debugger commands are being directed at |
1074 | Q CPU to change the current cpu VM debugger commands are being directed at do | 1079 | do Q CPU to change the current cpu VM debugger commands are being directed at do |
1075 | CPU <desired cpu no> | 1080 | CPU <desired cpu no> |
1076 | 1081 | ||
1077 | On a SMP guest issue a command to all CPUs try prefixing the command with cpu all. | 1082 | On a SMP guest issue a command to all CPUs try prefixing the command with cpu |
1078 | To issue a command to a particular cpu try cpu <cpu number> e.g. | 1083 | all. To issue a command to a particular cpu try cpu <cpu number> e.g. |
1079 | CPU 01 TR I R 2000.3000 | 1084 | CPU 01 TR I R 2000.3000 |
1080 | If you are running on a guest with several cpus & you have a IO related problem | 1085 | If you are running on a guest with several cpus & you have a IO related problem |
1081 | & cannot follow the flow of code but you know it isn't smp related. | 1086 | & cannot follow the flow of code but you know it isn't smp related. |
@@ -1101,10 +1106,10 @@ D TX0.100 | |||
1101 | 1106 | ||
1102 | Alternatively | 1107 | Alternatively |
1103 | ============= | 1108 | ============= |
1104 | Under older VM debuggers ( I love EBDIC too ) you can use this little program I wrote which | 1109 | Under older VM debuggers (I love EBDIC too) you can use following little |
1105 | will convert a command line of hex digits to ascii text which can be compiled under linux & | 1110 | program which converts a command line of hex digits to ascii text. It can be |
1106 | you can copy the hex digits from your x3270 terminal to your xterm if you are debugging | 1111 | compiled under linux and you can copy the hex digits from your x3270 terminal |
1107 | from a linuxbox. | 1112 | to your xterm if you are debugging from a linuxbox. |
1108 | 1113 | ||
1109 | This is quite useful when looking at a parameter passed in as a text string | 1114 | This is quite useful when looking at a parameter passed in as a text string |
1110 | under VM ( unless you are good at decoding ASCII in your head ). | 1115 | under VM ( unless you are good at decoding ASCII in your head ). |
@@ -1114,14 +1119,14 @@ TR SVC 5 | |||
1114 | We have stopped at a breakpoint | 1119 | We have stopped at a breakpoint |
1115 | 000151B0' SVC 0A05 -> 0001909A' CC 0 | 1120 | 000151B0' SVC 0A05 -> 0001909A' CC 0 |
1116 | 1121 | ||
1117 | D 20.8 to check the SVC old psw in the prefix area & see was it from userspace | 1122 | D 20.8 to check the SVC old psw in the prefix area and see was it from userspace |
1118 | ( for the layout of the prefix area consult P18 of the s/390 390 Reference Summary | 1123 | (for the layout of the prefix area consult the "Fixed Storage Locations" |
1119 | if you have it available ). | 1124 | chapter of the s/390 Reference Summary if you have it available). |
1120 | V00000020 070C2000 800151B2 | 1125 | V00000020 070C2000 800151B2 |
1121 | The problem state bit wasn't set & it's also too early in the boot sequence | 1126 | The problem state bit wasn't set & it's also too early in the boot sequence |
1122 | for it to be a userspace SVC if it was we would have to temporarily switch the | 1127 | for it to be a userspace SVC if it was we would have to temporarily switch the |
1123 | psw to user space addressing so we could get at the first parameter of the open in | 1128 | psw to user space addressing so we could get at the first parameter of the open |
1124 | gpr2. | 1129 | in gpr2. |
1125 | Next do a | 1130 | Next do a |
1126 | D G2 | 1131 | D G2 |
1127 | GPR 2 = 00014CB4 | 1132 | GPR 2 = 00014CB4 |
@@ -1208,9 +1213,9 @@ Here are the tricks I use 9 out of 10 times it works pretty well, | |||
1208 | 1213 | ||
1209 | When your backchain reaches a dead end | 1214 | When your backchain reaches a dead end |
1210 | -------------------------------------- | 1215 | -------------------------------------- |
1211 | This can happen when an exception happens in the kernel & the kernel is entered twice | 1216 | This can happen when an exception happens in the kernel and the kernel is |
1212 | if you reach the NULL pointer at the end of the back chain you should be | 1217 | entered twice. If you reach the NULL pointer at the end of the back chain you |
1213 | able to sniff further back if you follow the following tricks. | 1218 | should be able to sniff further back if you follow the following tricks. |
1214 | 1) A kernel address should be easy to recognise since it is in | 1219 | 1) A kernel address should be easy to recognise since it is in |
1215 | primary space & the problem state bit isn't set & also | 1220 | primary space & the problem state bit isn't set & also |
1216 | The Hi bit of the address is set. | 1221 | The Hi bit of the address is set. |
@@ -1260,8 +1265,8 @@ V000FFFD0 00010400 80010802 8001085A 000FFFA0 | |||
1260 | 1265 | ||
1261 | our 3rd return address is 8001085A | 1266 | our 3rd return address is 8001085A |
1262 | 1267 | ||
1263 | as the 04B52002 looks suspiciously like rubbish it is fair to assume that the kernel entry routines | 1268 | as the 04B52002 looks suspiciously like rubbish it is fair to assume that the |
1264 | for the sake of optimisation don't set up a backchain. | 1269 | kernel entry routines for the sake of optimisation don't set up a backchain. |
1265 | 1270 | ||
1266 | now look at System.map to see if the addresses make any sense. | 1271 | now look at System.map to see if the addresses make any sense. |
1267 | 1272 | ||
@@ -1289,67 +1294,75 @@ Congrats you've done your first backchain. | |||
1289 | s/390 & z/Architecture IO Overview | 1294 | s/390 & z/Architecture IO Overview |
1290 | ================================== | 1295 | ================================== |
1291 | 1296 | ||
1292 | I am not going to give a course in 390 IO architecture as this would take me quite a | 1297 | I am not going to give a course in 390 IO architecture as this would take me |
1293 | while & I'm no expert. Instead I'll give a 390 IO architecture summary for Dummies if you have | 1298 | quite a while and I'm no expert. Instead I'll give a 390 IO architecture |
1294 | the s/390 principles of operation available read this instead. If nothing else you may find a few | 1299 | summary for Dummies. If you have the s/390 principles of operation available |
1295 | useful keywords in here & be able to use them on a web search engine like altavista to find | 1300 | read this instead. If nothing else you may find a few useful keywords in here |
1296 | more useful information. | 1301 | and be able to use them on a web search engine to find more useful information. |
1297 | 1302 | ||
1298 | Unlike other bus architectures modern 390 systems do their IO using mostly | 1303 | Unlike other bus architectures modern 390 systems do their IO using mostly |
1299 | fibre optics & devices such as tapes & disks can be shared between several mainframes, | 1304 | fibre optics and devices such as tapes and disks can be shared between several |
1300 | also S390 can support up to 65536 devices while a high end PC based system might be choking | 1305 | mainframes. Also S390 can support up to 65536 devices while a high end PC based |
1301 | with around 64. Here is some of the common IO terminology | 1306 | system might be choking with around 64. |
1302 | 1307 | ||
1303 | Subchannel: | 1308 | Here is some of the common IO terminology: |
1304 | This is the logical number most IO commands use to talk to an IO device there can be up to | ||
1305 | 0x10000 (65536) of these in a configuration typically there is a few hundred. Under VM | ||
1306 | for simplicity they are allocated contiguously, however on the native hardware they are not | ||
1307 | they typically stay consistent between boots provided no new hardware is inserted or removed. | ||
1308 | Under Linux for 390 we use these as IRQ's & also when issuing an IO command (CLEAR SUBCHANNEL, | ||
1309 | HALT SUBCHANNEL,MODIFY SUBCHANNEL,RESUME SUBCHANNEL,START SUBCHANNEL,STORE SUBCHANNEL & | ||
1310 | TEST SUBCHANNEL ) we use this as the ID of the device we wish to talk to, the most | ||
1311 | important of these instructions are START SUBCHANNEL ( to start IO ), TEST SUBCHANNEL ( to check | ||
1312 | whether the IO completed successfully ), & HALT SUBCHANNEL ( to kill IO ), a subchannel | ||
1313 | can have up to 8 channel paths to a device this offers redundancy if one is not available. | ||
1314 | 1309 | ||
1310 | Subchannel: | ||
1311 | This is the logical number most IO commands use to talk to an IO device. There | ||
1312 | can be up to 0x10000 (65536) of these in a configuration, typically there are a | ||
1313 | few hundred. Under VM for simplicity they are allocated contiguously, however | ||
1314 | on the native hardware they are not. They typically stay consistent between | ||
1315 | boots provided no new hardware is inserted or removed. | ||
1316 | Under Linux for s390 we use these as IRQ's and also when issuing an IO command | ||
1317 | (CLEAR SUBCHANNEL, HALT SUBCHANNEL, MODIFY SUBCHANNEL, RESUME SUBCHANNEL, | ||
1318 | START SUBCHANNEL, STORE SUBCHANNEL and TEST SUBCHANNEL). We use this as the ID | ||
1319 | of the device we wish to talk to. The most important of these instructions are | ||
1320 | START SUBCHANNEL (to start IO), TEST SUBCHANNEL (to check whether the IO | ||
1321 | completed successfully) and HALT SUBCHANNEL (to kill IO). A subchannel can have | ||
1322 | up to 8 channel paths to a device, this offers redundancy if one is not | ||
1323 | available. | ||
1315 | 1324 | ||
1316 | Device Number: | 1325 | Device Number: |
1317 | This number remains static & Is closely tied to the hardware, there are 65536 of these | 1326 | This number remains static and is closely tied to the hardware. There are 65536 |
1318 | also they are made up of a CHPID ( Channel Path ID, the most significant 8 bits ) | 1327 | of these, made up of a CHPID (Channel Path ID, the most significant 8 bits) and |
1319 | & another lsb 8 bits. These remain static even if more devices are inserted or removed | 1328 | another lsb 8 bits. These remain static even if more devices are inserted or |
1320 | from the hardware, there is a 1 to 1 mapping between Subchannels & Device Numbers provided | 1329 | removed from the hardware. There is a 1 to 1 mapping between subchannels and |
1321 | devices aren't inserted or removed. | 1330 | device numbers, provided devices aren't inserted or removed. |
1322 | 1331 | ||
1323 | Channel Control Words: | 1332 | Channel Control Words: |
1324 | CCWS are linked lists of instructions initially pointed to by an operation request block (ORB), | 1333 | CCWs are linked lists of instructions initially pointed to by an operation |
1325 | which is initially given to Start Subchannel (SSCH) command along with the subchannel number | 1334 | request block (ORB), which is initially given to Start Subchannel (SSCH) |
1326 | for the IO subsystem to process while the CPU continues executing normal code. | 1335 | command along with the subchannel number for the IO subsystem to process |
1327 | These come in two flavours, Format 0 ( 24 bit for backward ) | 1336 | while the CPU continues executing normal code. |
1328 | compatibility & Format 1 ( 31 bit ). These are typically used to issue read & write | 1337 | CCWs come in two flavours, Format 0 (24 bit for backward compatibility) and |
1329 | ( & many other instructions ) they consist of a length field & an absolute address field. | 1338 | Format 1 (31 bit). These are typically used to issue read and write (and many |
1330 | For each IO typically get 1 or 2 interrupts one for channel end ( primary status ) when the | 1339 | other) instructions. They consist of a length field and an absolute address |
1331 | channel is idle & the second for device end ( secondary status ) sometimes you get both | 1340 | field. |
1332 | concurrently, you check how the IO went on by issuing a TEST SUBCHANNEL at each interrupt, | 1341 | Each IO typically gets 1 or 2 interrupts, one for channel end (primary status) |
1333 | from which you receive an Interruption response block (IRB). If you get channel & device end | 1342 | when the channel is idle, and the second for device end (secondary status). |
1334 | status in the IRB without channel checks etc. your IO probably went okay. If you didn't you | 1343 | Sometimes you get both concurrently. You check how the IO went on by issuing a |
1335 | probably need a doctor to examine the IRB & extended status word etc. | 1344 | TEST SUBCHANNEL at each interrupt, from which you receive an Interruption |
1345 | response block (IRB). If you get channel and device end status in the IRB | ||
1346 | without channel checks etc. your IO probably went okay. If you didn't you | ||
1347 | probably need to examine the IRB, extended status word etc. | ||
1336 | If an error occurs, more sophisticated control units have a facility known as | 1348 | If an error occurs, more sophisticated control units have a facility known as |
1337 | concurrent sense this means that if an error occurs Extended sense information will | 1349 | concurrent sense. This means that if an error occurs Extended sense information |
1338 | be presented in the Extended status word in the IRB if not you have to issue a | 1350 | will be presented in the Extended status word in the IRB. If not you have to |
1339 | subsequent SENSE CCW command after the test subchannel. | 1351 | issue a subsequent SENSE CCW command after the test subchannel. |
1340 | 1352 | ||
1341 | 1353 | ||
1342 | TPI( Test pending interrupt) can also be used for polled IO but in multitasking multiprocessor | 1354 | TPI (Test pending interrupt) can also be used for polled IO, but in |
1343 | systems it isn't recommended except for checking special cases ( i.e. non looping checks for | 1355 | multitasking multiprocessor systems it isn't recommended except for |
1344 | pending IO etc. ). | 1356 | checking special cases (i.e. non looping checks for pending IO etc.). |
1345 | 1357 | ||
1346 | Store Subchannel & Modify Subchannel can be used to examine & modify operating characteristics | 1358 | Store Subchannel and Modify Subchannel can be used to examine and modify |
1347 | of a subchannel ( e.g. channel paths ). | 1359 | operating characteristics of a subchannel (e.g. channel paths). |
1348 | 1360 | ||
1349 | Other IO related Terms: | 1361 | Other IO related Terms: |
1350 | Sysplex: S390's Clustering Technology | 1362 | Sysplex: S390's Clustering Technology |
1351 | QDIO: S390's new high speed IO architecture to support devices such as gigabit ethernet, | 1363 | QDIO: S390's new high speed IO architecture to support devices such as gigabit |
1352 | this architecture is also designed to be forward compatible with up & coming 64 bit machines. | 1364 | ethernet, this architecture is also designed to be forward compatible with |
1365 | upcoming 64 bit machines. | ||
1353 | 1366 | ||
1354 | 1367 | ||
1355 | General Concepts | 1368 | General Concepts |
@@ -1406,37 +1419,40 @@ sometimes called Bus-and Tag & sometimes Original Equipment Manufacturers | |||
1406 | Interface (OEMI). | 1419 | Interface (OEMI). |
1407 | 1420 | ||
1408 | This byte wide Parallel channel path/bus has parity & data on the "Bus" cable | 1421 | This byte wide Parallel channel path/bus has parity & data on the "Bus" cable |
1409 | & control lines on the "Tag" cable. These can operate in byte multiplex mode for | 1422 | and control lines on the "Tag" cable. These can operate in byte multiplex mode |
1410 | sharing between several slow devices or burst mode & monopolize the channel for the | 1423 | for sharing between several slow devices or burst mode and monopolize the |
1411 | whole burst. Up to 256 devices can be addressed on one of these cables. These cables are | 1424 | channel for the whole burst. Up to 256 devices can be addressed on one of these |
1412 | about one inch in diameter. The maximum unextended length supported by these cables is | 1425 | cables. These cables are about one inch in diameter. The maximum unextended |
1413 | 125 Meters but this can be extended up to 2km with a fibre optic channel extended | 1426 | length supported by these cables is 125 Meters but this can be extended up to |
1414 | such as a 3044. The maximum burst speed supported is 4.5 megabytes per second however | 1427 | 2km with a fibre optic channel extended such as a 3044. The maximum burst speed |
1415 | some really old processors support only transfer rates of 3.0, 2.0 & 1.0 MB/sec. | 1428 | supported is 4.5 megabytes per second. However, some really old processors |
1429 | support only transfer rates of 3.0, 2.0 & 1.0 MB/sec. | ||
1416 | One of these paths can be daisy chained to up to 8 control units. | 1430 | One of these paths can be daisy chained to up to 8 control units. |
1417 | 1431 | ||
1418 | 1432 | ||
1419 | ESCON if fibre optic it is also called FICON | 1433 | ESCON if fibre optic it is also called FICON |
1420 | Was introduced by IBM in 1990. Has 2 fibre optic cables & uses either leds or lasers | 1434 | Was introduced by IBM in 1990. Has 2 fibre optic cables and uses either leds or |
1421 | for communication at a signaling rate of up to 200 megabits/sec. As 10bits are transferred | 1435 | lasers for communication at a signaling rate of up to 200 megabits/sec. As |
1422 | for every 8 bits info this drops to 160 megabits/sec & to 18.6 Megabytes/sec once | 1436 | 10bits are transferred for every 8 bits info this drops to 160 megabits/sec |
1423 | control info & CRC are added. ESCON only operates in burst mode. | 1437 | and to 18.6 Megabytes/sec once control info and CRC are added. ESCON only |
1438 | operates in burst mode. | ||
1424 | 1439 | ||
1425 | ESCONs typical max cable length is 3km for the led version & 20km for the laser version | 1440 | ESCONs typical max cable length is 3km for the led version and 20km for the |
1426 | known as XDF ( extended distance facility ). This can be further extended by using an | 1441 | laser version known as XDF (extended distance facility). This can be further |
1427 | ESCON director which triples the above mentioned ranges. Unlike Bus & Tag as ESCON is | 1442 | extended by using an ESCON director which triples the above mentioned ranges. |
1428 | serial it uses a packet switching architecture the standard Bus & Tag control protocol | 1443 | Unlike Bus & Tag as ESCON is serial it uses a packet switching architecture, |
1429 | is however present within the packets. Up to 256 devices can be attached to each control | 1444 | the standard Bus & Tag control protocol is however present within the packets. |
1430 | unit that uses one of these interfaces. | 1445 | Up to 256 devices can be attached to each control unit that uses one of these |
1446 | interfaces. | ||
1431 | 1447 | ||
1432 | Common 390 Devices include: | 1448 | Common 390 Devices include: |
1433 | Network adapters typically OSA2,3172's,2116's & OSA-E gigabit ethernet adapters, | 1449 | Network adapters typically OSA2,3172's,2116's & OSA-E gigabit ethernet adapters, |
1434 | Consoles 3270 & 3215 ( a teletype emulated under linux for a line mode console ). | 1450 | Consoles 3270 & 3215 (a teletype emulated under linux for a line mode console). |
1435 | DASD's direct access storage devices ( otherwise known as hard disks ). | 1451 | DASD's direct access storage devices ( otherwise known as hard disks ). |
1436 | Tape Drives. | 1452 | Tape Drives. |
1437 | CTC ( Channel to Channel Adapters ), | 1453 | CTC ( Channel to Channel Adapters ), |
1438 | ESCON or Parallel Cables used as a very high speed serial link | 1454 | ESCON or Parallel Cables used as a very high speed serial link |
1439 | between 2 machines. We use 2 cables under linux to do a bi-directional serial link. | 1455 | between 2 machines. |
1440 | 1456 | ||
1441 | 1457 | ||
1442 | Debugging IO on s/390 & z/Architecture under VM | 1458 | Debugging IO on s/390 & z/Architecture under VM |
@@ -1475,9 +1491,9 @@ or the halt subchannels | |||
1475 | or TR HSCH 7C08-7C09 | 1491 | or TR HSCH 7C08-7C09 |
1476 | MSCH's ,STSCH's I think you can guess the rest | 1492 | MSCH's ,STSCH's I think you can guess the rest |
1477 | 1493 | ||
1478 | Ingo's favourite trick is tracing all the IO's & CCWS & spooling them into the reader of another | 1494 | A good trick is tracing all the IO's and CCWS and spooling them into the reader |
1479 | VM guest so he can ftp the logfile back to his own machine.I'll do a small bit of this & give you | 1495 | of another VM guest so he can ftp the logfile back to his own machine. I'll do |
1480 | a look at the output. | 1496 | a small bit of this and give you a look at the output. |
1481 | 1497 | ||
1482 | 1) Spool stdout to VM reader | 1498 | 1) Spool stdout to VM reader |
1483 | SP PRT TO (another vm guest ) or * for the local vm guest | 1499 | SP PRT TO (another vm guest ) or * for the local vm guest |
@@ -1593,8 +1609,8 @@ undisplay : undo's display's | |||
1593 | 1609 | ||
1594 | info breakpoints: shows all current breakpoints | 1610 | info breakpoints: shows all current breakpoints |
1595 | 1611 | ||
1596 | info stack: shows stack back trace ( if this doesn't work too well, I'll show you the | 1612 | info stack: shows stack back trace (if this doesn't work too well, I'll show |
1597 | stacktrace by hand below ). | 1613 | you the stacktrace by hand below). |
1598 | 1614 | ||
1599 | info locals: displays local variables. | 1615 | info locals: displays local variables. |
1600 | 1616 | ||
@@ -1619,7 +1635,8 @@ next: like step except this will not step into subroutines | |||
1619 | stepi: steps a single machine code instruction. | 1635 | stepi: steps a single machine code instruction. |
1620 | e.g. stepi 100 | 1636 | e.g. stepi 100 |
1621 | 1637 | ||
1622 | nexti: steps a single machine code instruction but will not step into subroutines. | 1638 | nexti: steps a single machine code instruction but will not step into |
1639 | subroutines. | ||
1623 | 1640 | ||
1624 | finish: will run until exit of the current routine | 1641 | finish: will run until exit of the current routine |
1625 | 1642 | ||
@@ -1721,7 +1738,8 @@ e.g. | |||
1721 | outputs: | 1738 | outputs: |
1722 | $1 = 11 | 1739 | $1 = 11 |
1723 | 1740 | ||
1724 | You might now be thinking that the line above didn't work, something extra had to be done. | 1741 | You might now be thinking that the line above didn't work, something extra had |
1742 | to be done. | ||
1725 | (gdb) call fflush(stdout) | 1743 | (gdb) call fflush(stdout) |
1726 | hello world$2 = 0 | 1744 | hello world$2 = 0 |
1727 | As an aside the debugger also calls malloc & free under the hood | 1745 | As an aside the debugger also calls malloc & free under the hood |
@@ -1804,26 +1822,17 @@ man gdb or info gdb. | |||
1804 | core dumps | 1822 | core dumps |
1805 | ---------- | 1823 | ---------- |
1806 | What a core dump ?, | 1824 | What a core dump ?, |
1807 | A core dump is a file generated by the kernel ( if allowed ) which contains the registers, | 1825 | A core dump is a file generated by the kernel (if allowed) which contains the |
1808 | & all active pages of the program which has crashed. | 1826 | registers and all active pages of the program which has crashed. |
1809 | From this file gdb will allow you to look at the registers & stack trace & memory of the | 1827 | From this file gdb will allow you to look at the registers, stack trace and |
1810 | program as if it just crashed on your system, it is usually called core & created in the | 1828 | memory of the program as if it just crashed on your system. It is usually |
1811 | current working directory. | 1829 | called core and created in the current working directory. |
1812 | This is very useful in that a customer can mail a core dump to a technical support department | 1830 | This is very useful in that a customer can mail a core dump to a technical |
1813 | & the technical support department can reconstruct what happened. | 1831 | support department and the technical support department can reconstruct what |
1814 | Provided they have an identical copy of this program with debugging symbols compiled in & | 1832 | happened. Provided they have an identical copy of this program with debugging |
1815 | the source base of this build is available. | 1833 | symbols compiled in and the source base of this build is available. |
1816 | In short it is far more useful than something like a crash log could ever hope to be. | 1834 | In short it is far more useful than something like a crash log could ever hope |
1817 | 1835 | to be. | |
1818 | In theory all that is missing to restart a core dumped program is a kernel patch which | ||
1819 | will do the following. | ||
1820 | 1) Make a new kernel task structure | ||
1821 | 2) Reload all the dumped pages back into the kernel's memory management structures. | ||
1822 | 3) Do the required clock fixups | ||
1823 | 4) Get all files & network connections for the process back into an identical state ( really difficult ). | ||
1824 | 5) A few more difficult things I haven't thought of. | ||
1825 | |||
1826 | |||
1827 | 1836 | ||
1828 | Why have I never seen one ?. | 1837 | Why have I never seen one ?. |
1829 | Probably because you haven't used the command | 1838 | Probably because you haven't used the command |
@@ -1868,7 +1877,7 @@ Breakpoint 2 at 0x4d87a4: file top.c, line 2609. | |||
1868 | #3 0x5167e6 in readline_internal_char () at readline.c:454 | 1877 | #3 0x5167e6 in readline_internal_char () at readline.c:454 |
1869 | #4 0x5168ee in readline_internal_charloop () at readline.c:507 | 1878 | #4 0x5168ee in readline_internal_charloop () at readline.c:507 |
1870 | #5 0x51692c in readline_internal () at readline.c:521 | 1879 | #5 0x51692c in readline_internal () at readline.c:521 |
1871 | #6 0x5164fe in readline (prompt=0x7ffff810 "\177ÿøx\177ÿ÷Ø\177ÿøxÀ") | 1880 | #6 0x5164fe in readline (prompt=0x7ffff810) |
1872 | at readline.c:349 | 1881 | at readline.c:349 |
1873 | #7 0x4d7a8a in command_line_input (prompt=0x564420 "(gdb) ", repeat=1, | 1882 | #7 0x4d7a8a in command_line_input (prompt=0x564420 "(gdb) ", repeat=1, |
1874 | annotation_suffix=0x4d6b44 "prompt") at top.c:2091 | 1883 | annotation_suffix=0x4d6b44 "prompt") at top.c:2091 |
@@ -1929,8 +1938,8 @@ cat /proc/sys/net/ipv4/ip_forward | |||
1929 | On my machine now outputs | 1938 | On my machine now outputs |
1930 | 1 | 1939 | 1 |
1931 | IP forwarding is on. | 1940 | IP forwarding is on. |
1932 | There is a lot of useful info in here best found by going in & having a look around, | 1941 | There is a lot of useful info in here best found by going in and having a look |
1933 | so I'll take you through some entries I consider important. | 1942 | around, so I'll take you through some entries I consider important. |
1934 | 1943 | ||
1935 | All the processes running on the machine have their own entry defined by | 1944 | All the processes running on the machine have their own entry defined by |
1936 | /proc/<pid> | 1945 | /proc/<pid> |
@@ -2060,7 +2069,8 @@ if the device doesn't say up | |||
2060 | try | 2069 | try |
2061 | /etc/rc.d/init.d/network start | 2070 | /etc/rc.d/init.d/network start |
2062 | ( this starts the network stack & hopefully calls ifconfig tr0 up ). | 2071 | ( this starts the network stack & hopefully calls ifconfig tr0 up ). |
2063 | ifconfig looks at the output of /proc/net/dev & presents it in a more presentable form | 2072 | ifconfig looks at the output of /proc/net/dev and presents it in a more |
2073 | presentable form. | ||
2064 | Now ping the device from a machine in the same subnet. | 2074 | Now ping the device from a machine in the same subnet. |
2065 | if the RX packets count & TX packets counts don't increment you probably | 2075 | if the RX packets count & TX packets counts don't increment you probably |
2066 | have problems. | 2076 | have problems. |