linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Joseph Barrow <D.Barow@option.com>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: KGDB Mailing List <kgdb-bugreport@lists.sourceforge.net>,
	linux-kernel@vger.kernel.org, gareth@valinux.com,
	markus.t.metzger@intel.com
Subject: Re: getting false SIGTRAP breakpoints in kernel i.e. kernel hung unless gdb remotely attached on x86 & cont is issued
Date: Fri, 19 Sep 2008 15:35:44 +0200	[thread overview]
Message-ID: <48D3AAB0.3010504@option.com> (raw)
In-Reply-To: <48D3A1B4.8000505@windriver.com>

Sorry sorry Jason,
Better wipe the cobwebs gathering in my brain.
I just realised that your program is behaving perfectly.
The code I was testing will suspend in the read syscall forever
because it has no bytes to read,
I now also tested it with code that doesn't suspend & it works
perfectly.

The patch gets my full blessing even if my blessing is unimportant.

Jason Wessel wrote:
> Denis Joseph Barrow wrote:
>> Hi Jason,
>> Sorry for nitpicking & a big thanks for your patch.
>> While this patch stops the big problem, the kernel halting, gdb
>> debugging the userland code still doesn't behave correctly
>> now. Trying to stepi over a sysenter call in gdb doesn't return
>> to the gdb debugger ctrl-c in the debugger still works however.
>> Some code probably needs to be also fixed in arch/x86/kernel/ptrace.c
>> or ideally the generic kernel/ptrace.c, seeing as this works
>> with gdb on a normal kernel it's not a gdb issue even if
>> it can be kludge fixed there.
>> I'm running GNU gdb 6.8-debian from ubuntu 8.04 hardy heron
>>
>>
> 
> The patch I sent is not yet included the kgdb stream because I was
> waiting for further comment.  I do not see any issues however in the
> case that you describe, so I will describe how I tested it and then
> perhaps you can explain further the case that does not work.
> 
> Given that I still had your test program, I used it to set a
> breakpoint at read(), after performing an attach as you described
> previous with attaching to the running process.  At this point kgdboc
> is loaded and configured.
> 
> gdb commands:
> 
> att PID_OF_randsleep
> break read
> continue
> 
> At this point to hit the breakpoint, I had to type some input on the
> ttyS0 which randsleep where randsleep was connected.  At that point I
> was able to step the system call with enough "si" commands.  In the
> example shown below I did have to provide some more input after the
> "si" for address 0xffffe419 so that the system call would come out of
> the sleep state because it happened to be a blocking read.
> 
> Example:
> (gdb) continue
> Continuing.
> 
> Breakpoint 1, 0x08056b30 in read ()
> (gdb) si
> 0x08056b38 in read ()
> (gdb)
> 0x08056b3a in __read_nocancel ()
> (gdb)
> 0x08056b3b in __read_nocancel ()
> (gdb)
> 0x08056b3f in __read_nocancel ()
> (gdb)
> 0x08056b43 in __read_nocancel ()
> (gdb)
> 0x08056b47 in __read_nocancel ()
> (gdb)
> 0x08056b4c in __read_nocancel ()
> (gdb)
> 0xffffe414 in __kernel_vsyscall ()
> (gdb) disas $pc $pc+8
> Dump of assembler code from 0xffffe414 to 0xffffe41c:
> 0xffffe414 <__kernel_vsyscall+0>:       push   %ecx
> 0xffffe415 <__kernel_vsyscall+1>:       push   %edx
> 0xffffe416 <__kernel_vsyscall+2>:       push   %ebp
> 0xffffe417 <__kernel_vsyscall+3>:       mov    %esp,%ebp
> 0xffffe419 <__kernel_vsyscall+5>:       sysenter
> 0xffffe41b <__kernel_vsyscall+7>:       nop  
> End of assembler dump.
> (gdb) si
> 0xffffe415 in __kernel_vsyscall ()
> (gdb)
> 0xffffe416 in __kernel_vsyscall ()
> (gdb)
> 0xffffe417 in __kernel_vsyscall ()
> (gdb)
> 0xffffe419 in __kernel_vsyscall ()
> (gdb)
> 0xffffe424 in __kernel_vsyscall ()
> (gdb)
> 
> 
> At least this case appears to work fine with or without kgdb
> loaded.  Perhaps you have a different case you can describe?
> 
> Thanks,
> Jason.
> 
> 
> 
> 
> 


-- 
best regards,
D.J. Barrow

  reply	other threads:[~2008-09-19 13:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-17 13:47 getting false SIGTRAP breakpoints in kernel i.e. kernel hung unless gdb remotely attached on x86 & cont is issued Denis Joseph Barrow
2008-09-17 13:55 ` Jason Wessel
2008-09-17 14:20   ` Denis Joseph Barrow
2008-09-18 14:53     ` Jason Wessel
2008-09-19 12:31       ` Denis Joseph Barrow
2008-09-19 12:57         ` Jason Wessel
2008-09-19 13:35           ` Denis Joseph Barrow [this message]
2008-09-19 19:38             ` Jason Wessel
2008-09-17 15:40   ` Denis Joseph Barrow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D3AAB0.3010504@option.com \
    --to=d.barow@option.com \
    --cc=gareth@valinux.com \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus.t.metzger@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).