From: Blaisorblade <blaisorblade@yahoo.it>
To: Abhay Raghu <abhay_raghu@yahoo.com>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] Re: gdb and uml
Date: Thu, 27 Apr 2006 14:30:17 +0200 [thread overview]
Message-ID: <200604271430.18184.blaisorblade@yahoo.it> (raw)
In-Reply-To: <20060426182144.71082.qmail@web31203.mail.mud.yahoo.com>
On Wednesday 26 April 2006 20:21, Abhay Raghu wrote:
> Hello
>
> I have been able to debug uml by directly launching it and debugging it
> with gdb. Could you explain how this works since both uml and gdb use
> ptrace?
In SKAS mode, UML "kernel" thread ptraces via PTRACE_SYSCALL (or the special
PTRACE_SYSEMU, ask for the difference if interested) one "userspace" thread,
where all application code is executed - the userspace thread runs normally
until a syscall is executed - that syscall is intercepted and executed by
UML. You see the "userspace" thread with status "T" in the "ps auxw" output.
In this picture, gdb ptraces the "kernel" thread - so it can possibly step
over a ptrace call done on the other thread, but that is not a problem. All
the kernel code is in the "kernel" thread so gdb'ing it simply works.
In TT mode (which however is currently becoming obsolete), instead, the
picture is more complicate. There one thread, the tracing thread, ptraces
various thread (one per guest process) which execute either the application
code or the kernel code; when a syscall is done by a guest process, the
tracing thread modifies the registers for the host thread representing that
process so that it resumes executing UML code.
So, you could ptrace the tracing thread, but that's of little interest
normally since it doesn't execute any kernel code. A special mechanism is
needed, i.e. the ptrace proxy (which seems to be born for use outside UML and
then incorporated): I don't know well the detail but IIRC gdb is ptraced and
the results of his ptrace syscalls are modified, so that it sees what is
happening in threads other than the tracing one.
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next parent reply other threads:[~2006-04-27 12:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060426182144.71082.qmail@web31203.mail.mud.yahoo.com>
2006-04-27 12:30 ` Blaisorblade [this message]
[not found] <20060501155706.28604.qmail@web31206.mail.mud.yahoo.com>
2006-05-03 13:55 ` [uml-devel] Re: gdb and uml Blaisorblade
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=200604271430.18184.blaisorblade@yahoo.it \
--to=blaisorblade@yahoo.it \
--cc=abhay_raghu@yahoo.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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).