I had enabled a non-atomic KGDB. It can be used to debug driver with socket 
interface. The limitation is that it cannot break the kernel in interrupt and 
atomic context. 
Here is the theory.
        1. enable kprobe
        2. add kprobe at break instruction. It needs to hack kprobe function to 
ignore ins boundary checking.
        3. hack the kprobe die notification priority. Add a hack function 
before int 3 die notification. The hack function save the pt_regs and hack the 
return ip register to gdb stub server fuction.
        4. after gdb stub server return, hack the return ip and jump back to 
kprobe function. Restore the pt_regs.
        All hack functions use "kallsyms_lookup_name" to find the address and 
modify the original value dynamically. 
        
The attachment is a prototype version. It can connect to gdb and set 
breakpointer inside kernel.
The code is very ugly. And I believe lots of potential bugs inside. Just share 
my idea :)

Steps to try it:
        1. enable kprobe in your kernel config
        2. modify Makefile base on your kernel src code patch.
        3. make it. Copy dcmd    dcmd_gdb    dcmd_target.sh to your board.
        3. run dcmd_target.sh. type command "gdb"
        5. connect gdb to kernel through ip: 7321

Bin

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Arjan van de Ven
Sent: Sunday, February 13, 2011 1:09 AM
To: Tom
Cc: [email protected]
Subject: Re: [Meego-kernel] KGDB

On 2/12/2011 4:34 AM, Tom wrote:
> Hi,
>
> With no Serial Port available on the MRST CDK, I plan to use a USB to 
> serial conveter ( USB on the MRST ) and Serial on the HOST machine to 
> debug a driver issue.
> Has anyone worked on a similar approach?

we normally just use the serial port that comes with the CDK....

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel
BLOCKED FILE ALERTA file has been blocked due to the 'Intel Email File 
Filtering Policy' rule.Context: 'run.sh'Disallowed due to Ticket Number: 
'0b9c-4d56-c4ad-0001'

----------------------------------------

BLOCKED FILE ALERTA file has been blocked due to the 'Intel Email File 
Filtering Policy' rule.Context: 'dcmd_target.sh'Disallowed due to Ticket 
Number: '0b9c-4d56-c4ad-0001'
See your system administrator for further information. Copyright 1999-2007 
McAfee, Inc.All Rights Reserved.http://www.mcafee.com
_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to