From 4cc6f401c31cef9da670ad8f0fb964ad59587120 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Tue, 21 Jan 2014 14:47:05 +1100 Subject: [PATCH] Bug 960300 - Put a .lldbinit in the objdir and in dist/bin/, which load the .lldbinit in topsrcdir. r=glandium --- .lldbinit | 11 ++++++----- build/.lldbinit.in | 2 ++ build/Makefile.in | 20 ++++++++++++-------- 3 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 build/.lldbinit.in diff --git a/.lldbinit b/.lldbinit index 4a0a221557ff..b5cc7e7f11a4 100644 --- a/.lldbinit +++ b/.lldbinit @@ -5,6 +5,12 @@ # and in the accompanying Python scripts, see python/lldbutils/README.txt. # ----------------------------------------------------------------------------- +# Import the module that defines complex Gecko debugging commands. This assumes +# you are either running lldb from the top level source directory, the objdir, +# or the dist/bin directory. (.lldbinit files in the objdir and dist/bin set +# topsrcdir appropriately.) +script topsrcdir = topsrcdir if locals().has_key("topsrcdir") else "."; sys.path.append(os.path.join(topsrcdir, "python/lldbutils")); import lldbutils; lldbutils.init() + # Mozilla's use of UNIFIED_SOURCES to include multiple source files into a # single compiled file breaks lldb breakpoint setting. This works around that. # See http://lldb.llvm.org/troubleshooting.html for more info. @@ -15,11 +21,6 @@ settings set target.inline-breakpoint-strategy always # object as being of type "nsBlockFrame *" rather than "nsIFrame *". settings set target.prefer-dynamic-value run-target -# Import the module that defines complex Gecko debugging commands. Rather -# than do any kind of searching, this assumes that you are running lldb from -# the top level source directory. -script sys.path.append('python/lldbutils'); import lldbutils; lldbutils.init() - # Show the string value in atoms. type summary add nsIAtom --summary-string "${var.mString}" diff --git a/build/.lldbinit.in b/build/.lldbinit.in new file mode 100644 index 000000000000..425ca0f090b2 --- /dev/null +++ b/build/.lldbinit.in @@ -0,0 +1,2 @@ +#filter substitution +script topsrcdir = "@topsrcdir@"; lldb.debugger.HandleCommand("command source -s true '%s'" % os.path.join(topsrcdir, ".lldbinit")) diff --git a/build/Makefile.in b/build/Makefile.in index f75666fa275b..6f07573ab261 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -47,14 +47,18 @@ GDBINIT_FILES := $(topsrcdir)/.gdbinit GDBINIT_DEST = $(FINAL_TARGET) INSTALL_TARGETS += GDBINIT -# Put a useful .lldbinit in the bin directory, to be picked up automatically -# by LLDB when we debug executables using that directory as the current working -# directory. -# NOTE: Keep .lldbinit in the topsrcdir for people who run LLDB from the -# topsrcdir rather than the bin directory. -LLDBINIT_FILES := $(topsrcdir)/.lldbinit -LLDBINIT_DEST = $(FINAL_TARGET) -INSTALL_TARGETS += LLDBINIT +# Put a .lldbinit in the bin directory and the objdir, to be picked up +# automatically by LLDB when we debug executables using either of those two +# directories as the current working directory. The .lldbinit file will +# load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are. +LLDBINIT_OBJDIR := .lldbinit.in +LLDBINIT_OBJDIR_PATH = $(DEPTH) +LLDBINIT_OBJDIR_FLAGS += -Dtopsrcdir=$(abspath $(topsrcdir)) +PP_TARGETS += LLDBINIT_OBJDIR + +LLDBINIT_FINAL_TARGET_FILES := $(DEPTH)/.lldbinit +LLDBINIT_FINAL_TARGET_DEST = $(FINAL_TARGET) +INSTALL_TARGETS += LLDBINIT_FINAL_TARGET include $(topsrcdir)/config/rules.mk