From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web09.12543.1639409297077036931 for ; Mon, 13 Dec 2021 07:28:17 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MZeUrAOj; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28A89B80EFB for ; Mon, 13 Dec 2021 15:28:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1637C34603 for ; Mon, 13 Dec 2021 15:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639409293; bh=iJkPrjDdRZHedn7hK7fykxxHIqJKsyxXcq+1gzEqvFI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MZeUrAOjTka+x9g+cYsxKsSLJlQdIiD4BiIdExuWKyYJxgfS3oc85WxWydG55xYxh P0BcZu9p8jAJ5hfnzqMBs/tK/pEGOM3J74H3M3TlAlGnbaoyfPtvUZuaL+TiVfLVKS NNLDjcdwbwdULLfeyDR1O3A/0T460LOiH88AzAjU5QScPc93iLzxSI4uN4WfORjONK 36GwsJU1oDAbJNKqPOCyHSFm9yJn4zZtfdvsQUCmJdaOz83J3mddoJQVOBXSjbRKUq BCLZKlc/5bMVukj5rLD+3vOoRSEdaS0HEij6L6IOabhCosQwb3AFU00ztPH1fznJx2 0d81nUlVY/qjg== Received: by mail-ot1-f54.google.com with SMTP id n104-20020a9d2071000000b005799790cf0bso17798682ota.5 for ; Mon, 13 Dec 2021 07:28:12 -0800 (PST) X-Gm-Message-State: AOAM53129JNRuCPRjtvY9w0T6vN+k9qY9zN60KaNYSy8xb6KEU4eeI5T KHpCJ5Nklu/vm/bsJHj4h6hwwKzH7hPxp5buLeI= X-Google-Smtp-Source: ABdhPJzdA+5tM5LqaLdET0l/smDHJY5E5QTtzK7IFh2OtcDVJKYjTwZt2pDP5D/Aor7jEfgzZGyd0X+bETPs2mYERuE= X-Received: by 2002:a05:6830:1445:: with SMTP id w5mr25628953otp.112.1639409292157; Mon, 13 Dec 2021 07:28:12 -0800 (PST) MIME-Version: 1.0 References: <20210509192647.14478-1-rebecca@bsdio.com> <37EF0F13-4C27-4D4F-93D1-FEF6CB0DF8C2@apple.com> <105601cb-f815-4a5e-c786-c065f737953b@bsdio.com> In-Reply-To: <105601cb-f815-4a5e-c786-c065f737953b@bsdio.com> From: "Ard Biesheuvel" Date: Mon, 13 Dec 2021 16:28:01 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with current lldb which uses python3 To: edk2-devel-groups-io , Rebecca Cran Cc: Andrew Fish , Ray Ni , "Kinney, Michael D" , Ard Biesheuvel , Leif Lindholm Content-Type: text/plain; charset="UTF-8" On Thu, 2 Dec 2021 at 03:42, Rebecca Cran wrote: > > I just noticed this was never committed. > > Could someone commit/push this change please? > Merged as #2299 Thanks, > > -- > Rebecca Cran > > On 7/20/21 23:25, Andrew Fish wrote: > > Reviewed-by: Andrew Fish > > > >> On May 9, 2021, at 12:26 PM, Rebecca Cran wrote: > >> > >> The version of lldb shipping with macOS Big Sur is lldb-1205.0.27.3, and > >> 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 = frame.thread.process.ReadCStringFromMemory (FileNamePtr, FileNameLen, Error) > >> if not Error.Success(): > >> - print "!ReadCStringFromMemory() did not find a %d byte C string at %x" % (FileNameLen, FileNamePtr) > >> + print("!ReadCStringFromMemory() did not find a %d byte C string at %x" % (FileNameLen, FileNamePtr)) > >> # make breakpoint command continue > >> return False > >> > >> @@ -398,7 +397,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , internal_dict): > >> LoadAddress = 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 = debugger.GetSelectedTarget() > >> @@ -408,7 +407,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , internal_dict): > >> if FileName == ModuleName or FileName == 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) >= 1: > >> if GuidStr in guid_dict: > >> - print "%s = %s" % (guid_dict[GuidStr], GuidStr) > >> - print "%s = %s" % (guid_dict[GuidStr], GuidToCStructStr (GuidStr)) > >> + print("%s = %s" % (guid_dict[GuidStr], GuidStr)) > >> + print("%s = %s" % (guid_dict[GuidStr], GuidToCStructStr (GuidStr))) > >> else: > >> - print GuidStr > >> + print(GuidStr) > >> else: > >> # dump entire dictionary > >> width = max(len(v) for k,v in guid_dict.iteritems()) > >> for value in sorted(guid_dict, key=guid_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() == 1: > >> # Set the emulator breakpoints, if we are in the emulator > >> debugger.HandleCommand("breakpoint command add -s python -F lldbefi.LoadEmulatorEfiSymbols {id}".format(id=Breakpoint.GetID())) > >> - 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.') > >> -- > >> 2.30.1 (Apple Git-130) > >> > >> > >> > >> > >> > >> > >> > > > > > >