From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=mMBwAyt0; spf=pass (domain: apple.com, ip: 17.171.2.68, mailfrom: afish@apple.com) Received: from ma1-aaemail-dr-lapp02.apple.com (ma1-aaemail-dr-lapp02.apple.com [17.171.2.68]) by groups.io with SMTP; Fri, 16 Aug 2019 10:30:56 -0700 Received: from pps.filterd (ma1-aaemail-dr-lapp02.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp02.apple.com (8.16.0.27/8.16.0.27) with SMTP id x7GHRP1b023957; Fri, 16 Aug 2019 10:30:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=sender : from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=16c2bi78LWF5ycrk2ywUYr2OUfLdseSR5cREkV/zF9Y=; b=mMBwAyt0Gh3Y1e3Y+fVz1OVmz61Jtp0SGxgLshGAt2Y+5y6JE04GTcS1JGkkcLd31JiR tghOCfmOTTZaLYDyw8Jbsgo2rrDR3yc5gqcWCab3lI83CNhfiKDvvjD6G2w8phPh0Bf0 ZGQzDny2QzXd7q7pa3PPxEohLFE4rtsEyHcuJxmG8cLrT3wI3Ra22bkfpF6/4W9DBK71 bNQHPu5GdMXJbxsK5cKl0Y3bAh8RbtTBdU7gwFYgXoVVjb6nB/MVtMEspxAVFRtN0HW3 CUQcsj7Lz0Dg8nZYX7SzgfiizqJGG/lFG4lse/GLzFOUzcpkjUZWESkaE9VZ9Foy6TT6 zQ== Received: from ma1-mtap-s03.corp.apple.com (ma1-mtap-s03.corp.apple.com [17.40.76.7]) by ma1-aaemail-dr-lapp02.apple.com with ESMTP id 2u9tm3kqa4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 16 Aug 2019 10:30:54 -0700 Received: from nwk-mmpp-sz09.apple.com (nwk-mmpp-sz09.apple.com [17.128.115.80]) by ma1-mtap-s03.corp.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) with ESMTPS id <0PWC00L67BBHD0F0@ma1-mtap-s03.corp.apple.com>; Fri, 16 Aug 2019 10:30:54 -0700 (PDT) Received: from process_milters-daemon.nwk-mmpp-sz09.apple.com by nwk-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) id <0PWC00000B6W3I00@nwk-mmpp-sz09.apple.com>; Fri, 16 Aug 2019 10:30:53 -0700 (PDT) X-Va-A: X-Va-T-CD: e48e8dc3f6c377b8dc939b4126ad19f3 X-Va-E-CD: 273de967ea5ef01c8479c4aab5b6ee33 X-Va-R-CD: d4a8cd59e2cd8ae2b2eca43c0527caff X-Va-CD: 0 X-Va-ID: dcbb17f9-fa73-4a94-8203-cda9e752bc59 X-V-A: X-V-T-CD: e48e8dc3f6c377b8dc939b4126ad19f3 X-V-E-CD: 273de967ea5ef01c8479c4aab5b6ee33 X-V-R-CD: d4a8cd59e2cd8ae2b2eca43c0527caff X-V-CD: 0 X-V-ID: 2318bae8-b1fc-4c88-9dd9-db0d5fd03516 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-16_07:,, signatures=0 Received: from [17.235.2.84] (unknown [17.235.2.84]) by nwk-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) with ESMTPSA id <0PWC00FGEBBEJG10@nwk-mmpp-sz09.apple.com>; Fri, 16 Aug 2019 10:30:52 -0700 (PDT) Sender: afish@apple.com From: "Andrew Fish" Message-id: <2BB17527-DAF7-4C52-B77D-D03511160F71@apple.com> MIME-version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [edk2-devel] [Patch V4 06/10] EmulatorPkg: Fix XCODE5 lldb issues Date: Fri, 16 Aug 2019 10:30:49 -0700 In-reply-to: Cc: Jordan Justen , "Ni, Ray" To: devel@edk2.groups.io, Mike Kinney References: <20190816021437.7516-1-michael.d.kinney@intel.com> <20190816021437.7516-7-michael.d.kinney@intel.com> <156594125657.32637.16775516269528755196@jljusten-skl> X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-16_07:,, signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_639FF2B3-D1F3-4383-96B4-6FC705E6DD0E" --Apple-Mail=_639FF2B3-D1F3-4383-96B4-6FC705E6DD0E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Tested-by: Andrew Fish I tested the XCODE builds of the emulator and made sure that source level = debugging worked probably for builds that generate symbols.=20 Thanks, Andrew Fish > On Aug 16, 2019, at 8:09 AM, Michael D Kinney wrote: >=20 > Jordan, >=20 > It is not a typo. >=20 > Andrew generated the XCODE specific changes, so they have=20 > been tested by him. I have also reviewed and tested the XCODE > changes and verified that all 6 combinations build and boot > to shell (IA32/X64 for RELEASE/DEBUG/NOOPT). Since they are > all related to making EmulatorPkg work, we decided to fold > them into the same patch set that was already being reviewed. >=20 > I also verified build and boot to shell for 6 combinations > on GCC5 (IA32/X64 for RELEASE/DEBUG/NOOPT) and the 12 > combinations of VS2015/VS2017, IA323/X64, RELEASE/DEBUG/NOOPT. >=20 > I have been working on some CI experiments using Azure Pipelines. > Here is a pointer to the build logs for all the combinations=20 > listed above. >=20 > https://dev.azure.com/mikekinney/edk2-ci/_build/results?buildId=3D312 >=20 > Mike >=20 >> -----Original Message----- >> From: Justen, Jordan L >> Sent: Friday, August 16, 2019 12:41 AM >> To: Kinney, Michael D ; >> devel@edk2.groups.io >> Cc: Ni, Ray ; Andrew Fish >> >> Subject: Re: [Patch V4 06/10] EmulatorPkg: Fix XCODE5 >> lldb issues >>=20 >> On 2019-08-15 19:14:33, Michael D Kinney wrote: >>> Fix scripts to support lldb symbolic debugging when >> using XCODE5 tool >>> chain. >>>=20 >>> Cc: Jordan Justen >>> Cc: Ray Ni >>> Cc: Michael D Kinney >>> Signed-off-by: Andrew Fish >>=20 >> Is this a Cc/Signed-off-by typo? (See also, patches 7- >> 10). >>=20 >> This makes me wonder if you are taking advantage of the >> git commit -s switch to add your Signed-off-by. >>=20 >> Also, I'm wondering if you are taking advantage of git- >> send-email automatically Cc'ing the addresses you >> listed in the commit message. >> (I thought it Cc'd for the author and Cc tags, but I >> wasn't sure about the Signed-off-by tag, and yet I see >> Andrew was Cc'd.) >>=20 >> There's a couple long lines below. You could use \ at >> the end of the line to split the .sh line. I think the >> cd can be a separate command in a shell script. (Not in >> make) >>=20 >> I hope someone that uses the XCODE toolchain could >> review/check the XCODE patches. >>=20 >> -Jordan >>=20 >>> --- >>> EmulatorPkg/Unix/lldbefi.py | 8 +++++--- >>> EmulatorPkg/build.sh | 17 ++--------------- >>> 2 files changed, 7 insertions(+), 18 deletions(-) >>>=20 >>> diff --git a/EmulatorPkg/Unix/lldbefi.py >> b/EmulatorPkg/Unix/lldbefi.py >>> index 218326b8cb..099192d8b5 100755 >>> --- a/EmulatorPkg/Unix/lldbefi.py >>> +++ b/EmulatorPkg/Unix/lldbefi.py >>> @@ -346,6 +346,7 @@ def TypePrintFormating(debugger): >>> debugger.HandleCommand("type summary add CHAR8 - >> -python-function lldbefi.CHAR8_TypeSummary") >>> debugger.HandleCommand('type summary add --regex >> "CHAR8 >>> \[[0-9]+\]" --python-function >> lldbefi.CHAR8_TypeSummary') >>>=20 >>> + debugger.HandleCommand('setting set frame-format >> "frame >>> + #${frame.index}: ${frame.pc}{ >>> + >> ${module.file.basename}{:${function.name}()${function.p >> c-offset}}}{ >>> + at ${line.file.fullpath}:${line.number}}\n"') >>>=20 >>> gEmulatorBreakWorkaroundNeeded =3D True >>>=20 >>> @@ -381,15 +382,16 @@ def >> LoadEmulatorEfiSymbols(frame, bp_loc , internal_dict): >>> Error =3D lldb.SBError() >>> FileNamePtr =3D frame.FindVariable >> ("FileName").GetValueAsUnsigned() >>> FileNameLen =3D frame.FindVariable >>> ("FileNameLength").GetValueAsUnsigned() >>> + >>> FileName =3D >> 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) >>> # make breakpoint command contiue >>> - frame.GetThread().GetProcess().Continue() >>> + return False >>>=20 >>> debugger =3D frame.thread.process.target.debugger >>> if frame.FindVariable >> ("AddSymbolFlag").GetValueAsUnsigned() =3D=3D 1: >>> - LoadAddress =3D frame.FindVariable >> ("LoadAddress").GetValueAsUnsigned() >>> + LoadAddress =3D frame.FindVariable >>> + ("LoadAddress").GetValueAsUnsigned() - 0x240 >>>=20 >>> debugger.HandleCommand ("target modules add >> %s" % FileName) >>> print "target modules load --slid 0x%x %s" % >> (LoadAddress, >>> FileName) @@ -405,7 +407,7 @@ def >> LoadEmulatorEfiSymbols(frame, bp_loc , internal_dict): >>> print "!lldb.target.RemoveModule >> (%s) FAILED" % >>> SBModule >>>=20 >>> # make breakpoint command contiue >>> - frame.thread.process.Continue() >>> + return False >>>=20 >>> def GuidToCStructStr (guid, Name=3DFalse): >>> # >>> diff --git a/EmulatorPkg/build.sh >> b/EmulatorPkg/build.sh index >>> 60056e1b6c..35912a7775 100755 >>> --- a/EmulatorPkg/build.sh >>> +++ b/EmulatorPkg/build.sh >>> @@ -209,21 +209,8 @@ fi >>> if [[ "$RUN_EMULATOR" =3D=3D "yes" ]]; then >>> case `uname` in >>> Darwin*) >>> - # >>> - # On Darwin we can't use dlopen, so we have to >> load the real PE/COFF images. >>> - # This .gdbinit script sets a breakpoint that >> loads symbols for the PE/COFFEE >>> - # images that get loaded in Host >>> - # >>> - if [[ "$CLANG_VER" =3D=3D *-ccc-host-triple* ]] >>> - then >>> - # only older versions of Xcode support -ccc- >> host-tripe, for newer versions >>> - # it is -target >>> - cp $WORKSPACE/EmulatorPkg/Unix/lldbefi.py >> "$BUILD_OUTPUT_DIR/${BUILDTARGET}_$TARGET_TOOLS/$PROCES >> SOR" >>> - cd $BUILD_ROOT_ARCH; /usr/bin/lldb --source >> $WORKSPACE/EmulatorPkg/Unix/lldbinit Host >>> - exit $? >>> - else >>> - cp $WORKSPACE/EmulatorPkg/Unix/.gdbinit >> "$BUILD_OUTPUT_DIR/${BUILDTARGET}_$TARGET_TOOLS/$PROCES >> SOR" >>> - fi >>> + cd $BUILD_ROOT_ARCH; /usr/bin/lldb -o "command >> script import $WORKSPACE/EmulatorPkg/Unix/lldbefi.py" - >> o 'script lldb.debugger.SetAsync(True)' -o "run" ./Host >>> + exit $? >>> ;; >>> esac >>>=20 >>> -- >>> 2.21.0.windows.1 >>>=20 >=20 >=20 >=20 --Apple-Mail=_639FF2B3-D1F3-4383-96B4-6FC705E6DD0E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Tested-by: Andrew Fish= <afish@apple.com><= /span>

