/[gentoo]/xml/htdocs/doc/en/draft/debugging-howto.xml
Gentoo

Diff of /xml/htdocs/doc/en/draft/debugging-howto.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.3 Revision 1.4
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/draft/debugging-howto.xml,v 1.3 2005/07/14 09:42:27 swift Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/draft/debugging-howto.xml,v 1.4 2005/07/14 09:54:37 fox2mike Exp $ -->
4 4
5<guide link="/doc/en/debugging-howto.xml"> 5<guide link="/doc/en/debugging-howto.xml">
6<title>Gentoo Linux Debugging Guide</title> 6<title>Gentoo Linux Debugging Guide</title>
7 7
8<author title="Author"> 8<author title="Author">
421<section> 421<section>
422<title>dmesg Introduction</title> 422<title>dmesg Introduction</title>
423<body> 423<body>
424 424
425<p> 425<p>
426<c>dmesg</c> is a system program created with debugging kernel operation. It 426<c>dmesg</c> is a system program created with debugging kernel operation. It
427basically reads the kernel messages and keeps them in buffer, letting the user 427basically reads the kernel messages and keeps them in buffer, letting the user
428see them later on. Here's an example of what a dmesg output looks like: 428see them later on. Here's an example of what a dmesg output looks like:
429</p> 429</p>
430 430
431<pre caption="dmesg sample output"> 431<pre caption="dmesg sample output">
432SIS5513: IDE controller at PCI slot 0000:00:02.5 432SIS5513: IDE controller at PCI slot 0000:00:02.5
433SIS5513: chipset revision 208 433SIS5513: chipset revision 208
461libata version 1.11 loaded. 461libata version 1.11 loaded.
462usbmon: debugs is not available 462usbmon: debugs is not available
463</pre> 463</pre>
464 464
465<p> 465<p>
466The dmesg displayed here is my machine's bootup. You can see harddrives and 466The dmesg displayed here is my machine's bootup. You can see the hard disks and
467input devices being initialized. While what you see here seems relatively 467input devices being initialized. While what you see here seems relatively
468harmless, <c>dmesg</c> is also good at showing when things go wrong. Let's take 468harmless, <c>dmesg</c> is also good at showing when things go wrong. Let's take
469for example an IPAQ 1945 I have. After a couple of minutes of inactivity, the 469for example an IPAQ 1945 I have. After a couple of minutes of inactivity, the
470device powers off. Now, I have the device connected into the USB port in the 470device powers off. Now, I have the device connected into the USB port in the
471front of my system. Now, I want to copy over some files using libsynCE, so I go 471front of my system. Now, I want to copy over some files using libsynCE, so I go
472ahead and initiate a connection: 472ahead and initiate a connection:
473</p> 473</p>
474 474
475<pre caption="IPAQ connection attempt"> 475<pre caption="IPAQ connection attempt">
476# <i>synce-serial-start</i> 476# <i>synce-serial-start</i>
482 482
483<p> 483<p>
484The connection fails, as we see here, and we assume that only the screen is in 484The connection fails, as we see here, and we assume that only the screen is in
485powersave mode, and that maybe the connection is faulty. In order to see what 485powersave mode, and that maybe the connection is faulty. In order to see what
486truly happened, we can use <c>dmesg</c>. Now, <c>dmesg</c> tends to give a 486truly happened, we can use <c>dmesg</c>. Now, <c>dmesg</c> tends to give a
487rather large ammount of output. One can use the <c>tail</c> command to help 487rather large ammount of output. One can use the <c>tail</c> command to help
488keep the output down: 488keep the output down:
489</p> 489</p>
490 490
491<pre caption="Adjusting the output ammount with tail"> 491<pre caption="Adjusting the output ammount with tail">
492$ <i>dmesg | tail -n 4</i> 492$ <i>dmesg | tail -n 4</i>
495PocketPC PDA ttyUSB0: PocketPC PDA converter now disconnected from ttyUSB0 495PocketPC PDA ttyUSB0: PocketPC PDA converter now disconnected from ttyUSB0
496ipaq 1-1.2:1.0: device disconnected 496ipaq 1-1.2:1.0: device disconnected
497</pre> 497</pre>
498 498
499<p> 499<p>
500This gives us the last 4 lines of the dmesg output. Now, this is enough to give 500This gives us the last 4 lines of the <c>dmesg</c> output. Now, this is enough
501us some information on the situation. It seems that in the first 2 lines, the 501to give us some information on the situation. It seems that in the first 2
502pocketpc is recognized as connected. However, in the last 2 lines, it appears 502lines, the pocketpc is recognized as connected. However, in the last 2 lines, it
503to have been disconnected. With this information we check the pocketpc again, 503appears to have been disconnected. With this information we check the pocketpc
504and find out it is powered off, and now know about the powersave mode. We can 504again, and find out it is powered off, and now know about the powersave mode. We
505use this information to turn the feature off, or be aware of it next time. 505can use this information to turn the feature off, or be aware of it next time.
506While this is a somewhat simple example, it does go to show how well dmesg can 506While this is a somewhat simple example, it does go to show how well
507work. However, in more complex examples (such as kernel bugs), the entire dmesg 507<c>dmesg</c> can work. However, in more complex examples (such as kernel bugs),
508output may be required. To obtain that, simple redirect to a log file as such: 508the entire <c>dmesg</c> output may be required. To obtain that, simple redirect
509to a log file as such:
509</p> 510</p>
510 511
511<pre caption="Saving dmesg output to a log"> 512<pre caption="Saving dmesg output to a log">
512$ <i>dmesg > dmesg.log</i> 513$ <i>dmesg > dmesg.log</i>
513</pre> 514</pre>

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.20