public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with current lldb which uses python3
       [not found] <167D7C94C5E426A6.21893@groups.io>
@ 2021-05-17 13:28 ` Rebecca Cran
  2021-05-18  0:45   ` 回复: " gaoliming
  0 siblings, 1 reply; 3+ messages in thread
From: Rebecca Cran @ 2021-05-17 13:28 UTC (permalink / raw)
  To: devel, Andrew Fish, Ray Ni

Could someone review this please?

Thanks.
Rebecca Cran

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, 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 <rebecca@bsdio.com>
> ---
>   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.')
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* 回复: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with current lldb which uses python3
  2021-05-17 13:28 ` [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with current lldb which uses python3 Rebecca Cran
@ 2021-05-18  0:45   ` gaoliming
  2021-06-12 22:54     ` Rebecca Cran
  0 siblings, 1 reply; 3+ messages in thread
From: gaoliming @ 2021-05-18  0:45 UTC (permalink / raw)
  To: devel, rebecca, 'Andrew Fish', 'Ray Ni'

Rebecca:
  This change supports python2 & python3 both. So, I think this is a good fix. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Rebecca Cran
> 发送时间: 2021年5月17日 21:29
> 收件人: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Ray Ni
> <ray.ni@intel.com>
> 主题: Re: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with
> current lldb which uses python3
> 
> Could someone review this please?
> 
> Thanks.
> Rebecca Cran
> 
> 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, 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 <rebecca@bsdio.com>
> > ---
> >   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.')
> >
> 
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 回复: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with current lldb which uses python3
  2021-05-18  0:45   ` 回复: " gaoliming
@ 2021-06-12 22:54     ` Rebecca Cran
  0 siblings, 0 replies; 3+ messages in thread
From: Rebecca Cran @ 2021-06-12 22:54 UTC (permalink / raw)
  To: gaoliming, devel, 'Andrew Fish', 'Ray Ni'

Could someone commit this please?


-- 
Rebecca Cran

On 5/17/21 6:45 PM, gaoliming wrote:
> Rebecca:
>    This change supports python2 & python3 both. So, I think this is a good fix. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Rebecca Cran
>> 发送时间: 2021年5月17日 21:29
>> 收件人: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Ray Ni
>> <ray.ni@intel.com>
>> 主题: Re: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with
>> current lldb which uses python3
>>
>> Could someone review this please?
>>
>> Thanks.
>> Rebecca Cran
>>
>> 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, 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 <rebecca@bsdio.com>
>>> ---
>>>    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.')
>>
>>
>>
>> 
>>
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-12 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <167D7C94C5E426A6.21893@groups.io>
2021-05-17 13:28 ` [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with current lldb which uses python3 Rebecca Cran
2021-05-18  0:45   ` 回复: " gaoliming
2021-06-12 22:54     ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox