From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.2178.1621298768599459208 for ; Mon, 17 May 2021 17:46:09 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 18 May 2021 08:45:46 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , "'Andrew Fish'" , "'Ray Ni'" References: <167D7C94C5E426A6.21893@groups.io> <006b5b47-4419-e04d-29f1-4f04a4fc9884@bsdio.com> In-Reply-To: <006b5b47-4419-e04d-29f1-4f04a4fc9884@bsdio.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIXSBFbXVsYXRvclBrZzogVXBkYXRlIGxsZGJlZmkucHkgdG8gd29yayB3aXRoIGN1cnJlbnQgbGxkYiB3aGljaCB1c2VzIHB5dGhvbjM=?= Date: Tue, 18 May 2021 08:45:47 +0800 Message-ID: <009101d74b7f$24a4d130$6dee7390$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFcFu/nV41Ihqy6Rlh0LdYfM81angH7/G8gq87wK0A= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Rebecca: This change supports python2 & python3 both. So, I think this is a good = fix. Reviewed-by: Liming Gao Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Rebecca Cran > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B45=E6=9C=8817=E6=97=A5= 21:29 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; Andrew Fish ; Ray Ni > > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi= .py to work with > current lldb which uses python3 >=20 > Could someone review this please? >=20 > Thanks. > Rebecca Cran >=20 > On 5/9/21 1:26 PM, Rebecca Cran wrote: > > The version of lldb shipping with macOS Big Sur is lldb-1205.0.27.3, a= nd > > it uses python3. Update lldbefi.py to work with it, including removing > > the unused 'commands' import and fixing the print statements. > > > > Signed-off-by: Rebecca Cran > > --- > > EmulatorPkg/Unix/lldbefi.py | 17 ++++++++--------- > > 1 file changed, 8 insertions(+), 9 deletions(-) > > > > diff --git a/EmulatorPkg/Unix/lldbefi.py b/EmulatorPkg/Unix/lldbefi.py > > index c3fb2675cb..952f8bf982 100755 > > --- a/EmulatorPkg/Unix/lldbefi.py > > +++ b/EmulatorPkg/Unix/lldbefi.py > > @@ -10,7 +10,6 @@ import lldb > > import os > > import uuid > > import string > > -import commands > > import optparse > > import shlex > > > > @@ -389,7 +388,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , > internal_dict): > > > > FileName =3D frame.thread.process.ReadCStringFromMemory > (FileNamePtr, FileNameLen, Error) > > if not Error.Success(): > > - print "!ReadCStringFromMemory() did not find a %d byte C stri= ng > at %x" % (FileNameLen, FileNamePtr) > > + print("!ReadCStringFromMemory() did not find a %d byte C stri= ng > at %x" % (FileNameLen, FileNamePtr)) > > # make breakpoint command continue > > return False > > > > @@ -398,7 +397,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , > internal_dict): > > LoadAddress =3D frame.FindVariable > ("LoadAddress").GetValueAsUnsigned() - 0x240 > > > > debugger.HandleCommand ("target modules add %s" % > FileName) > > - print "target modules load --slid 0x%x %s" % (LoadAddress, > FileName) > > + print("target modules load --slid 0x%x %s" % (LoadAddress, > FileName)) > > debugger.HandleCommand ("target modules load --slide 0x%x > --file %s" % (LoadAddress, FileName)) > > else: > > target =3D debugger.GetSelectedTarget() > > @@ -408,7 +407,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , > internal_dict): > > if FileName =3D=3D ModuleName or FileName =3D=3D > SBModule.GetFileSpec().GetFilename(): > > target.ClearModuleLoadAddress (SBModule) > > if not target.RemoveModule (SBModule): > > - print "!lldb.target.RemoveModule (%s) FAILED" % > SBModule > > + print("!lldb.target.RemoveModule (%s) FAILED" % > SBModule) > > > > # make breakpoint command continue > > return False > > @@ -490,15 +489,15 @@ def efi_guid_command(debugger, command, > result, dict): > > > > if len(args) >=3D 1: > > if GuidStr in guid_dict: > > - print "%s =3D %s" % (guid_dict[GuidStr], GuidStr) > > - print "%s =3D %s" % (guid_dict[GuidStr], GuidToCStructStr > (GuidStr)) > > + print("%s =3D %s" % (guid_dict[GuidStr], GuidStr)) > > + print("%s =3D %s" % (guid_dict[GuidStr], GuidToCStructStr > (GuidStr))) > > else: > > - print GuidStr > > + print(GuidStr) > > else: > > # dump entire dictionary > > width =3D max(len(v) for k,v in guid_dict.iteritems()) > > for value in sorted(guid_dict, key=3Dguid_dict.get): > > - print '%-*s %s %s' % (width, guid_dict[value], value, > GuidToCStructStr(value)) > > + print('%-*s %s %s' % (width, guid_dict[value], value, > GuidToCStructStr(value))) > > > > return > > > > @@ -538,4 +537,4 @@ def __lldb_init_module (debugger, internal_dict): > > if Breakpoint.GetNumLocations() =3D=3D 1: > > # Set the emulator breakpoints, if we are in the emulato= r > > debugger.HandleCommand("breakpoint command add -s > python -F lldbefi.LoadEmulatorEfiSymbols {id}".format(id=3DBreakpoint.Ge= tID())) > > - print 'Type r to run emulator. SecLldbScriptBreak armed. = EFI > modules should now get source level debugging in the emulator.' > > + print('Type r to run emulator. SecLldbScriptBreak armed. = EFI > modules should now get source level debugging in the emulator.') > > >=20 >=20 >=20 >=20 >=20 >=20