summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-08-13 00:22:20 +0000
committerJim Ingham <jingham@apple.com>2011-08-13 00:22:20 +0000
commit06942690b12724d7e419be8f555e09fd4cea1857 (patch)
treed2d900863d66bc11832056652435c36cb904994c /lldb
parent60726fab7802d2dc85448acf5946eb6e8a109edb (diff)
downloadbcm5719-llvm-06942690b12724d7e419be8f555e09fd4cea1857.tar.gz
bcm5719-llvm-06942690b12724d7e419be8f555e09fd4cea1857.zip
Add a version of SBDebugger::Create which allows us to specify whether to source
in the init files or not. llvm-svn: 137541
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/API/SBDebugger.h4
-rw-r--r--lldb/source/API/SBDebugger.cpp19
-rw-r--r--lldb/tools/driver/Driver.cpp12
3 files changed, 34 insertions, 1 deletions
diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h
index 91486a03374..2f130ac5622 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -25,9 +25,13 @@ public:
static void
Terminate();
+ // Deprecated, use the one that takes a source_init_files bool.
static lldb::SBDebugger
Create();
+ static lldb::SBDebugger
+ Create(bool source_init_files);
+
static void
Destroy (lldb::SBDebugger &debugger);
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 827892453a0..fc2da285f39 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -71,6 +71,12 @@ SBDebugger::Clear ()
SBDebugger
SBDebugger::Create()
{
+ return SBDebugger::Create(true);
+}
+
+SBDebugger
+SBDebugger::Create(bool source_init_files)
+{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBDebugger debugger;
@@ -83,6 +89,19 @@ SBDebugger::Create()
log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData());
}
+ SBCommandInterpreter interp = debugger.GetCommandInterpreter();
+ if (source_init_files)
+ {
+ interp.get()->SkipLLDBInitFiles(false);
+ interp.get()->SkipAppInitFiles (false);
+ SBCommandReturnObject result;
+ interp.SourceInitFileInHomeDirectory(result);
+ }
+ else
+ {
+ interp.get()->SkipLLDBInitFiles(true);
+ interp.get()->SkipAppInitFiles (true);
+ }
return debugger;
}
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 77899c353db..77b37d45643 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -83,7 +83,7 @@ static OptionDefinition g_options[] =
Driver::Driver () :
SBBroadcaster ("Driver"),
- m_debugger (SBDebugger::Create()),
+ m_debugger (SBDebugger::Create(false)),
m_editline_pty (),
m_editline_slave_fh (NULL),
m_editline_reader (),
@@ -478,6 +478,15 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exit)
}
}
+ // This is kind of a pain, but since we make the debugger in the Driver's constructor, we can't
+ // know at that point whether we should read in init files yet. So we don't read them in in the
+ // Driver constructor, then set the flags back to "read them in" here, and then if we see the
+ // "-n" flag, we'll turn it off again. Finally we have to read them in by hand later in the
+ // main loop.
+
+ m_debugger.SkipLLDBInitFiles (false);
+ m_debugger.SkipAppInitFiles (false);
+
// Prepare for & make calls to getopt_long.
#if __GLIBC__
optind = 0;
@@ -542,6 +551,7 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exit)
case 'n':
m_debugger.SkipLLDBInitFiles (true);
+ m_debugger.SkipAppInitFiles (true);
break;
case 'f':
OpenPOWER on IntegriCloud