All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Re: gdb and uml
       [not found] <20060426182144.71082.qmail@web31203.mail.mud.yahoo.com>
@ 2006-04-27 12:30 ` Blaisorblade
  0 siblings, 0 replies; 2+ messages in thread
From: Blaisorblade @ 2006-04-27 12:30 UTC (permalink / raw)
  To: Abhay Raghu; +Cc: user-mode-linux-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [uml-devel] Re: gdb and uml
       [not found] <20060501155706.28604.qmail@web31206.mail.mud.yahoo.com>
@ 2006-05-03 13:55 ` Blaisorblade
  0 siblings, 0 replies; 2+ messages in thread
From: Blaisorblade @ 2006-05-03 13:55 UTC (permalink / raw)
  To: Abhay Raghu; +Cc: user-mode-linux-devel

On Monday 01 May 2006 17:57, Abhay Raghu wrote:
> i) Can you please explain the difference between PTRACE_SYSCALL and
> PTRACE_SYSEMU?

Download latest man-pages (at least 2.27) and read man 2 ptrace; if something 
is not clear, I'll answer to your further doubts.

>   ii) This question is related to uml: How do all applications run within a
> single userspace thread?

Doing context switching is fairly easy: with ptrace you change all registers 
and so on. I guess you know that, if I'm wrong feel free to ask.

There is a further problem however: different apps have different address 
spaces, with different mappings (or different memory images, they're running 
different executables with different libraries... there are various way to 
say this).

To solve this problem, we introduce on the host the SKAS3 patch whihch allows 
one process to have multiple address spaces - only one is in use, but via 
ptrace(PTRACE_SWITCH_MM) we can replace that one with another one - this is 
done by making a pointer in the process descriptor (i.e. current in Linux 
kernel code) point to another "mapping set" (called struct mm_struct), so 
it's very fast; you must also invalidate the TLB (i.e. the processor caches 
of page table entries) like on any "memory context switching", obviously.
-- 
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

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-03 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20060426182144.71082.qmail@web31203.mail.mud.yahoo.com>
2006-04-27 12:30 ` [uml-devel] Re: gdb and uml Blaisorblade
     [not found] <20060501155706.28604.qmail@web31206.mail.mud.yahoo.com>
2006-05-03 13:55 ` Blaisorblade

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.