This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] fix the bug of gdb which debugs xen.

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] fix the bug of gdb which debugs xen.
From: Caz Yokoyama <cazyokoyama@xxxxxxxxx>
Date: Tue, 11 Aug 2009 19:15:24 -0700
Delivery-date: Tue, 11 Aug 2009 19:15:55 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:mime-version:content-type:x-mailer:thread-index :x-mimeole; bh=ma+ujjVryK/BhH4E3Kma5iOJOk/4WXiQe0bus52BBUQ=; b=Q6U8yEa7CUNMiC2AvQwnTffdugKEUeybUt0A0x3Y3TjcrobtbWOP+vKnbMmoZHRktM qS/BS5Uc9m6EgC/Bx475qPkkzRL+4MnF3UpXyCng4SHZzRjYgNMDBdbCWqRkF1xj836V zwmMY8Wz5xwpNfsUe7/hHLQ8Os9u8wJzMcwVk=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type:x-mailer :thread-index:x-mimeole; b=oNgyWfs14yjzUoQ299sMJqe6P4pk/KdfA3mzR5edKv5u9qn+2nYfPwfPg0hNczznqA u29BSM8Nl+a0dWt7eqyMnsL322wUplHpVuEkEVkt9ApvtnF4I1hCqlsLbnK86K2bkNF2 ZO/fm9sV84JCB+1zFISH1wnnbVDdEatWN7HSE=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acoa8r/5gPp6Qi5vSqWmE3+LHCGKRQ==


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.




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





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



         val = str2ulong(ptr, sizeof(unsigned long));

+        val = swap64(val);

         gdb_arch_write_reg(addr, val, regs, ctx);


     case 'D':


Thank you.

-Caz Yokoyama, caz at caztech dot com. 503-804-1028(m).


Attachment: XenGdb.patch
Description: Binary data

Xen-devel mailing list