summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Debugger.h2
-rw-r--r--lldb/include/lldb/Target/Process.h56
-rw-r--r--lldb/tools/driver/Driver.cpp43
3 files changed, 36 insertions, 65 deletions
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index 5ca4138726c..54b396643ac 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -276,6 +276,8 @@ public:
Destroy (lldb::DebuggerSP &debugger_sp);
~Debugger ();
+
+ void Clear();
lldb::DebuggerSP
GetSP ();
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index dba2a65fbd4..3bf87f9c3e5 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1364,59 +1364,14 @@ public:
virtual Error
ConnectRemote (const char *remote_url);
- //------------------------------------------------------------------
- /// List the processes matching the given partial name.
- ///
- /// FIXME: Is it too heavyweight to create an entire process object to do this?
- /// The problem is for remote processes we're going to have to set up the same transport
- /// to get this data as to actually attach. So we need to factor out transport
- /// and process before we can do this separately from the process.
- ///
- /// @param[in] name
- /// A partial name to match against the current process list.
- ///
- /// @param[out] matches
- /// The list of process names matching \a name.
- ///
- /// @param[in] pids
- /// A vector filled with the pids that correspond to the names in \a matches.
- ///
- /// @return
- /// Returns the number of matching processes.
- //------------------------------------------------------------------
-// virtual uint32_t
-// ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids);
-
- //------------------------------------------------------------------
- /// Find the architecture of a process by pid.
- ///
- /// FIXME: See comment for ListProcessesMatchingName.
- ///
- /// @param[in] pid
- /// A pid to inspect.
- ///
- /// @return
- /// Returns the architecture of the process or an invalid architecture if the process can't be found.
- //------------------------------------------------------------------
-// virtual ArchSpec
-// GetArchSpecForExistingProcess (lldb::pid_t pid);
+ bool
+ AttachedToProcess() const
+ {
+ return m_attached_to_process;
+ }
//------------------------------------------------------------------
- /// Find the architecture of a process by name.
- ///
- /// FIXME: See comment for ListProcessesMatchingName.
- ///
- /// @param[in] process_name
- /// The process name to inspect.
- ///
- /// @return
- /// Returns the architecture of the process or an invalid architecture if the process can't be found.
- //------------------------------------------------------------------
-// virtual ArchSpec
-// GetArchSpecForExistingProcess (const char *process_name);
-
- //------------------------------------------------------------------
/// Get the image information address for the current process.
///
/// Some runtimes have system functions that can help dynamic
@@ -2810,6 +2765,7 @@ protected:
std::string m_stdout_data;
MemoryCache m_memory_cache;
AllocatedMemoryCache m_allocated_memory_cache;
+ bool m_attached_to_process; /// Did we launch the process or attach to it?
typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP> LanguageRuntimeCollection;
LanguageRuntimeCollection m_language_runtimes;
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 1e0630e2d3e..856c08b3707 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -69,18 +69,33 @@ typedef struct
static OptionDefinition g_options[] =
{
- { LLDB_OPT_SET_1, true , "help" , 'h', no_argument , NULL, eArgTypeNone, "Prints out the usage information for the LLDB debugger." },
- { LLDB_OPT_SET_2, true , "version" , 'v', no_argument , NULL, eArgTypeNone, "Prints out the current version number of the LLDB debugger." },
- { LLDB_OPT_SET_3, true , "arch" , 'a', required_argument, NULL, eArgTypeArchitecture, "Tells the debugger to use the specified architecture when starting and running the program. <architecture> must be one of the architectures for which the program was compiled." },
- { LLDB_OPT_SET_3, true , "file" , 'f', required_argument, NULL, eArgTypeFilename, "Tells the debugger to use the file <filename> as the program to be debugged." },
- { LLDB_OPT_SET_4, true , "attach-name" , 'n', required_argument, NULL, eArgTypeProcessName, "Tells the debugger to attach to a process with the given name." },
- { LLDB_OPT_SET_4, true , "wait-for" , 'w', no_argument , NULL, eArgTypeNone, "Tells the debugger to wait for a process with the given pid or name to launch before attaching." },
- { LLDB_OPT_SET_5, true , "attach-pid" , 'p', required_argument, NULL, eArgTypePid, "Tells the debugger to attach to a process with the given pid." },
- { LLDB_3_TO_5, false, "script-language", 'l', required_argument, NULL, eArgTypeScriptLang, "Tells the debugger to use the specified scripting language for user-defined scripts, rather than the default. Valid scripting languages that can be specified include Python, Perl, Ruby and Tcl. Currently only the Python extensions have been implemented." },
- { LLDB_3_TO_5, false, "debug" , 'd', no_argument , NULL, eArgTypeNone, "Tells the debugger to print out extra information for debugging itself." },
- { LLDB_3_TO_5, false, "source" , 's', required_argument, NULL, eArgTypeFilename, "Tells the debugger to read in and execute the file <file>, which should contain lldb commands." },
- { LLDB_3_TO_5, false, "editor" , 'e', no_argument , NULL, eArgTypeNone, "Tells the debugger to open source files using the host's \"external editor\" mechanism." },
- { LLDB_3_TO_5, false, "no-lldbinit" , 'x', no_argument , NULL, eArgTypeNone, "Do not automatically parse any '.lldbinit' files." },
+ { LLDB_OPT_SET_1, true , "help" , 'h', no_argument , NULL, eArgTypeNone,
+ "Prints out the usage information for the LLDB debugger." },
+ { LLDB_OPT_SET_2, true , "version" , 'v', no_argument , NULL, eArgTypeNone,
+ "Prints out the current version number of the LLDB debugger." },
+ { LLDB_OPT_SET_3, true , "arch" , 'a', required_argument, NULL, eArgTypeArchitecture,
+ "Tells the debugger to use the specified architecture when starting and running the program. <architecture> must "
+ "be one of the architectures for which the program was compiled." },
+ { LLDB_OPT_SET_3, true , "file" , 'f', required_argument, NULL, eArgTypeFilename,
+ "Tells the debugger to use the file <filename> as the program to be debugged." },
+ { LLDB_OPT_SET_4, true , "attach-name" , 'n', required_argument, NULL, eArgTypeProcessName,
+ "Tells the debugger to attach to a process with the given name." },
+ { LLDB_OPT_SET_4, true , "wait-for" , 'w', no_argument , NULL, eArgTypeNone,
+ "Tells the debugger to wait for a process with the given pid or name to launch before attaching." },
+ { LLDB_OPT_SET_5, true , "attach-pid" , 'p', required_argument, NULL, eArgTypePid,
+ "Tells the debugger to attach to a process with the given pid." },
+ { LLDB_3_TO_5, false, "script-language", 'l', required_argument, NULL, eArgTypeScriptLang,
+ "Tells the debugger to use the specified scripting language for user-defined scripts, rather than the default. "
+ "Valid scripting languages that can be specified include Python, Perl, Ruby and Tcl. Currently only the Python "
+ "extensions have been implemented." },
+ { LLDB_3_TO_5, false, "debug" , 'd', no_argument , NULL, eArgTypeNone,
+ "Tells the debugger to print out extra information for debugging itself." },
+ { LLDB_3_TO_5, false, "source" , 's', required_argument, NULL, eArgTypeFilename,
+ "Tells the debugger to read in and execute the file <file>, which should contain lldb commands." },
+ { LLDB_3_TO_5, false, "editor" , 'e', no_argument , NULL, eArgTypeNone,
+ "Tells the debugger to open source files using the host's \"external editor\" mechanism." },
+ { LLDB_3_TO_5, false, "no-lldbinit" , 'x', no_argument , NULL, eArgTypeNone,
+ "Do not automatically parse any '.lldbinit' files." },
{ 0, false, NULL , 0 , 0 , NULL, eArgTypeNone, NULL }
};
@@ -1365,9 +1380,7 @@ Driver::MainLoop ()
}
}
- SBProcess process = m_debugger.GetSelectedTarget().GetProcess();
- if (process.IsValid())
- process.Destroy();
+ SBDebugger::Destroy (m_debugger);
}
}
}
OpenPOWER on IntegriCloud