From: Caz Yokoyama <cazyokoyama@gmail.com>
To: 'Keir Fraser' <keir.fraser@eu.citrix.com>, xen-devel@lists.xensource.com
Subject: RE: [PATCH] fix the bug of gdb which debugs xen.
Date: Wed, 12 Aug 2009 14:03:09 -0700 [thread overview]
Message-ID: <503CADCC055C4722B7AB00CF57C62B5C@xpjpn> (raw)
In-Reply-To: <C6A8824E.11EBE%keir.fraser@eu.citrix.com>
[-- Attachment #1: Type: text/plain, Size: 4160 bytes --]
Probably, you mean.
diff -r 8a9f81672c76 xen/common/gdbstub.c
--- a/xen/common/gdbstub.c Wed Aug 12 14:27:52 2009 +0100
+++ b/xen/common/gdbstub.c Wed Aug 12 14:00:20 2009 -0700
@@ -127,7 +127,7 @@
x <<= 8;
x += str2hex(*str);
#elif defined(__LITTLE_ENDIAN)
- x += (unsigned long)str2hex(*str) << (i*8);
+ x += (unsigned long)str2hex(str) << (i*8);
#else
# error unknown endian
#endif
-caz
-----Original Message-----
From: Keir Fraser [mailto:keir.fraser@eu.citrix.com]
Sent: Wednesday, August 12, 2009 6:30 AM
To: Caz Yokoyama; xen-devel@lists.xensource.com
Subject: Re: [Xen-devel] [PATCH] fix the bug of gdb which debugs xen.
I rewrote it some more. Take a look at changeset 20054.
-- Keir
On 12/08/2009 13:52, "Caz Yokoyama" <cazyokoyama@gmail.com> wrote:
> Hello Keir,
> You are right and good points. Thank you. I did not aware them because
only
> environment I test is x86_64. How about this? I am glad if you check in. I
> regularly update my local source code by "hg pull; hg up".
> -caz
>
> -----Original Message-----
> From: Keir Fraser [mailto:keir.fraser@eu.citrix.com]
> Sent: Wednesday, August 12, 2009 12:58 AM
> To: Caz Yokoyama; xen-devel@lists.xensource.com
> Subject: Re: [Xen-devel] [PATCH] fix the bug of gdb which debugs xen.
>
> I don't know whether you intend this for immediate checkin, but anyway:
>
> * Don't delete the sysenter logic in traps.c, leave it.
> * I'm not sure about swap64() in gdbstub.c. The value may not be 64 bits
> (e.g., running on i386), or the system may not be little endian. Might be
> better to define an alternative to str2ulong() which is endian aware, like
> gdb_write_to_packet_hex().
>
> -- Keir
>
> On 12/08/2009 03:15, "Caz Yokoyama" <cazyokoyama@gmail.com> wrote:
>
>> Hello,
>> This patch fixes the bug of gdb which debugs Xen hypervisor, i.e. not
> domU. As
>> Emre Can Sezer reported in
>> http://lists.xensource.com/archives/html/xen-devel/2009-01/msg00885.html,
> once
>> break point is hit, continue command produces SIGTRAP at
> restore_all_xen().
>> This patch makes continue command resume Xen running. I still see other
> bugs
>> like backtrace command does not show function name. But I hope this helps
> your
>> debug.
>> FYI, related postings.
>> http://lists.xensource.com/archives/html/xen-devel/2007-12/msg00678.html
>>
>
http://www.filewatcher.com/p/xen_2.0.6.orig.tar.gz.2456215/xen-2.0/docs/misc
> /X
>> enDebugger-HOWTO.html
>>
>> connect gdb on step command
>> --- a/xen/arch/x86/traps.c Thu Aug 06 13:27:53 2009 +0100
>> +++ b/xen/arch/x86/traps.c Tue Aug 11 18:15:25 2009 -0700
>> @@ -2977,13 +2977,7 @@
>> if ( regs->eflags & EF_TF )
>> {
>> #ifdef __x86_64__
>> - void sysenter_entry(void);
>> - void sysenter_eflags_saved(void);
>> - /* In SYSENTER entry path we can't zap TF until EFLAGS is
> saved.
>> */
>> - if ( (regs->rip >= (unsigned long)sysenter_entry) &&
>> - (regs->rip < (unsigned long)sysenter_eflags_saved) )
>> - goto out;
>> - WARN_ON(regs->rip != (unsigned long)sysenter_eflags_saved);
>> + debugger_trap_fatal(TRAP_debug, regs);
>> #else
>> WARN_ON(1);
>> #endif
>>
>> Value of gdb command is little endian.
>> diff -r 13fe7f07df15 xen/common/gdbstub.c
>> --- a/xen/common/gdbstub.c Thu Aug 06 13:27:53 2009 +0100
>> +++ b/xen/common/gdbstub.c Tue Aug 11 18:15:25 2009 -0700
>> @@ -53,6 +53,10 @@
>>
>> #define GDB_RETRY_MAX 10
>>
>> +#define swap16(_v) ((((u16)(_v)>>8)&0xff)|(((u16)(_v)&0xff)<<8))
>> +#define swap32(_v)
>> (((u32)swap16((u16)(_v))<<16)|(u32)swap16((u32)((_v)>>16)))
>> +#define swap64(_v)
>> (((u64)swap32((u32)(_v))<<32)|(u64)swap32((u32)((_v)>>32)))
>> +
>> struct gdb_cpu_info
>> {
>> atomic_t paused;
>> @@ -489,6 +493,7 @@
>> }
>> ptr++;
>> val = str2ulong(ptr, sizeof(unsigned long));
>> + val = swap64(val);
>> gdb_arch_write_reg(addr, val, regs, ctx);
>> break;
>> case 'D':
>>
>> Thank you.
>> -Caz Yokoyama, caz at caztech dot com. 503-804-1028(m).
>>
>>
>
[-- Attachment #2: str_to_native_ulong.patch --]
[-- Type: application/octet-stream, Size: 413 bytes --]
diff -r 8a9f81672c76 xen/common/gdbstub.c
--- a/xen/common/gdbstub.c Wed Aug 12 14:27:52 2009 +0100
+++ b/xen/common/gdbstub.c Wed Aug 12 14:00:20 2009 -0700
@@ -127,7 +127,7 @@
x <<= 8;
x += str2hex(*str);
#elif defined(__LITTLE_ENDIAN)
- x += (unsigned long)str2hex(*str) << (i*8);
+ x += (unsigned long)str2hex(str) << (i*8);
#else
# error unknown endian
#endif
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2009-08-12 21:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-12 2:15 [PATCH] fix the bug of gdb which debugs xen Caz Yokoyama
2009-08-12 7:58 ` Keir Fraser
2009-08-12 12:52 ` Caz Yokoyama
2009-08-12 13:29 ` Keir Fraser
2009-08-12 21:03 ` Caz Yokoyama [this message]
2009-08-13 13:30 ` Paolo Bonzini
2009-08-13 14:05 ` Caz Yokoyama
2009-08-13 2:54 ` Caz Yokoyama
2009-08-13 7:31 ` Keir Fraser
2009-08-14 3:52 ` Caz Yokoyama
2009-08-14 20:03 ` Caz Yokoyama
2009-08-17 20:56 ` [PATCH] break-in to Xen 1) when gdb is invoked and 2) ^C on gdb Caz Yokoyama
2009-08-21 0:24 ` Simon Horman
2009-08-21 5:37 ` Caz Yokoyama
2009-08-21 6:08 ` Simon Horman
2009-08-21 11:12 ` Caz Yokoyama
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=503CADCC055C4722B7AB00CF57C62B5C@xpjpn \
--to=cazyokoyama@gmail.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.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 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.