Difference between revisions of "SysRq debugger"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Marked this version for translation)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<translate>
 +
<!--T:1-->
 
''SysRq debugger'' can help you to obtain some information from oops-ed kernel. This feature is available since 026test017 kernel.
 
''SysRq debugger'' can help you to obtain some information from oops-ed kernel. This feature is available since 026test017 kernel.
  
== Features ==
+
== Features == <!--T:2-->
 
''SysRq debugger'' can do one of the following:
 
''SysRq debugger'' can do one of the following:
 
# Dump memory at specified address
 
# Dump memory at specified address
Line 7: Line 9:
 
# Resolve symbol address by its name
 
# Resolve symbol address by its name
  
== How to use it ==
+
== How to use it == <!--T:3-->
 
To enter debug mode press ''SysRq-g''.
 
To enter debug mode press ''SysRq-g''.
 
After this the following commands will be available:
 
After this the following commands will be available:
Line 19: Line 21:
 
# ''SysRq-q'' - quit debugger
 
# ''SysRq-q'' - quit debugger
  
 +
<!--T:4-->
 
After entering ''-d'', ''-w'' or ''-r'' state you must enter address to work with (and the value you want to write if you do). Simply do this by pressing according keys while holding ''Alt-StsRq''.
 
After entering ''-d'', ''-w'' or ''-r'' state you must enter address to work with (and the value you want to write if you do). Simply do this by pressing according keys while holding ''Alt-StsRq''.
  
 +
<!--T:5-->
 
If you need to enter the upper case letter or the underbar (<code>_</code>) while typing a symbol name then you need to press and release ''shift'' and then the letter or minus (<code>-</code>).
 
If you need to enter the upper case letter or the underbar (<code>_</code>) while typing a symbol name then you need to press and release ''shift'' and then the letter or minus (<code>-</code>).
  
 +
<!--T:6-->
 
At the end press ''enter''.
 
At the end press ''enter''.
  
== Working with proc ==
+
== Working with proc == <!--T:7-->
There is a ''/proc/sysrq-trigger'' entry which triggers sysrq events.  
+
There is a <code>/proc/sysrq-trigger</code> entry which triggers sysrq events.  
You may send a string to it to trigger commands one by one.
+
You may write a string to it to trigger commands one by one.
There is one note about it - string must end with '<i>\r</i>' character.
+
There is one note: the string must end with the <code>\r</code> character.
  
== Examples ==
+
== Examples == <!--T:8-->
 
Here are some examples of how to use debugger
 
Here are some examples of how to use debugger
  
=== Dump memory ===
+
=== Dump memory === <!--T:9-->
 
<pre>
 
<pre>
 
# echo -n -e 'gd0xc0000000\rq' > /proc/sysrq-trigger
 
# echo -n -e 'gd0xc0000000\rq' > /proc/sysrq-trigger
Line 39: Line 44:
 
will dump memory region of 512 bytes
 
will dump memory region of 512 bytes
  
 +
<!--T:10-->
 
<pre>
 
<pre>
 
# echo -n -e 'gxq' > /proc/sysrq-trigger
 
# echo -n -e 'gxq' > /proc/sysrq-trigger
Line 44: Line 50:
 
will dump the next 512 bytes of memory
 
will dump the next 512 bytes of memory
  
=== Write to memory ===
+
=== Write to memory === <!--T:11-->
 
<pre>
 
<pre>
 
# echo -n -e 'gw0xc0000000-0x12345678\rq' > /proc/sysrq-trigger
 
# echo -n -e 'gw0xc0000000-0x12345678\rq' > /proc/sysrq-trigger
Line 50: Line 56:
 
will write ''0x12345678'' at ''0xc0000000''
 
will write ''0x12345678'' at ''0xc0000000''
  
=== Resolve symbol ===
+
=== Resolve symbol === <!--T:12-->
 
<pre>
 
<pre>
 
# echo -n -e 'grschedule\rq' > /proc/sysrq-trigger
 
# echo -n -e 'grschedule\rq' > /proc/sysrq-trigger
Line 56: Line 62:
 
will print you an address ''schedule()'' function starts from
 
will print you an address ''schedule()'' function starts from
  
 +
<!--T:13-->
 
<pre>
 
<pre>
 
# echo -n -e 'gxq' > /proc/sysrq-trigger
 
# echo -n -e 'gxq' > /proc/sysrq-trigger
Line 61: Line 68:
 
will dump first 512 bytes of it
 
will dump first 512 bytes of it
  
 +
<!--T:14-->
 
Note <i>''-n''</i> and <i>''-e''</i> keys to ''echo'' command.
 
Note <i>''-n''</i> and <i>''-e''</i> keys to ''echo'' command.
 +
</translate>
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 
[[Category:Kernel]]
 
[[Category:Kernel]]

Latest revision as of 08:37, 26 December 2015

<translate> SysRq debugger can help you to obtain some information from oops-ed kernel. This feature is available since 026test017 kernel.

Features[edit]

SysRq debugger can do one of the following:

  1. Dump memory at specified address
  2. Write arbitrary value to memory at specified address
  3. Resolve symbol address by its name

How to use it[edit]

To enter debug mode press SysRq-g. After this the following commands will be available:

  1. SysRq-d - dump memory
  2. SysRq-w - write to memory
  3. SysRq-r - resolve symbol
  4. SysRq-x - go on dumping memory
    • ... from the latest address dumped with -d
    • ... from the address you wrote to with -w
    • ... from the begginning of the symbol resolved with -r
  5. SysRq-q - quit debugger

After entering -d, -w or -r state you must enter address to work with (and the value you want to write if you do). Simply do this by pressing according keys while holding Alt-StsRq.

If you need to enter the upper case letter or the underbar (_) while typing a symbol name then you need to press and release shift and then the letter or minus (-).

At the end press enter.

Working with proc[edit]

There is a /proc/sysrq-trigger entry which triggers sysrq events. You may write a string to it to trigger commands one by one. There is one note: the string must end with the \r character.

Examples[edit]

Here are some examples of how to use debugger

Dump memory[edit]

# echo -n -e 'gd0xc0000000\rq' > /proc/sysrq-trigger

will dump memory region of 512 bytes

# echo -n -e 'gxq' > /proc/sysrq-trigger

will dump the next 512 bytes of memory

Write to memory[edit]

# echo -n -e 'gw0xc0000000-0x12345678\rq' > /proc/sysrq-trigger

will write 0x12345678 at 0xc0000000

Resolve symbol[edit]

# echo -n -e 'grschedule\rq' > /proc/sysrq-trigger

will print you an address schedule() function starts from

# echo -n -e 'gxq' > /proc/sysrq-trigger

will dump first 512 bytes of it

Note -n and -e keys to echo command. </translate>