I am using gdb 5.0 client to debug kernel, and found a bug in gdb 5.0 when it
trys to display an function argument.
The following is the relavent code segment where breakpoint is set to the
first instruction of serial_console_write().
801270ac: 3c04801d lui $a0,0x801d
801270b0: 8c84bc1c lw $a0,-17380($a0)
801270b4: 27bdffc0 addiu $sp,$sp,-64
801270b8: afb40028 sw $s4,40($sp)
801270bc: 00a0a021 move $s4,$a1
801270c0: 24050001 li $a1,1
For whatever reason gdb client on the host side apparently thinks the second
arg is stored in register s4. When the breakpoint is hit, gdb tries to
display the value of s4 (which is 0x4 in this case). Since the type of this
argument is char *, gdb further tries to read the content at 0x4 which causes
I believe I have seen this problem before (and in most case the symptom is
wrong argument values instead of kernel panic). Does someone have an idea how
to fix it or work around it?
Does this problem exist in native debugging?
I assume we can disable gdb to display char strings by default. Does someone
know how to do it?