]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmulatorPkg: Fix XCODE5 lldb issues
authorAndrew Fish <afish@apple.com>
Thu, 15 Aug 2019 16:50:01 +0000 (09:50 -0700)
committerMichael D Kinney <michael.d.kinney@intel.com>
Mon, 19 Aug 2019 16:57:25 +0000 (09:57 -0700)
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-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
EmulatorPkg/Unix/lldbefi.py
EmulatorPkg/build.sh

index 218326b8cb54d6b70c9a9ff66ce58b620074d6e1..7f99a7f83fcc313e74daf4197df7ee28da2521a0 100755 (executable)
@@ -346,6 +346,11 @@ def TypePrintFormating(debugger):
     debugger.HandleCommand("type summary add CHAR8 --python-function lldbefi.CHAR8_TypeSummary")\r
     debugger.HandleCommand('type summary add --regex "CHAR8 \[[0-9]+\]" --python-function lldbefi.CHAR8_TypeSummary')\r
 \r
+    debugger.HandleCommand(\r
+      'setting set frame-format "frame #${frame.index}: ${frame.pc}'\r
+      '{ ${module.file.basename}{:${function.name}()${function.pc-offset}}}'\r
+      '{ at ${line.file.fullpath}:${line.number}}\n"'\r
+      )\r
 \r
 gEmulatorBreakWorkaroundNeeded = True\r
 \r
@@ -381,15 +386,16 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , internal_dict):
     Error = lldb.SBError()\r
     FileNamePtr = frame.FindVariable ("FileName").GetValueAsUnsigned()\r
     FileNameLen = frame.FindVariable ("FileNameLength").GetValueAsUnsigned()\r
+\r
     FileName = frame.thread.process.ReadCStringFromMemory (FileNamePtr, FileNameLen, Error)\r
     if not Error.Success():\r
         print "!ReadCStringFromMemory() did not find a %d byte C string at %x" % (FileNameLen, FileNamePtr)\r
         # make breakpoint command contiue\r
-        frame.GetThread().GetProcess().Continue()\r
+        return False\r
 \r
     debugger = frame.thread.process.target.debugger\r
     if frame.FindVariable ("AddSymbolFlag").GetValueAsUnsigned() == 1:\r
-        LoadAddress = frame.FindVariable ("LoadAddress").GetValueAsUnsigned()\r
+        LoadAddress = frame.FindVariable ("LoadAddress").GetValueAsUnsigned() - 0x240\r
 \r
         debugger.HandleCommand ("target modules add  %s" % FileName)\r
         print "target modules load --slid 0x%x %s" % (LoadAddress, FileName)\r
@@ -405,7 +411,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , internal_dict):
                     print "!lldb.target.RemoveModule (%s) FAILED" % SBModule\r
 \r
     # make breakpoint command contiue\r
-    frame.thread.process.Continue()\r
+    return False\r
 \r
 def GuidToCStructStr (guid, Name=False):\r
   #\r
index 60056e1b6c2fd3dd4e3bcc4c343b167df9c61952..76c22dfaf8d4c2f5f352a54959cd6c81f3340dd3 100755 (executable)
@@ -209,21 +209,12 @@ fi
 if [[ "$RUN_EMULATOR" == "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" == *-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/$PROCESSOR"
-        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/$PROCESSOR"
-      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