I tested the XCODE builds of the emulator and mad= e sure that source level debugging worked probably for builds that generate= symbols. 

Thanks,

<= div class=3D"">Andrew Fish
<= br class=3D"">
On Aug 1= 6, 2019, at 8:09 AM, Michael D Kinney <michael.d.kinney@intel.com> wrote:

Jordan,=

It is not a typo.

Andrew generated the XCODE specific changes, so they have
= been tested by him.  I have also reviewed and tested the XCODE
changes and verified that all 6 combinations build and boot
to shell (IA32/X64 for RELEASE/DEBUG/NOOPT). Since they are
all related to making EmulatorPkg work, we decided to fold
them into the same patch set that was already being reviewed.

I also verified build and boot to shell for 6 combin= ations
on GCC5 (IA32/X64 for RELEASE/DEBUG/NOOPT) and the 12<= br class=3D"">combinations of VS2015/VS2017, IA323/X64, RELEASE/DEBUG/NOOPT= .

I have been working on some CI experiments u= sing Azure Pipelines.
Here is a pointer to the build logs for= all the combinations
listed above.

https://dev.azure.com/mikekinney/edk2-ci/_build/re= sults?buildId=3D312

Mike
-----Original Message-----=
From: Justen, Jordan L
Sent: Friday, August 16= , 2019 12:41 AM
To: Kinney, Michael D <michael.d.kinney@in= tel.com>;
devel@edk2.groups.io
Cc: Ni, Ray &= lt;ray.ni@intel.com>; Andrew Fish
<afish@apple.com><= br class=3D"">Subject: Re: [Patch V4 06/10] EmulatorPkg: Fix XCODE5
lldb issues

