On 10/8/2014 4:21 AM, joaoandrefe...@sapo.pt wrote: > Citando Frank Rowand <frowand.l...@gmail.com>: > >> On 10/7/2014 1:27 PM, Frank Rowand wrote:
< snip > >> >> Here is an example, where I am using a USB serial port to connect between >> my host and target. I did all of the commands in "host window 1" before >> I did the commands in "host window 2". I did all of the commands in >> "host window 2" before I did the commands in "host window 3". >> >> >> ---------------------- HOST -------------------------------------- >> --- TARGET --- >> >> terminal <----> /dev/pty/29 <----> +------+ >> emulator | | >> | kdmx | <----> serial port <== >> cable ==> target console >> gdb <---------> /dev/pty/53 <----> | | /dev/ttyUSB0 >> +------+ >> >> >> >> ----- host window 1 - kdmx ----- >> >> $ export PS1='[1]: ' >> [1]: ./kdmx -n -d -p/dev/ttyUSB0 -b115200 >> serial port: /dev/ttyUSB0 >> Initalizing the serial port to 115200 8n1 >> /dev/pts/29 is slave pty for for terminal emulator >> /dev/pts/53 is slave pty for gdb >> >> >> ----- host window 2 - terminal emulator ----- >> # In this example, I am using the sysrq debug command instead of the >> # kernel command line 'kgdbwait' option to enter kgdb >> >> $ export PS1='[2]: ' >> [2]: minicom -o -w -p /dev/pts/29 >> >> # Now in minicom, connected to the target console. >> # CONFIG_PRINTK_TIME=y, so timestamps will be added to >> # printk() messages to the console. # I left these minicom messages out before. Adding now so you can # compare your minicom to mine. Welcome to minicom 2.5 OPTIONS: I18n Compiled on May 2 2011, 10:05:24. Port /dev/tty8 Press CTRL-A Z for help on special keys >> >> $ export PS1='% ' >> % cat /proc/version >> Linux version 3.17.0-dirty (frank@ussvlx) (gcc version 4.6.x-google 20120106 >> (prerelease) (GCC) ) #1 SMP PREEMPT Mon Oct 6 10:19:37 PDT 2014 >> % echo g >/proc/sysrq-trigger >> [ 24.246292] SysRq : DEBUG >> [ 24.247184] Entering KGDB >> >> >> ----- host window 3 - gdb ----- >> # current directory is the root of the kernel source tree >> >> $ export PS1='[3]: ' >> [3]: hostname >> ussvlx >> [3]: whoami >> frank >> [3]: pwd >> /xxx/git_linus/linux--3.17 >> [3]: echo $KBUILD_OUTPUT >> ../build/dragon_linus_3.17 >> [3]: strings $KBUILD_OUTPUT/vmlinux | grep "^Linux version" >> Linux version 3.17.0-dirty (frank@ussvlx) (gcc version 4.6.x-google 20120106 >> (prerelease) (GCC) ) #1 SMP PREEMPT Mon Oct 6 10:19:37 PDT 2014 >> Linux version >> [3]: gdb $KBUILD_OUTPUT/vmlinux >> GNU gdb (GDB) 7.3.1-gg2 >> Copyright (C) 2011 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> >> This is free software: you are free to change and redistribute it. >> There is NO WARRANTY, to the extent permitted by law. Type "show copying" >> and "show warranty" for details. >> This GDB was configured as "--host=x86_64-linux-gnu >> --target=arm-linux-android". >> For bug reporting instructions, please see: >> <http://www.gnu.org/software/gdb/bugs/>... >> Reading symbols from /xxx/git_linus/build/dragon_linus_3.17/vmlinux...done. >> (gdb) target remote /dev/pts/53 >> Remote debugging using /dev/pts/53 >> kgdb_breakpoint () >> at /xxx/git_linus/linux--3.17/kernel/debug/debug_core.c:1050 >> 1050 arch_kgdb_breakpoint(); >> (gdb) b sys_sync >> Breakpoint 1 at 0xc031d450: file /xxx/git_linus/linux--3.17/fs/sync.c, line >> 103. >> (gdb) c >> Continuing. >> > > What a great clarification, Frank. However, I'm having trouble (at least) with > minicom. I've never used it, so I've installed, created the configuration file > with "minicom -s" and changed the "serial port setup" -> "serial device" > option > to /dev/ttyS0 You will not be connecting minicom to /dev/ttyS0, you will be connecting to /dev/pts/1. dev/pts/1 is the pty that kdmx reports that it is providing for the terminal emulator in your example below. The exact pty number may change when you run kdmx multiple times, or if you terminate and restart your terminal emulator or gdb. kdmx will report the pty number every time it changes. You did specify the pty numbers correctly in your example below. > >>> Host window #1 (kdmx): > > $ ./kdmx -n -d -p /dev/ttyS0 -b 115200 > serial port: /dev/ttyS0 > Initalizing the serial port to 115200 8n1 > /dev/pts/1 is slave pty for for terminal emulator > /dev/pts/3 is slave pty for gdb > > (now I removed "kgdbwait" from the boot configuration file, to allow the > target system to boot till the end without needing to send the "cont" command > from GDB, and the I rebooted the target) > >>> Host window #2 (minicom): > > $ minicom -o -w -p /dev/pts/1 > Welcome to minicom 2.3 > > OPTIONS: I18n > Compiled on Aug 19 2010, 05:48:57. > Port /dev/ttyS0 Despite minicom reporting "Port /dev/ttyS0", the port should actually be the /dev/pts/1 that you specified with the -p option. My minicom is version 2.5, yours is 2.3. I do not know if that makes any difference. > > Press CTRL-A Z for help on special keys > > > So, it seems minicom is initialized correctly, however despite seeing the > cursor of the terminal, if I try to insert commands on it nothing will > change / happen (I can't even see the commands I'm trying to type appearing > in the screen). Pressing CTRL+A Z brings me the menu with options, but after If minicom is not communicating through kdmx to the target, then you can not move on to the next step (kgdb) if you are using the /proc/sysrq-trigger method to enable kgdb. You can turn on some kdmx debug options to have it print out the data that it sends and receives. -DtT will show all traffic between kdmx and the terminal emulator. I would start with this to make sure that minicom and kdmx are communicating. -DsS will show all traffic between kdmx and the serial port to the target. If -DtT showed proper communication, then I would then use this option. You can turn on both terminal emulator traffic and serial port traffic at the same time, but the debug output format then becomes very ugly and hard to read. I normally just turn on -DsS. (You can also use -DgG to show all traffic between kdmx and gdb.) I will attach examples of using the debug options at the end of this email. > trying almost all of them and searching for minicom tutorials online, I'm > not progressing on this. Sorry for this (another) rookie doubt, I'm also on > a race against time but I can't seem to figure this out. > >>> Host window #3 (GDB): > > GDB seemed to be running good before (using kdmx, when connecting directly to > /dev/ttyS0), now is giving the errors below. > > (at kernel source tree): > > $ gdb /boot/vmlinux > GNU gdb (GDB) Red Hat Enterprise Linux (7.2-64.el6_5.2) > Copyright (C) 2010 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "i686-redhat-linux-gnu". > For bug reporting instructions, please see: > <http://www.gnu.org/software/gdb/bugs/>... > Reading symbols from /boot/vmlinux...done. > (gdb) set remotebaud 115200 > (gdb) target remote /dev/pts/3 You can not use the target remote command until the "Entering KGDB" message prints on the console. This message is the result of either the kgdbwait kernel command line option, or echoing the "g" debug command to /proc/sysrq-trigger (see "host window 2 - terminal emulator" in my example above). What is probably happening here is that gdb is talking to the shell on the target. You can see this if you use either -DsS or -DgG as a kdmx option. > Remote debugging using /dev/pts/3 > Ignoring packet error, continuing... > warning: unrecognized item "timeout" in "qSupported" response > Ignoring packet error, continuing... > > > Many, many thanks. > João < snip > Examples of using the kdmx debug options: # ---------- example 1 - terminal emulator # in minicom, typed: echo "test -DtT" [1]: ./kdmx -n -d -p/dev/ttyUSB0 -b115200 -DtT serial port: /dev/ttyUSB0 Initalizing the serial port to 115200 8n1 /dev/pts/58 is slave pty for for terminal emulator /dev/pts/59 is slave pty for gdb t> e t< e t> c t< c t> h t< h t> o t< o t> t< t> " t< " t> t t< t t> e t< e t> s t< s t> t t< t t> t< t> - t< - t> D t< D t> t t< t t> T t< T t> " t< " t> 0x0d t< 0x0d 0x0a test -DtT 0x0d 0x0a % # ---------- example 2 - serial port # in minicom, typed: echo "test -DsS" [1]: ./kdmx -n -d -p/dev/ttyUSB0 -b115200 -DsS serial port: /dev/ttyUSB0 Initalizing the serial port to 115200 8n1 /dev/pts/58 is slave pty for for terminal emulator /dev/pts/59 is slave pty for gdb s> e s< e s> c s< c s> h s< h s> o s< o s> s< s> " s< " s> t s< t s> e s< e s> s s< s s> t s< t s> s< s> - s< - s> D s< D s> s s< s s> S s< S s> " s< " s> 0x0d s< 0x0d 0x0a test -DsS 0x0d 0x0a % # ---------- example 3 - terminal emulator and serial port # in minicom, typed: echo "test -DtT -DsS" [1]: ./kdmx -n -d -p/dev/ttyUSB0 -b115200 -DtT -DsS serial port: /dev/ttyUSB0 Initalizing the serial port to 115200 8n1 /dev/pts/58 is slave pty for for terminal emulator /dev/pts/59 is slave pty for gdb t> e s> e s< e t< e t> c s> c s< c t< c t> h s> h s< h t< h t> o s> o s< o t< o t> s> s< t< t> " s> " s< " t< " t> t s> t s< t t< t t> e s> e s< e t< e t> s s> s s< s t< s t> t s> t s< t t< t t> s> s< t< t> - s> - s< - t< - t> D s> D s< D t< D t> t s> t s< t t< t t> T s> T s< T t< T t> s> s< t< t> - s> - s< - t< - t> D s> D s< D t< D t> s s> s s< s t< s t> S s> S s< S t< S t> " s> " s< " t< " t> 0x0d s> 0x0d s< 0x0d t< 0x0d s< 0x0a t< 0x0a s< t t< t s< e t< e s< s t< s s< t t< t s< t< s< - t< - s< D t< D s< t t< t s< T t< T s< t< s< - t< - s< D t< D s< s t< s s< S t< S s< 0x0d t< 0x0d s< 0x0a t< 0x0a s< % t< % s< t< # ---------- example 4 - serial port, connecting gdb to target # in minicom, typed: echo g >/proc/sysrq-trigger # then in gdb, typed: target remote /dev/pts/59 # c # then in minicom, typed: echo "target running again" # # There is some additional output to the console while typing # 'echo "target running again"' in minicom. That is just a # coincidence. # # The gdb conversation will be different for your target because # my target is ARM instead of x86. [1]: ./kdmx -n -d -p/dev/ttyUSB0 -b115200 -DsS serial port: /dev/ttyUSB0 Initalizing the serial port to 115200 8n1 /dev/pts/58 is slave pty for for terminal emulator /dev/pts/59 is slave pty for gdb s> 0x0d s< 0x0d 0x0a % s> e s< e s> c s< c s> h s< h s> o s< o s> s< s> g s< g s> s< s> > s< > s> / s< / s> p s< p s> r s< r s> o s< o s> c s< c s> / s< / s> s s< s s> y s< y s> s s< s s> r s< r s> q s< q s> - s< - s> t s< t s> r s< r s> i s< i s> g s< g s> g s< g s> e s< e s> r s< r s> 0x0d s< 0x0d 0x0a [68806.702614] SysRq : DEBUG 0x0d 0x0a $T05thread:01;#07 s> +$qSupported:qRelocInsn+#9a s< +$#00 s> +$Hg0#df s< +$OK#9a s> +$?#3f s< +$S05#b8 s> +$Hc-1#09 s< +$OK#9a s> +$qC#b4 s< +$QC01#f5 s> +$qAttached#8f s< +$#00 s> +$qOffsets#4b s< +$#00 s> +$g#67 s< +$670000001300006000000000000000000079a2c00479a2c044649ac0070000000000000000000000000000000200000000000000107f05ee8c084fc0446928c000000000000000000000000000000000000000000000000000000000000000000000000000000000#40 s> +$mc0286944,4#a1 s< +$ffdeffe7#fd s> +$qSymbol::#5b s< +$#00 s> +$qTStatus#49 s< +$#00 s> +$vCont?#49 s< +$#00 s> +$Hc0#db s< +$OK#9a s> +$c#63 s< +% s> e s< e s> c s< c s> h s< h s> o s< o s> s< s> " s< " s> t s< t s> a s< a s> r s< r s> g s< g s> e s< e s> t s< t s> s< s> r s< r s> u s< u s> n s< [68874.464105] random: nonblocking pool is initialized 0x0d 0x0a n s> n s< n s> i s< i s> n s< n s> g s< g s> s< s> a s< a s> g s< g s> a s< a s> i s< i s> n s< n s> " s< " s> 0x0d s< 0x0d 0x0a target running again 0x0d 0x0a % ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ Kgdb-bugreport mailing list Kgdb-bugreport@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport