From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10577 invoked by alias); 8 Dec 2009 05:11:41 -0000 Received: (qmail 10566 invoked by uid 22791); 8 Dec 2009 05:11:39 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pw0-f49.google.com (HELO mail-pw0-f49.google.com) (209.85.160.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Dec 2009 05:11:32 +0000 Received: by pwj12 with SMTP id 12so1183909pwj.8 for ; Mon, 07 Dec 2009 21:11:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.7.40 with SMTP id 40mr838005wfg.120.1260249091087; Mon, 07 Dec 2009 21:11:31 -0800 (PST) In-Reply-To: <4B1D5096.8000206@vmware.com> References: <4B1D5096.8000206@vmware.com> From: Hui Zhu Date: Tue, 08 Dec 2009 05:11:00 -0000 Message-ID: Subject: Re: [RFA/RFC] Prec multi-thread support [2/4] arch support To: Michael Snyder Cc: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-12/txt/msg00113.txt.bz2 Now, the fp insn patch and sse patch are running. If you don't mind, I suggest let them go first. :) Thanks, Hui On Tue, Dec 8, 2009 at 02:59, Michael Snyder wrote: > Hui Zhu wrote: >> >> 1. In record_linux_system_call gdb_sys_clone, I set record_step to 0. >> Then the record target will let inferior continue until to a >> breakpoint. =A0Most of time, record just let inferior step. =A0But >> sys_clone is very special. =A0It cannot work OK with >> PTRACE_SINGLESTEP.(It make me hang this patch a log of months.) >> >> 2. Add new argument "addr" that point to the next code that need to be >> analyzed to linux syscall record function "record_linux_system_call". > > Here is your stylistic review: > >> 2009-11-25 =A0Hui Zhu =A0 >> >> =A0 =A0 =A0 =A0* amd64-linux-tdep.c (amd64_linux_syscall_record): Add new >> =A0 =A0 =A0 =A0argument "addr". >> =A0 =A0 =A0 =A0* i386-linux-tdep.c (i386_linux_intx80_sysenter_record): = Ditto. >> =A0 =A0 =A0 =A0* i386-tdep.c (i386_record_lea_modrm): Add "if (record_de= bug)" >> =A0 =A0 =A0 =A0to segment register warning. >> =A0 =A0 =A0 =A0(i386_process_record): Ditto. =A0Add new argument "addr" = when >> =A0 =A0 =A0 =A0call i386_intx80_record, i386_sysenter_record and >> =A0 =A0 =A0 =A0i386_syscall_record. >> =A0 =A0 =A0 =A0* i386-tdep.h (gdbarch_tdep): Add new argument "addr" when >> =A0 =A0 =A0 =A0call i386_intx80_record, i386_sysenter_record and >> =A0 =A0 =A0 =A0i386_syscall_record. >> =A0 =A0 =A0 =A0* linux-record.c (inferior.h): New include. >> =A0 =A0 =A0 =A0(record_linux_system_call): Add new argument "addr". >> =A0 =A0 =A0 =A0Update code for gdb_sys_clone. >> =A0 =A0 =A0 =A0* linux-record.h (record_linux_system_call): Add new argu= ment >> =A0 =A0 =A0 =A0"addr". >> >> --- >> =A0amd64-linux-tdep.c | =A0 =A04 ++-- >> =A0i386-linux-tdep.c =A0| =A0 =A04 ++-- >> =A0i386-tdep.c =A0 =A0 =A0 =A0| =A0 52 >> +++++++++++++++++++++++++++++----------------------- >> =A0i386-tdep.h =A0 =A0 =A0 =A0| =A0 =A06 +++--- >> =A0linux-record.c =A0 =A0 | =A0 13 +++++++++---- >> =A0linux-record.h =A0 =A0 | =A0 =A02 +- >> =A06 files changed, 46 insertions(+), 35 deletions(-) >> >> --- a/amd64-linux-tdep.c >> +++ b/amd64-linux-tdep.c >> @@ -1155,7 +1155,7 @@ static struct linux_record_tdep amd64_li >> =A0#define RECORD_ARCH_GET_GS =A0 =A0 0x1004 >> >> =A0static int >> -amd64_linux_syscall_record (struct regcache *regcache) >> +amd64_linux_syscall_record (struct regcache *regcache, CORE_ADDR addr) >> =A0{ >> =A0 int ret; >> =A0 ULONGEST syscall_native; >> @@ -1205,7 +1205,7 @@ amd64_linux_syscall_record (struct regca >> =A0 =A0 } >> =A0 else >> =A0 =A0 { >> - =A0 =A0 =A0ret =3D record_linux_system_call (syscall_gdb, regcache, >> + =A0 =A0 =A0ret =3D record_linux_system_call (syscall_gdb, addr, regcac= he, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 &amd64_linux_record_tdep); >> =A0 =A0 =A0 if (ret) >> =A0 =A0 =A0 =A0 return ret; >> --- a/i386-linux-tdep.c >> +++ b/i386-linux-tdep.c >> @@ -411,7 +411,7 @@ i386_canonicalize_syscall (int syscall) >> =A0static struct linux_record_tdep i386_linux_record_tdep; >> >> =A0static int >> -i386_linux_intx80_sysenter_record (struct regcache *regcache) >> +i386_linux_intx80_sysenter_record (struct regcache *regcache, CORE_ADDR >> addr) > > Break up long line. > >> =A0{ >> =A0 int ret; >> =A0 LONGEST syscall_native; >> @@ -437,7 +437,7 @@ i386_linux_intx80_sysenter_record (struc >> =A0 =A0 =A0return 0; >> =A0 =A0} >> >> - =A0ret =3D record_linux_system_call (syscall_gdb, regcache, >> + =A0ret =3D record_linux_system_call (syscall_gdb, addr, regcache, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&i386= _linux_record_tdep); >> =A0 if (ret) >> =A0 =A0 return ret; >> --- a/i386-tdep.c >> +++ b/i386-tdep.c >> @@ -3160,10 +3160,11 @@ i386_record_lea_modrm (struct i386_recor >> >> =A0 if (irp->override >=3D 0) >> =A0 =A0 { >> - =A0 =A0 =A0warning (_("Process record ignores the memory change " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "of instruction at address %s because = it " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "can't get the value of the segment re= gister."), >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdbarch, irp->orig_addr)); >> + =A0 =A0 =A0if (record_debug) >> + =A0 =A0 =A0 =A0warning (_("Process record ignores the memory change " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "of instruction at address %s beca= use it " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "can't get the value of the segmen= t register."), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdbarch, irp->orig_addr)); >> =A0 =A0 =A0 return 0; >> =A0 =A0 } >> >> @@ -4042,11 +4043,12 @@ reswitch: >> =A0 =A0 case 0xa3: >> =A0 =A0 =A0 if (ir.override >=3D 0) >> =A0 =A0 =A0 =A0 { >> - =A0 =A0 =A0 =A0 warning (_("Process record ignores the memory change " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "of instruction at address %s = because " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "it can't get the value of the= segment " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "register."), >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdbarch, ir.orig_addr)); >> + =A0 =A0 =A0 =A0 =A0if (record_debug) >> + =A0 =A0 =A0 =A0 =A0 warning (_("Process record ignores the memory chan= ge " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "of instruction at address= %s because " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "it can't get the value of= the segment " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "register."), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdbarch, ir.orig_add= r)); >> =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 else >> =A0 =A0 =A0 =A0{ >> @@ -4467,11 +4469,12 @@ reswitch: >> =A0 =A0 =A0 =A0 =A0 if (ir.aflag && (es !=3D ds)) >> =A0 =A0 =A0 =A0 =A0 =A0 { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* addr +=3D ((uint32_t) read_register (I386= _ES_REGNUM)) << 4; >> */ >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0warning (_("Process record ignores the memo= ry " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "change of instruction= at address %s " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "because it can't get = the value of the " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "ES segment register."= ), >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdbarch, ir.orig= _addr)); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0if (record_debug) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0warning (_("Process record ignores the = memory " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "change of instruc= tion at address %s " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "because it can't = get the value of the " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "ES segment regist= er."), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdbarch, ir.= orig_addr)); >> =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 else >> =A0 =A0 =A0 =A0 =A0 =A0 { >> @@ -4872,7 +4875,7 @@ reswitch: >> =A0 =A0 =A0 =A0 =A0 =A0ir.addr -=3D 2; >> =A0 =A0 =A0 =A0 =A0 =A0goto no_support; >> =A0 =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 ret =3D gdbarch_tdep (gdbarch)->i386_intx80_record (ir.reg= cache); >> + =A0 =A0 =A0 ret =3D gdbarch_tdep (gdbarch)->i386_intx80_record (ir.reg= cache, >> ir.addr); > > Break up long line. > >> =A0 =A0 =A0 =A0if (ret) >> =A0 =A0 =A0 =A0 =A0return ret; >> =A0 =A0 =A0 } >> @@ -4974,7 +4977,8 @@ reswitch: >> =A0 =A0 =A0 =A0 =A0 =A0ir.addr -=3D 2; >> =A0 =A0 =A0 =A0 =A0 =A0goto no_support; >> =A0 =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 ret =3D gdbarch_tdep (gdbarch)->i386_sysenter_record (ir.r= egcache); >> + =A0 =A0 =A0 ret =3D gdbarch_tdep (gdbarch)->i386_sysenter_record (ir.r= egcache, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ir.addr); >> =A0 =A0 =A0 =A0if (ret) >> =A0 =A0 =A0 =A0 =A0return ret; >> =A0 =A0 =A0 } >> @@ -4999,7 +5003,8 @@ reswitch: >> =A0 =A0 =A0 =A0 =A0 =A0ir.addr -=3D 2; >> =A0 =A0 =A0 =A0 =A0 =A0goto no_support; >> =A0 =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 ret =3D gdbarch_tdep (gdbarch)->i386_syscall_record (ir.re= gcache); >> + =A0 =A0 =A0 ret =3D gdbarch_tdep (gdbarch)->i386_syscall_record (ir.re= gcache, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ir.addr); >> =A0 =A0 =A0 =A0if (ret) >> =A0 =A0 =A0 =A0 =A0return ret; >> =A0 =A0 =A0 } >> @@ -5135,12 +5140,13 @@ reswitch: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0/* sidt */ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0if (ir.override >=3D 0) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 warning (_("Process record ignores the= memory " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "change of ins= truction at " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "address %s be= cause it can't get " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "the value of = the segment " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "register."), >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdbarch,= ir.orig_addr)); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (record_debug) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 warning (_("Process record ignores= the memory " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "change of= instruction at " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "address %= s because it can't get " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "the value= of the segment " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "register.= "), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (gdba= rch, ir.orig_addr)); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0 =A0 =A0 =A0else >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ >> --- a/i386-tdep.h >> +++ b/i386-tdep.h >> @@ -115,11 +115,11 @@ struct gdbarch_tdep >> =A0 =A0 =A0in GDB is not same as I386 instructions. =A0*/ >> =A0 const int *record_regmap; >> =A0 /* Parse intx80 args. =A0*/ >> - =A0int (*i386_intx80_record) (struct regcache *regcache); >> + =A0int (*i386_intx80_record) (struct regcache *regcache, CORE_ADDR add= r); >> =A0 /* Parse sysenter args. =A0*/ >> - =A0int (*i386_sysenter_record) (struct regcache *regcache); >> + =A0int (*i386_sysenter_record) (struct regcache *regcache, CORE_ADDR >> addr); >> =A0 /* Parse syscall args. =A0*/ >> - =A0int (*i386_syscall_record) (struct regcache *regcache); >> + =A0int (*i386_syscall_record) (struct regcache *regcache, CORE_ADDR ad= dr); >> =A0}; >> >> =A0/* Floating-point registers. =A0*/ >> --- a/linux-record.c >> +++ b/linux-record.c >> @@ -21,6 +21,7 @@ >> =A0#include "target.h" >> =A0#include "gdbtypes.h" >> =A0#include "regcache.h" >> +#include "inferior.h" >> =A0#include "record.h" >> =A0#include "linux-record.h" >> >> @@ -222,7 +223,7 @@ record_linux_msghdr (struct regcache *re >> =A0 =A0Return -1 if something wrong. =A0*/ >> >> =A0int >> -record_linux_system_call (enum gdb_syscall syscall, >> +record_linux_system_call (enum gdb_syscall syscall, CORE_ADDR addr, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct regcache *regc= ache, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct linux_record_= tdep *tdep) >> =A0{ >> @@ -242,8 +243,9 @@ record_linux_system_call (enum gdb_sysca >> =A0 =A0 =A0 =A0 int q; >> =A0 =A0 =A0 =A0 target_terminal_ours (); >> =A0 =A0 =A0 =A0 q =3D yquery (_("The next instruction is syscall exit. = =A0" >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"It will make the program e= xit. =A0" >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"Do you want to stop the pr= ogram?")); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"It will make the thread %s= exit. =A0" >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"Do you want to stop the pr= ogram?"), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0target_pid_to_str (inferior_pti= d)); >> =A0 =A0 =A0 =A0 target_terminal_inferior (); >> =A0 =A0 =A0 =A0 if (q) >> =A0 =A0 =A0 =A0 =A0 return 1; >> @@ -1209,10 +1211,13 @@ record_linux_system_call (enum gdb_sysca >> >> =A0 =A0 case gdb_sys_fsync: >> =A0 =A0 case gdb_sys_sigreturn: >> - =A0 =A0case gdb_sys_clone: >> =A0 =A0 case gdb_sys_setdomainname: >> =A0 =A0 =A0 break; >> >> + =A0 =A0case gdb_sys_clone: >> + =A0 =A0 =A0record_step =3D 0; >> + =A0 =A0 =A0break; >> + >> =A0 =A0 case gdb_sys_newuname: >> =A0 =A0 =A0 regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulonge= st); >> =A0 =A0 =A0 if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, >> --- a/linux-record.h >> +++ b/linux-record.h >> @@ -534,7 +534,7 @@ enum gdb_syscall { >> >> =A0/* Record a linux syscall. =A0*/ >> >> -extern int record_linux_system_call (enum gdb_syscall num, >> +extern int record_linux_system_call (enum gdb_syscall num, CORE_ADDR >> addr, > > Break up long line. > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = struct regcache *regcache, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = struct linux_record_tdep *tdep); >> =A0#endif /* _LINUX_RECORD_H_ */ > >