On 2019-08-15 19:14:33, Mic= hael D Kinney wrote:
Fix= scripts to support lldb symbolic debugging when
using XCODE5 tool
chain= .

Cc: Jordan Justen <jordan.l.justen@intel.= com>
Cc: Ray Ni <ray.ni@intel.com>
Cc:= Michael D Kinney <michael.d.kinney@intel.com>
Signed-o= ff-by: Andrew Fish <afish@apple.com>

Is this a Cc/Signed-off-by typo? (See also, patches 7-
10).

This makes me wonder if you are ta= king advantage of the
git commit -s switch to add your Signed= -off-by.

Also, I'm wondering if you are taking= advantage of git-
send-email automatically Cc'ing the addres= ses you
listed in the commit message.
(I though= t it Cc'd for the author and Cc tags, but I
wasn't sure about= the Signed-off-by tag, and yet I see
Andrew was Cc'd.)

There's a couple long lines below. You could use \ = at
the end of the line to split the .sh line. I think the
cd can be a separate command in a shell script. (Not in
make)

I hope someone that uses the XCOD= E toolchain could
review/check the XCODE patches.

-Jordan

---
EmulatorPkg/Unix/lldbefi.py |  8 += ++++---
EmulatorPkg/build.sh      &= nbsp; | 17 ++---------------
2 files changed, 7 inserti= ons(+), 18 deletions(-)

diff --git a/EmulatorP= kg/Unix/lldbefi.py
b/EmulatorPkg/Unix/lldbefi.py=
index 218326b8cb..09919= 2d8b5 100755
--- a/EmulatorPkg/Unix/lldbefi.py
= +++ b/EmulatorPkg/Unix/lldbefi.py
@@ -346,6 +346,7 @@ def Typ= ePrintFormating(debugger):
    debugger.= HandleCommand("type summary add CHAR8 -
-python-= function lldbefi.CHAR8_TypeSummary")
    debugger.HandleCommand('type summary = add --regex
"CHAR8
\[[0-9]+\]" --python-function
lldbefi.CHAR8_TypeSummary')

+    debugger.HandleCommand('setting = set frame-format
"frame
+ #${frame.index}: ${frame.pc}{
+<= br class=3D"">
${module.file.basename}{:${function.name}()${fun= ction.p
c-offset}}}{
+ at ${line.file.fullpath}:${line.number}}\n"')
gEmulatorBreakWorkaroundNeeded =3D True

@@ -381,15 +382,16 @@ def
LoadEmulatorEf= iSymbols(frame, bp_loc , internal_dict):
    Error =3D lldb.SBError()
    FileNamePtr =3D frame.FindVariable
("FileName").GetValueAsUnsigned()
    FileNameLen =3D fram= e.FindVariable
("FileNameLength").GetValueAsUnsigned()
+
    FileName =3D
frame.thread.process.ReadCStringFromMemory
(Fil= eNamePtr, FileNameLen, Error)
    if not Error.Success():
&nbs= p;       print "!ReadCStringFromMemory()= did not find
a %d byte C string at %x" % (FileN= ameLen, FileNamePtr)
&n= bsp;       # make breakpoint command con= tiue
-        frame.GetThr= ead().GetProcess().Continue()
+      = ;  return False

   &= nbsp;debugger =3D frame.thread.process.target.debugger
 = ;   if frame.FindVariable
("AddSy= mbolFlag").GetValueAsUnsigned() =3D=3D 1:
-        LoadAddress = =3D frame.FindVariable
("LoadAddress").GetValue= AsUnsigned()
+  &nb= sp;     LoadAddress =3D frame.FindVariable
+ ("LoadAddress").GetValueAsUnsigned() - 0x240

        debugger.HandleCom= mand ("target modules add
%s" % FileName)
     = ;   print "target modules load --slid 0x%x %s" %
(LoadAddress,
FileName) @@ -405,7 +407,7 @@ def
LoadEmu= latorEfiSymbols(frame, bp_loc , internal_dict):
        &n= bsp;           print= "!lldb.target.RemoveModule
(%s) FAILED" %
SBModule

    # make breakpoint command contiue
-    frame.thread.process.Continue()
+ =    return False

def GuidToCStr= uctStr (guid, Name=3DFalse):
  #
dif= f --git a/EmulatorPkg/build.sh
b/EmulatorPkg/bui= ld.sh index
60056e1b6c..= 35912a7775 100755
--- a/EmulatorPkg/build.sh
++= + b/EmulatorPkg/build.sh
@@ -209,21 +209,8 @@ fi
if [[ "$RUN_EMULATOR" =3D=3D "yes" ]]; then
  c= ase `uname` in
    Darwin*)
-      #
-     = ; # On Darwin we can't use dlopen, so we have to
load the real PE/COFF images.
-      # This .gdbinit script sets a b= reakpoint that
loads symbols for the PE/COFFEE
-     = ; # images that get loaded in Host
-    &= nbsp; #
-      if [[ "$CLANG_VE= R" =3D=3D *-ccc-host-triple* ]]
-     &nb= sp;then
-      # only older versions= of Xcode support -ccc-
host-tripe, for newer ve= rsions
-   &nb= sp;  # it is -target
-     &nbs= p;  cp $WORKSPACE/EmulatorPkg/Unix/lldbefi.py
"$BUILD_OUTPUT_DIR/${BUILDTARGET}_$TARGET_TOOLS/$PROCES
SOR"
-   &n= bsp;    cd $BUILD_ROOT_ARCH; /usr/bin/lldb --source
$WORKSPACE/EmulatorPkg/Unix/lldbinit Host
-      = ;  exit $?
-      else
-        cp $WORKSPACE/Emulat= orPkg/Unix/.gdbinit
"$BUILD_OUTPUT_DIR/${BUILDTA= RGET}_$TARGET_TOOLS/$PROCES
SOR"
-      fi
+ &= nbsp;    cd $BUILD_ROOT_ARCH; /usr/bin/lldb -o "command=
script import $WORKSPACE/EmulatorPkg/Unix/lldbe= fi.py" -
o 'script lldb.debugger.SetAsync(True)' -o "run" ./H= ost
+    =   exit $?
      ;;   esac

--
2.21.0.windows.1

<= br class=3D"">

=
--Apple-Mail=_639FF2B3-D1F3-4383-96B4-6FC705E6DD0E--