aboutsummaryrefslogtreecommitdiffstats
path: root/source/Commands
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
committerEd Maste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
commit5e95aa85bb660d45e9905ef1d7180b2678280660 (patch)
tree3c2e41c3be19b7fc7666ed45a5f91ec3b6e35f2a /source/Commands
parent12bd4897ff0678fa663e09d78ebc22dd255ceb86 (diff)
downloadsrc-5e95aa85bb660d45e9905ef1d7180b2678280660.tar.gz
src-5e95aa85bb660d45e9905ef1d7180b2678280660.zip
Import LLDB as of upstream SVN 241361 (git 612c075f)vendor/lldb/lldb-r241361
Notes
Notes: svn path=/vendor/lldb/dist/; revision=285101 svn path=/vendor/lldb/lldb-r241361/; revision=285102; tag=vendor/lldb/lldb-r241361
Diffstat (limited to 'source/Commands')
-rw-r--r--source/Commands/CommandCompletions.cpp3
-rw-r--r--source/Commands/CommandObjectApropos.cpp3
-rw-r--r--source/Commands/CommandObjectArgs.cpp4
-rw-r--r--source/Commands/CommandObjectBreakpoint.cpp108
-rw-r--r--source/Commands/CommandObjectBreakpointCommand.cpp2
-rw-r--r--source/Commands/CommandObjectBugreport.cpp145
-rw-r--r--source/Commands/CommandObjectBugreport.h36
-rw-r--r--source/Commands/CommandObjectCommands.cpp264
-rw-r--r--source/Commands/CommandObjectDisassemble.cpp2
-rw-r--r--source/Commands/CommandObjectExpression.cpp6
-rw-r--r--source/Commands/CommandObjectFrame.cpp50
-rw-r--r--source/Commands/CommandObjectGUI.cpp2
-rw-r--r--source/Commands/CommandObjectHelp.cpp2
-rw-r--r--source/Commands/CommandObjectLanguage.cpp44
-rw-r--r--source/Commands/CommandObjectLanguage.h41
-rw-r--r--source/Commands/CommandObjectLog.cpp6
-rw-r--r--source/Commands/CommandObjectMemory.cpp44
-rw-r--r--source/Commands/CommandObjectMultiword.cpp38
-rw-r--r--source/Commands/CommandObjectPlatform.cpp25
-rw-r--r--source/Commands/CommandObjectPlugin.cpp2
-rw-r--r--source/Commands/CommandObjectProcess.cpp155
-rw-r--r--source/Commands/CommandObjectQuit.cpp3
-rw-r--r--source/Commands/CommandObjectRegister.cpp21
-rw-r--r--source/Commands/CommandObjectSettings.cpp5
-rw-r--r--source/Commands/CommandObjectSource.cpp12
-rw-r--r--source/Commands/CommandObjectSyntax.cpp2
-rw-r--r--source/Commands/CommandObjectTarget.cpp193
-rw-r--r--source/Commands/CommandObjectThread.cpp110
-rw-r--r--source/Commands/CommandObjectType.cpp4
-rw-r--r--source/Commands/CommandObjectVersion.cpp2
-rw-r--r--source/Commands/CommandObjectWatchpoint.cpp21
-rw-r--r--source/Commands/CommandObjectWatchpointCommand.cpp2
32 files changed, 907 insertions, 450 deletions
diff --git a/source/Commands/CommandCompletions.cpp b/source/Commands/CommandCompletions.cpp
index c65dd9d460f4..37696e3bbfdb 100644
--- a/source/Commands/CommandCompletions.cpp
+++ b/source/Commands/CommandCompletions.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
// C Includes
#include <sys/stat.h>
#if defined(__APPLE__) || defined(__linux__)
@@ -25,6 +23,7 @@
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Target/Target.h"
diff --git a/source/Commands/CommandObjectApropos.cpp b/source/Commands/CommandObjectApropos.cpp
index 02dc7269775d..47890b1e83b7 100644
--- a/source/Commands/CommandObjectApropos.cpp
+++ b/source/Commands/CommandObjectApropos.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectApropos.h"
// C Includes
@@ -17,6 +15,7 @@
// Project includes
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Interpreter/Property.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
diff --git a/source/Commands/CommandObjectArgs.cpp b/source/Commands/CommandObjectArgs.cpp
index b0fe42bc2446..cf32d104911c 100644
--- a/source/Commands/CommandObjectArgs.cpp
+++ b/source/Commands/CommandObjectArgs.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectArgs.h"
// C Includes
@@ -25,8 +23,10 @@
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Variable.h"
+#include "lldb/Target/ABI.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 025524b3b9a5..4cbcb70d5fd2 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectBreakpoint.h"
#include "CommandObjectBreakpointCommand.h"
@@ -21,12 +19,14 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Target/StackFrame.h"
@@ -110,9 +110,11 @@ public:
m_catch_bp (false),
m_throw_bp (true),
m_hardware (false),
- m_language (eLanguageTypeUnknown),
+ m_exception_language (eLanguageTypeUnknown),
m_skip_prologue (eLazyBoolCalculate),
- m_one_shot (false)
+ m_one_shot (false),
+ m_all_files (false),
+ m_move_to_nearest_code (eLazyBoolCalculate)
{
}
@@ -135,15 +137,23 @@ public:
}
break;
+ case 'A':
+ m_all_files = true;
+ break;
+
case 'b':
m_func_names.push_back (option_arg);
m_func_name_type_mask |= eFunctionNameTypeBase;
break;
case 'C':
- m_column = StringConvert::ToUInt32 (option_arg, 0);
+ {
+ bool success;
+ m_column = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
+ if (!success)
+ error.SetErrorStringWithFormat("invalid column number: %s", option_arg);
break;
-
+ }
case 'c':
m_condition.assign(option_arg);
break;
@@ -162,16 +172,16 @@ public:
case eLanguageTypeC:
case eLanguageTypeC99:
case eLanguageTypeC11:
- m_language = eLanguageTypeC;
+ m_exception_language = eLanguageTypeC;
break;
case eLanguageTypeC_plus_plus:
case eLanguageTypeC_plus_plus_03:
case eLanguageTypeC_plus_plus_11:
case eLanguageTypeC_plus_plus_14:
- m_language = eLanguageTypeC_plus_plus;
+ m_exception_language = eLanguageTypeC_plus_plus;
break;
case eLanguageTypeObjC:
- m_language = eLanguageTypeObjC;
+ m_exception_language = eLanguageTypeObjC;
break;
case eLanguageTypeObjC_plus_plus:
error.SetErrorStringWithFormat ("Set exception breakpoints separately for c++ and objective-c");
@@ -231,8 +241,28 @@ public:
break;
case 'l':
- m_line_num = StringConvert::ToUInt32 (option_arg, 0);
+ {
+ bool success;
+ m_line_num = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
+ if (!success)
+ error.SetErrorStringWithFormat ("invalid line number: %s.", option_arg);
+ break;
+ }
+
+ case 'm':
+ {
+ bool success;
+ bool value;
+ value = Args::StringToBoolean (option_arg, true, &success);
+ if (value)
+ m_move_to_nearest_code = eLazyBoolYes;
+ else
+ m_move_to_nearest_code = eLazyBoolNo;
+
+ if (!success)
+ error.SetErrorStringWithFormat ("Invalid boolean value for move-to-nearest-code option: '%s'", option_arg);
break;
+ }
case 'M':
m_func_names.push_back (option_arg);
@@ -253,6 +283,11 @@ public:
m_one_shot = true;
break;
+ case 'O':
+ m_exception_extra_args.AppendArgument ("-O");
+ m_exception_extra_args.AppendArgument (option_arg);
+ break;
+
case 'p':
m_source_text_regexp.assign (option_arg);
break;
@@ -334,11 +369,14 @@ public:
m_catch_bp = false;
m_throw_bp = true;
m_hardware = false;
- m_language = eLanguageTypeUnknown;
+ m_exception_language = eLanguageTypeUnknown;
m_skip_prologue = eLazyBoolCalculate;
m_one_shot = false;
m_use_dummy = false;
m_breakpoint_names.clear();
+ m_all_files = false;
+ m_exception_extra_args.Clear();
+ m_move_to_nearest_code = eLazyBoolCalculate;
}
const OptionDefinition*
@@ -372,10 +410,13 @@ public:
bool m_catch_bp;
bool m_throw_bp;
bool m_hardware; // Request to use hardware breakpoints
- lldb::LanguageType m_language;
+ lldb::LanguageType m_exception_language;
LazyBool m_skip_prologue;
bool m_one_shot;
bool m_use_dummy;
+ bool m_all_files;
+ Args m_exception_extra_args;
+ LazyBool m_move_to_nearest_code;
};
@@ -413,7 +454,7 @@ protected:
break_type = eSetTypeFunctionRegexp;
else if (!m_options.m_source_text_regexp.empty())
break_type = eSetTypeSourceRegexp;
- else if (m_options.m_language != eLanguageTypeUnknown)
+ else if (m_options.m_exception_language != eLanguageTypeUnknown)
break_type = eSetTypeException;
Breakpoint *bp = NULL;
@@ -453,7 +494,8 @@ protected:
check_inlines,
m_options.m_skip_prologue,
internal,
- m_options.m_hardware).get();
+ m_options.m_hardware,
+ m_options.m_move_to_nearest_code).get();
}
break;
@@ -505,7 +547,7 @@ protected:
{
const size_t num_files = m_options.m_filenames.GetSize();
- if (num_files == 0)
+ if (num_files == 0 && !m_options.m_all_files)
{
FileSpec file;
if (!GetDefaultFile (target, file, result))
@@ -534,15 +576,27 @@ protected:
&(m_options.m_filenames),
regexp,
internal,
- m_options.m_hardware).get();
+ m_options.m_hardware,
+ m_options.m_move_to_nearest_code).get();
}
break;
case eSetTypeException:
{
- bp = target->CreateExceptionBreakpoint (m_options.m_language,
+ Error precond_error;
+ bp = target->CreateExceptionBreakpoint (m_options.m_exception_language,
m_options.m_catch_bp,
m_options.m_throw_bp,
- m_options.m_hardware).get();
+ internal,
+ &m_options.m_exception_extra_args,
+ &precond_error).get();
+ if (precond_error.Fail())
+ {
+ result.AppendErrorWithFormat("Error setting extra exception arguments: %s",
+ precond_error.AsCString());
+ target->RemoveBreakpointByID(bp->GetID());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
}
break;
default:
@@ -654,6 +708,7 @@ private:
#define LLDB_OPT_FILE ( LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2 )
#define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10 )
#define LLDB_OPT_SKIP_PROLOGUE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) )
+#define LLDB_OPT_MOVE_TO_NEAREST_CODE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_9 )
OptionDefinition
CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
@@ -729,6 +784,9 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
"specified with the -f option. The -f option can be specified more than once. "
"If no source files are specified, uses the current \"default source file\"" },
+ { LLDB_OPT_SET_9, false, "all-files", 'A', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+ "All files are searched for source pattern matches." },
+
{ LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage,
"Set the breakpoint on exceptions thrown by the specified language (without options, on throw but not catch.)" },
@@ -738,6 +796,10 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_10, false, "on-catch", 'h', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
"Set the breakpoint on exception catcH." },
+// Don't add this option till it actually does something useful...
+// { LLDB_OPT_SET_10, false, "exception-typename", 'O', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeTypeName,
+// "The breakpoint will only stop if an exception Object of this type is thrown. Can be repeated multiple times to stop for multiple object types" },
+
{ LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
"sKip the prologue if the breakpoint is at the beginning of a function. If not set the target.skip-prologue setting is used." },
@@ -747,6 +809,9 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBreakpointName,
"Adds this to the list of names for this breakopint."},
+ { LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
+ "Move breakpoints to nearest code. If not set the target.move-to-nearest-code setting is used." },
+
{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -1940,15 +2005,15 @@ public:
{
case 'N':
if (BreakpointID::StringIsBreakpointName(option_value, error) && error.Success())
- m_name.SetValueFromCString(option_value);
+ m_name.SetValueFromString(option_value);
break;
case 'B':
- if (m_breakpoint.SetValueFromCString(option_value).Fail())
+ if (m_breakpoint.SetValueFromString(option_value).Fail())
error.SetErrorStringWithFormat ("unrecognized value \"%s\" for breakpoint", option_value);
break;
case 'D':
- if (m_use_dummy.SetValueFromCString(option_value).Fail())
+ if (m_use_dummy.SetValueFromString(option_value).Fail())
error.SetErrorStringWithFormat ("unrecognized value \"%s\" for use-dummy", option_value);
break;
@@ -2188,7 +2253,6 @@ public:
}
protected:
-protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
diff --git a/source/Commands/CommandObjectBreakpointCommand.cpp b/source/Commands/CommandObjectBreakpointCommand.cpp
index 8f8404b712a5..180ab600a50e 100644
--- a/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
// C Includes
// C++ Includes
diff --git a/source/Commands/CommandObjectBugreport.cpp b/source/Commands/CommandObjectBugreport.cpp
new file mode 100644
index 000000000000..f171d2f6267f
--- /dev/null
+++ b/source/Commands/CommandObjectBugreport.cpp
@@ -0,0 +1,145 @@
+//===-- CommandObjectBugreport.cpp ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CommandObjectBugreport.h"
+
+// C Includes
+#include <cstdio>
+
+// C++ Includes
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionGroupOutputFile.h"
+#include "lldb/Target/Thread.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+//-------------------------------------------------------------------------
+// "bugreport unwind"
+//-------------------------------------------------------------------------
+
+class CommandObjectBugreportUnwind : public CommandObjectParsed
+{
+public:
+ CommandObjectBugreportUnwind(CommandInterpreter &interpreter) :
+ CommandObjectParsed(interpreter,
+ "bugreport unwind",
+ "Create a bugreport for a bug in the stack unwinding code.",
+ nullptr),
+ m_option_group(interpreter),
+ m_outfile_options()
+ {
+ m_option_group.Append (&m_outfile_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);
+ m_option_group.Finalize();
+ }
+
+ ~CommandObjectBugreportUnwind()
+ {
+ }
+
+ Options *
+ GetOptions() override
+ {
+ return &m_option_group;
+ }
+
+protected:
+ bool
+ DoExecute(Args& command, CommandReturnObject &result) override
+ {
+ StringList commands;
+ commands.AppendString("thread backtrace");
+
+ Thread *thread = m_exe_ctx.GetThreadPtr();
+ if (thread)
+ {
+ char command_buffer[256];
+
+ uint32_t frame_count = thread->GetStackFrameCount();
+ for (uint32_t i = 0; i < frame_count; ++i)
+ {
+ StackFrameSP frame = thread->GetStackFrameAtIndex(i);
+ lldb::addr_t pc = frame->GetStackID().GetPC();
+
+ snprintf(command_buffer, sizeof(command_buffer), "disassemble --bytes --address 0x%" PRIx64, pc);
+ commands.AppendString(command_buffer);
+
+ snprintf(command_buffer, sizeof(command_buffer), "image show-unwind --address 0x%" PRIx64, pc);
+ commands.AppendString(command_buffer);
+ }
+ }
+
+ const FileSpec &outfile_spec = m_outfile_options.GetFile().GetCurrentValue();
+ if (outfile_spec)
+ {
+ char path[PATH_MAX];
+ outfile_spec.GetPath (path, sizeof(path));
+
+ uint32_t open_options = File::eOpenOptionWrite |
+ File::eOpenOptionCanCreate |
+ File::eOpenOptionAppend |
+ File::eOpenOptionCloseOnExec;
+
+ const bool append = m_outfile_options.GetAppend().GetCurrentValue();
+ if (!append)
+ open_options |= File::eOpenOptionTruncate;
+
+ StreamFileSP outfile_stream = std::make_shared<StreamFile>();
+ Error error = outfile_stream->GetFile().Open(path, open_options);
+ if (error.Fail())
+ {
+ result.AppendErrorWithFormat("Failed to open file '%s' for %s: %s\n",
+ path,
+ append ? "append" : "write",
+ error.AsCString());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ result.SetImmediateOutputStream(outfile_stream);
+ }
+
+ CommandInterpreterRunOptions options;
+ options.SetStopOnError(false);
+ options.SetEchoCommands(true);
+ options.SetPrintResults(true);
+ options.SetAddToHistory(false);
+ m_interpreter.HandleCommands(commands, &m_exe_ctx, options, result);
+
+ return result.Succeeded();
+ }
+
+private:
+ OptionGroupOptions m_option_group;
+ OptionGroupOutputFile m_outfile_options;
+};
+
+#pragma mark CommandObjectMultiwordBugreport
+
+//-------------------------------------------------------------------------
+// CommandObjectMultiwordBugreport
+//-------------------------------------------------------------------------
+
+CommandObjectMultiwordBugreport::CommandObjectMultiwordBugreport(CommandInterpreter &interpreter) :
+ CommandObjectMultiword(interpreter,
+ "bugreport",
+ "Set of commands for creating domain specific bugreports.",
+ "bugreport <subcommand> [<subcommand-options>]")
+{
+
+ LoadSubCommand("unwind", CommandObjectSP(new CommandObjectBugreportUnwind(interpreter)));
+}
+
+CommandObjectMultiwordBugreport::~CommandObjectMultiwordBugreport ()
+{
+}
diff --git a/source/Commands/CommandObjectBugreport.h b/source/Commands/CommandObjectBugreport.h
new file mode 100644
index 000000000000..d062e0d79373
--- /dev/null
+++ b/source/Commands/CommandObjectBugreport.h
@@ -0,0 +1,36 @@
+//===-- CommandObjectBugreport.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandObjectBugreport_h_
+#define liblldb_CommandObjectBugreport_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Interpreter/CommandObjectMultiword.h"
+
+namespace lldb_private {
+
+//-------------------------------------------------------------------------
+// CommandObjectMultiwordBugreport
+//-------------------------------------------------------------------------
+
+class CommandObjectMultiwordBugreport : public CommandObjectMultiword
+{
+public:
+ CommandObjectMultiwordBugreport(CommandInterpreter &interpreter);
+
+ virtual
+ ~CommandObjectMultiwordBugreport();
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandObjectBugreport_h_
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index f98eac055f24..5fd99cfdabf4 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectCommands.h"
// C Includes
@@ -29,7 +27,6 @@
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
using namespace lldb;
using namespace lldb_private;
@@ -85,7 +82,7 @@ protected:
switch (short_option)
{
case 'c':
- error = m_count.SetValueFromCString(option_arg,eVarSetOperationAssign);
+ error = m_count.SetValueFromString(option_arg,eVarSetOperationAssign);
break;
case 's':
if (option_arg && strcmp("end", option_arg) == 0)
@@ -94,10 +91,10 @@ protected:
m_start_idx.SetOptionWasSet();
}
else
- error = m_start_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
+ error = m_start_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
break;
case 'e':
- error = m_stop_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
+ error = m_stop_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
break;
case 'C':
m_clear.SetCurrentValue(true);
@@ -326,15 +323,15 @@ protected:
switch (short_option)
{
case 'e':
- error = m_stop_on_error.SetValueFromCString(option_arg);
+ error = m_stop_on_error.SetValueFromString(option_arg);
break;
case 'c':
- error = m_stop_on_continue.SetValueFromCString(option_arg);
+ error = m_stop_on_continue.SetValueFromString(option_arg);
break;
case 's':
- error = m_silent_run.SetValueFromCString(option_arg);
+ error = m_silent_run.SetValueFromString(option_arg);
break;
default:
@@ -1430,6 +1427,130 @@ protected:
};
+class CommandObjectScriptingObject : public CommandObjectRaw
+{
+private:
+ StructuredData::GenericSP m_cmd_obj_sp;
+ ScriptedCommandSynchronicity m_synchro;
+ bool m_fetched_help_short:1;
+ bool m_fetched_help_long:1;
+
+public:
+
+ CommandObjectScriptingObject (CommandInterpreter &interpreter,
+ std::string name,
+ StructuredData::GenericSP cmd_obj_sp,
+ ScriptedCommandSynchronicity synch) :
+ CommandObjectRaw (interpreter,
+ name.c_str(),
+ NULL,
+ NULL),
+ m_cmd_obj_sp(cmd_obj_sp),
+ m_synchro(synch),
+ m_fetched_help_short(false),
+ m_fetched_help_long(false)
+ {
+ StreamString stream;
+ stream.Printf("For more information run 'help %s'",name.c_str());
+ SetHelp(stream.GetData());
+ if (ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter())
+ GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp));
+ }
+
+ virtual
+ ~CommandObjectScriptingObject ()
+ {
+ }
+
+ virtual bool
+ IsRemovable () const
+ {
+ return true;
+ }
+
+ StructuredData::GenericSP
+ GetImplementingObject ()
+ {
+ return m_cmd_obj_sp;
+ }
+
+ ScriptedCommandSynchronicity
+ GetSynchronicity ()
+ {
+ return m_synchro;
+ }
+
+ virtual const char *
+ GetHelp ()
+ {
+ if (!m_fetched_help_short)
+ {
+ ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
+ if (scripter)
+ {
+ std::string docstring;
+ m_fetched_help_short = scripter->GetShortHelpForCommandObject(m_cmd_obj_sp,docstring);
+ if (!docstring.empty())
+ SetHelp(docstring);
+ }
+ }
+ return CommandObjectRaw::GetHelp();
+ }
+
+ virtual const char *
+ GetHelpLong ()
+ {
+ if (!m_fetched_help_long)
+ {
+ ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
+ if (scripter)
+ {
+ std::string docstring;
+ m_fetched_help_long = scripter->GetLongHelpForCommandObject(m_cmd_obj_sp,docstring);
+ if (!docstring.empty())
+ SetHelpLong(docstring);
+ }
+ }
+ return CommandObjectRaw::GetHelpLong();
+ }
+
+protected:
+ virtual bool
+ DoExecute (const char *raw_command_line, CommandReturnObject &result)
+ {
+ ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
+
+ Error error;
+
+ result.SetStatus(eReturnStatusInvalid);
+
+ if (!scripter || scripter->RunScriptBasedCommand(m_cmd_obj_sp,
+ raw_command_line,
+ m_synchro,
+ result,
+ error,
+ m_exe_ctx) == false)
+ {
+ result.AppendError(error.AsCString());
+ result.SetStatus(eReturnStatusFailed);
+ }
+ else
+ {
+ // Don't change the status if the command already set it...
+ if (result.GetStatus() == eReturnStatusInvalid)
+ {
+ if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ else
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ }
+ }
+
+ return result.Succeeded();
+ }
+
+};
+
//-------------------------------------------------------------------------
// CommandObjectCommandsScriptImport
//-------------------------------------------------------------------------
@@ -1449,7 +1570,7 @@ public:
// Define the first (and only) variant of this arg.
cmd_arg.arg_type = eArgTypeFilename;
- cmd_arg.arg_repetition = eArgRepeatPlain;
+ cmd_arg.arg_repetition = eArgRepeatPlus;
// There is only one variant this argument could be; put it into the argument entry.
arg1.push_back (cmd_arg);
@@ -1549,7 +1670,6 @@ protected:
bool
DoExecute (Args& command, CommandReturnObject &result)
{
-
if (m_interpreter.GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython)
{
result.AppendError ("only scripting language supported for module importing is currently Python");
@@ -1558,36 +1678,40 @@ protected:
}
size_t argc = command.GetArgumentCount();
-
- if (argc != 1)
+ if (0 == argc)
{
- result.AppendError ("'command script import' requires one argument");
+ result.AppendError("command script import needs one or more arguments");
result.SetStatus (eReturnStatusFailed);
return false;
}
- std::string path = command.GetArgumentAtIndex(0);
- Error error;
-
- const bool init_session = true;
- // FIXME: this is necessary because CommandObject::CheckRequirements() assumes that
- // commands won't ever be recursively invoked, but it's actually possible to craft
- // a Python script that does other "command script imports" in __lldb_init_module
- // the real fix is to have recursive commands possible with a CommandInvocation object
- // separate from the CommandObject itself, so that recursive command invocations
- // won't stomp on each other (wrt to execution contents, options, and more)
- m_exe_ctx.Clear();
- if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule(path.c_str(),
- m_options.m_allow_reload,
- init_session,
- error))
- {
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else
+ for (size_t i = 0;
+ i < argc;
+ i++)
{
- result.AppendErrorWithFormat("module importing failed: %s", error.AsCString());
- result.SetStatus (eReturnStatusFailed);
+ std::string path = command.GetArgumentAtIndex(i);
+ Error error;
+
+ const bool init_session = true;
+ // FIXME: this is necessary because CommandObject::CheckRequirements() assumes that
+ // commands won't ever be recursively invoked, but it's actually possible to craft
+ // a Python script that does other "command script imports" in __lldb_init_module
+ // the real fix is to have recursive commands possible with a CommandInvocation object
+ // separate from the CommandObject itself, so that recursive command invocations
+ // won't stomp on each other (wrt to execution contents, options, and more)
+ m_exe_ctx.Clear();
+ if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule(path.c_str(),
+ m_options.m_allow_reload,
+ init_session,
+ error))
+ {
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ }
+ else
+ {
+ result.AppendErrorWithFormat("module importing failed: %s", error.AsCString());
+ result.SetStatus (eReturnStatusFailed);
+ }
}
return result.Succeeded();
@@ -1652,7 +1776,11 @@ protected:
public:
CommandOptions (CommandInterpreter &interpreter) :
- Options (interpreter)
+ Options (interpreter),
+ m_class_name(),
+ m_funct_name(),
+ m_short_help(),
+ m_synchronicity(eScriptedCommandSynchronicitySynchronous)
{
}
@@ -1671,6 +1799,10 @@ protected:
if (option_arg)
m_funct_name.assign(option_arg);
break;
+ case 'c':
+ if (option_arg)
+ m_class_name.assign(option_arg);
+ break;
case 'h':
if (option_arg)
m_short_help.assign(option_arg);
@@ -1691,6 +1823,7 @@ protected:
void
OptionParsingStarting ()
{
+ m_class_name.clear();
m_funct_name.clear();
m_short_help.clear();
m_synchronicity = eScriptedCommandSynchronicitySynchronous;
@@ -1708,6 +1841,7 @@ protected:
// Instance variables to hold the values for command options.
+ std::string m_class_name;
std::string m_funct_name;
std::string m_short_help;
ScriptedCommandSynchronicity m_synchronicity;
@@ -1812,20 +1946,55 @@ protected:
m_short_help.assign(m_options.m_short_help);
m_synchronicity = m_options.m_synchronicity;
- if (m_options.m_funct_name.empty())
+ if (m_options.m_class_name.empty())
{
- m_interpreter.GetPythonCommandsFromIOHandler (" ", // Prompt
- *this, // IOHandlerDelegate
- true, // Run IOHandler in async mode
- NULL); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions
+ if (m_options.m_funct_name.empty())
+ {
+ m_interpreter.GetPythonCommandsFromIOHandler (" ", // Prompt
+ *this, // IOHandlerDelegate
+ true, // Run IOHandler in async mode
+ NULL); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions
+ }
+ else
+ {
+ CommandObjectSP new_cmd(new CommandObjectPythonFunction(m_interpreter,
+ m_cmd_name,
+ m_options.m_funct_name,
+ m_options.m_short_help,
+ m_synchronicity));
+ if (m_interpreter.AddUserCommand(m_cmd_name, new_cmd, true))
+ {
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ }
+ else
+ {
+ result.AppendError("cannot add command");
+ result.SetStatus (eReturnStatusFailed);
+ }
+ }
}
else
{
- CommandObjectSP new_cmd(new CommandObjectPythonFunction(m_interpreter,
- m_cmd_name,
- m_options.m_funct_name,
- m_options.m_short_help,
- m_synchronicity));
+ ScriptInterpreter *interpreter = GetCommandInterpreter().GetScriptInterpreter();
+ if (!interpreter)
+ {
+ result.AppendError("cannot find ScriptInterpreter");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ auto cmd_obj_sp = interpreter->CreateScriptCommandObject(m_options.m_class_name.c_str());
+ if (!cmd_obj_sp)
+ {
+ result.AppendError("cannot create helper object");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ CommandObjectSP new_cmd(new CommandObjectScriptingObject(m_interpreter,
+ m_cmd_name,
+ cmd_obj_sp,
+ m_synchronicity));
if (m_interpreter.AddUserCommand(m_cmd_name, new_cmd, true))
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
@@ -1859,8 +2028,9 @@ OptionDefinition
CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name."},
+ { LLDB_OPT_SET_2, false, "class", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonClass, "Name of the Python class to bind to this command name."},
{ LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeHelpText, "The help text to display for this command."},
- { LLDB_OPT_SET_1, false, "synchronicity", 's', OptionParser::eRequiredArgument, NULL, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."},
+ { LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, NULL, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."},
{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
diff --git a/source/Commands/CommandObjectDisassemble.cpp b/source/Commands/CommandObjectDisassemble.cpp
index 2ba47be1ecf0..1e575fe963f3 100644
--- a/source/Commands/CommandObjectDisassemble.cpp
+++ b/source/Commands/CommandObjectDisassemble.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectDisassemble.h"
// C Includes
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index e87399f97baa..f4bb8fbac11e 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectExpression.h"
// C Includes
@@ -196,7 +194,7 @@ CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interprete
"expression",
"Evaluate a C/ObjC/C++ expression in the current program context, using user defined variables and variables currently in scope.",
NULL,
- eFlagProcessMustBePaused | eFlagTryTargetAPILock),
+ eCommandProcessMustBePaused | eCommandTryTargetAPILock),
IOHandlerDelegate (IOHandlerDelegate::Completion::Expression),
m_option_group (interpreter),
m_format_options (eFormatDefault),
@@ -487,7 +485,7 @@ CommandObjectExpression::DoExecute
if (end_options)
{
- Args args (command, end_options - command);
+ Args args (llvm::StringRef(command, end_options - command));
if (!ParseOptions (args, result))
return false;
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 4458a692a189..d8b65e3b551a 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectFrame.h"
// C Includes
@@ -65,10 +63,10 @@ public:
"frame info",
"List information about the currently selected frame in the current thread.",
"frame info",
- eFlagRequiresFrame |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused )
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused )
{
}
@@ -156,10 +154,10 @@ public:
"frame select",
"Select a frame by index from within the current thread and make it the current frame.",
NULL,
- eFlagRequiresThread |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresThread |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -192,7 +190,7 @@ protected:
bool
DoExecute (Args& command, CommandReturnObject &result)
{
- // No need to check "thread" for validity as eFlagRequiresThread ensures it is valid
+ // No need to check "thread" for validity as eCommandRequiresThread ensures it is valid
Thread *thread = m_exe_ctx.GetThreadPtr();
uint32_t frame_idx = UINT32_MAX;
@@ -314,11 +312,11 @@ public:
"Children of aggregate variables can be specified such as "
"'var->child.x'.",
NULL,
- eFlagRequiresFrame |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused |
- eFlagRequiresProcess),
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused |
+ eCommandRequiresProcess),
m_option_group (interpreter),
m_option_variable(true), // Include the frame specific options by passing "true"
m_option_format (eFormatDefault),
@@ -385,7 +383,7 @@ protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
- // No need to check "frame" for validity as eFlagRequiresFrame ensures it is valid
+ // No need to check "frame" for validity as eCommandRequiresFrame ensures it is valid
StackFrame *frame = m_exe_ctx.GetFramePtr();
Stream &s = result.GetOutputStream();
@@ -522,30 +520,31 @@ protected:
{
var_sp = variable_list->GetVariableAtIndex(i);
bool dump_variable = true;
+ std::string scope_string;
switch (var_sp->GetScope())
{
case eValueTypeVariableGlobal:
dump_variable = m_option_variable.show_globals;
if (dump_variable && m_option_variable.show_scope)
- s.PutCString("GLOBAL: ");
+ scope_string = "GLOBAL: ";
break;
case eValueTypeVariableStatic:
dump_variable = m_option_variable.show_globals;
if (dump_variable && m_option_variable.show_scope)
- s.PutCString("STATIC: ");
+ scope_string = "STATIC: ";
break;
case eValueTypeVariableArgument:
dump_variable = m_option_variable.show_args;
if (dump_variable && m_option_variable.show_scope)
- s.PutCString(" ARG: ");
+ scope_string = " ARG: ";
break;
case eValueTypeVariableLocal:
dump_variable = m_option_variable.show_locals;
if (dump_variable && m_option_variable.show_scope)
- s.PutCString(" LOCAL: ");
+ scope_string = " LOCAL: ";
break;
default:
@@ -555,7 +554,7 @@ protected:
if (dump_variable)
{
// Use the variable object code to make sure we are
- // using the same APIs as the the public API will be
+ // using the same APIs as the public API will be
// using...
valobj_sp = frame->GetValueObjectForFrameVariable (var_sp,
m_varobj_options.use_dynamic);
@@ -568,6 +567,13 @@ protected:
// that are not in scope to avoid extra unneeded output
if (valobj_sp->IsInScope ())
{
+ if (false == valobj_sp->GetTargetSP()->GetDisplayRuntimeSupportValues() &&
+ true == valobj_sp->IsRuntimeSupportValue())
+ continue;
+
+ if (!scope_string.empty())
+ s.PutCString(scope_string.c_str());
+
if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile())
{
var_sp->GetDeclaration ().DumpStopContext (&s, false);
diff --git a/source/Commands/CommandObjectGUI.cpp b/source/Commands/CommandObjectGUI.cpp
index 359d6d2892d0..0991c7e84874 100644
--- a/source/Commands/CommandObjectGUI.cpp
+++ b/source/Commands/CommandObjectGUI.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectGUI.h"
// C Includes
diff --git a/source/Commands/CommandObjectHelp.cpp b/source/Commands/CommandObjectHelp.cpp
index b02515e2d1e8..18dc44a32b5a 100644
--- a/source/Commands/CommandObjectHelp.cpp
+++ b/source/Commands/CommandObjectHelp.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectHelp.h"
// C Includes
diff --git a/source/Commands/CommandObjectLanguage.cpp b/source/Commands/CommandObjectLanguage.cpp
new file mode 100644
index 000000000000..9d4b85630a1f
--- /dev/null
+++ b/source/Commands/CommandObjectLanguage.cpp
@@ -0,0 +1,44 @@
+//===-- CommandObjectLanguage.cpp -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CommandObjectLanguage.h"
+
+#include "lldb/Host/Host.h"
+
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+
+#include "lldb/Target/LanguageRuntime.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+CommandObjectLanguage::CommandObjectLanguage (CommandInterpreter &interpreter) :
+CommandObjectMultiword (interpreter,
+ "language",
+ "A set of commands for managing language-specific functionality.'.",
+ "language <language-name> <subcommand> [<subcommand-options>]"
+ )
+{
+ //Let the LanguageRuntime populates this command with subcommands
+ LanguageRuntime::InitializeCommands(this);
+}
+
+void
+CommandObjectLanguage::GenerateHelpText (Stream &output_stream) {
+ CommandObjectMultiword::GenerateHelpText(output_stream);
+
+ output_stream << "\nlanguage name can be one of the following:\n";
+
+ LanguageRuntime::PrintAllLanguages(output_stream, " ", "\n");
+}
+
+CommandObjectLanguage::~CommandObjectLanguage ()
+{
+}
diff --git a/source/Commands/CommandObjectLanguage.h b/source/Commands/CommandObjectLanguage.h
new file mode 100644
index 000000000000..751fe1440a8b
--- /dev/null
+++ b/source/Commands/CommandObjectLanguage.h
@@ -0,0 +1,41 @@
+//===-- CommandObjectLanguage.h ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandObjectLanguage_h_
+#define liblldb_CommandObjectLanguage_h_
+
+// C Includes
+// C++ Includes
+
+
+// Other libraries and framework includes
+// Project includes
+
+#include "lldb/lldb-types.h"
+#include "lldb/Interpreter/CommandObjectMultiword.h"
+
+namespace lldb_private {
+ class CommandObjectLanguage : public CommandObjectMultiword
+ {
+ public:
+ CommandObjectLanguage (CommandInterpreter &interpreter);
+
+ virtual
+ ~CommandObjectLanguage ();
+
+ virtual void
+ GenerateHelpText (Stream &output_stream);
+
+ protected:
+ bool
+ DoExecute (Args& command, CommandReturnObject &result);
+ };
+} // namespace lldb_private
+
+#endif // liblldb_CommandObjectLanguage_h_
diff --git a/source/Commands/CommandObjectLog.cpp b/source/Commands/CommandObjectLog.cpp
index aa09f53c792b..e68eaf17bb9f 100644
--- a/source/Commands/CommandObjectLog.cpp
+++ b/source/Commands/CommandObjectLog.cpp
@@ -7,16 +7,12 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectLog.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private-log.h"
-
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Host/FileSpec.h"
@@ -148,6 +144,7 @@ public:
case 'p': log_options |= LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD;break;
case 'n': log_options |= LLDB_LOG_OPTION_PREPEND_THREAD_NAME; break;
case 'S': log_options |= LLDB_LOG_OPTION_BACKTRACE; break;
+ case 'a': log_options |= LLDB_LOG_OPTION_APPEND; break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -225,6 +222,7 @@ CommandObjectLogEnable::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
{ LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
{ LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
+{ LLDB_OPT_SET_1, false, "append", 'a', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Append to the log file instead of overwriting." },
{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index dac6dd81651b..d589800299a3 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectMemory.h"
// C Includes
@@ -16,6 +14,7 @@
// C++ Includes
// Other libraries and framework includes
+#include "clang/AST/Decl.h"
// Project includes
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h"
@@ -24,6 +23,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectMemory.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
+#include "lldb/Expression/ClangPersistentVariables.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -95,7 +95,7 @@ public:
switch (short_option)
{
case 'l':
- error = m_num_per_line.SetValueFromCString (option_arg);
+ error = m_num_per_line.SetValueFromString (option_arg);
if (m_num_per_line.GetCurrentValue() == 0)
error.SetErrorStringWithFormat("invalid value for --num-per-line option '%s'", option_arg);
break;
@@ -105,7 +105,7 @@ public:
break;
case 't':
- error = m_view_as_type.SetValueFromCString (option_arg);
+ error = m_view_as_type.SetValueFromString (option_arg);
break;
case 'r':
@@ -313,7 +313,7 @@ public:
"memory read",
"Read from the memory of the process being debugged.",
NULL,
- eFlagRequiresTarget | eFlagProcessMustBePaused),
+ eCommandRequiresTarget | eCommandProcessMustBePaused),
m_option_group (interpreter),
m_format_options (eFormatBytesWithASCII, 1, 8),
m_memory_options (),
@@ -386,7 +386,7 @@ protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
- // No need to check "target" for validity as eFlagRequiresTarget ensures it is valid
+ // No need to check "target" for validity as eCommandRequiresTarget ensures it is valid
Target *target = m_exe_ctx.GetTargetPtr();
const size_t argc = command.GetArgumentCount();
@@ -532,7 +532,7 @@ protected:
clang::TypeDecl *tdecl = target->GetPersistentVariables().GetPersistentType(ConstString(lookup_type_name));
if (tdecl)
{
- clang_ast_type.SetClangType(&tdecl->getASTContext(),(lldb::clang_type_t)tdecl->getTypeForDecl());
+ clang_ast_type.SetClangType(&tdecl->getASTContext(),(const lldb::clang_type_t)tdecl->getTypeForDecl());
}
}
@@ -742,6 +742,7 @@ protected:
auto data_addr = addr;
auto count = item_count;
item_count = 0;
+ bool break_on_no_NULL = false;
while (item_count < count)
{
std::string buffer;
@@ -754,17 +755,24 @@ protected:
result.SetStatus(eReturnStatusFailed);
return false;
}
+
if (item_byte_size == read)
{
result.AppendWarningWithFormat("unable to find a NULL terminated string at 0x%" PRIx64 ".Consider increasing the maximum read length.\n", data_addr);
- break;
+ --read;
+ break_on_no_NULL = true;
}
- read+=1; // account for final NULL byte
+ else
+ ++read; // account for final NULL byte
+
memcpy(data_ptr, &buffer[0], read);
data_ptr += read;
data_addr += read;
bytes_read += read;
item_count++; // if we break early we know we only read item_count strings
+
+ if (break_on_no_NULL)
+ break;
}
data_sp.reset(new DataBufferHeap(data_sp->GetBytes(),bytes_read+1));
}
@@ -981,20 +989,20 @@ public:
switch (short_option)
{
case 'e':
- m_expr.SetValueFromCString(option_arg);
+ m_expr.SetValueFromString(option_arg);
break;
case 's':
- m_string.SetValueFromCString(option_arg);
+ m_string.SetValueFromString(option_arg);
break;
case 'c':
- if (m_count.SetValueFromCString(option_arg).Fail())
+ if (m_count.SetValueFromString(option_arg).Fail())
error.SetErrorString("unrecognized value for count");
break;
case 'o':
- if (m_offset.SetValueFromCString(option_arg).Fail())
+ if (m_offset.SetValueFromString(option_arg).Fail())
error.SetErrorString("unrecognized value for dump-offset");
break;
@@ -1024,7 +1032,7 @@ public:
"memory find",
"Find a value in the memory of the process being debugged.",
NULL,
- eFlagRequiresProcess | eFlagProcessMustBeLaunched),
+ eCommandRequiresProcess | eCommandProcessMustBeLaunched),
m_option_group (interpreter),
m_memory_options ()
{
@@ -1070,7 +1078,7 @@ protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
- // No need to check "process" for validity as eFlagRequiresProcess ensures it is valid
+ // No need to check "process" for validity as eCommandRequiresProcess ensures it is valid
Process *process = m_exe_ctx.GetProcessPtr();
const size_t argc = command.GetArgumentCount();
@@ -1325,7 +1333,7 @@ public:
"memory write",
"Write to the memory of the process being debugged.",
NULL,
- eFlagRequiresProcess | eFlagProcessMustBeLaunched),
+ eCommandRequiresProcess | eCommandProcessMustBeLaunched),
m_option_group (interpreter),
m_format_options (eFormatBytes, 1, UINT64_MAX),
m_memory_options ()
@@ -1402,7 +1410,7 @@ protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
- // No need to check "process" for validity as eFlagRequiresProcess ensures it is valid
+ // No need to check "process" for validity as eCommandRequiresProcess ensures it is valid
Process *process = m_exe_ctx.GetProcessPtr();
const size_t argc = command.GetArgumentCount();
@@ -1692,7 +1700,7 @@ public:
"memory history",
"Prints out the recorded stack traces for allocation/deallocation of a memory address.",
NULL,
- eFlagRequiresTarget | eFlagRequiresProcess | eFlagProcessMustBePaused | eFlagProcessMustBeLaunched)
+ eCommandRequiresTarget | eCommandRequiresProcess | eCommandProcessMustBePaused | eCommandProcessMustBeLaunched)
{
CommandArgumentEntry arg1;
CommandArgumentData addr_arg;
diff --git a/source/Commands/CommandObjectMultiword.cpp b/source/Commands/CommandObjectMultiword.cpp
index 69b178da46ba..2f0e2a78a0cc 100644
--- a/source/Commands/CommandObjectMultiword.cpp
+++ b/source/Commands/CommandObjectMultiword.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "lldb/Interpreter/CommandObjectMultiword.h"
// C Includes
// C++ Includes
@@ -153,7 +151,7 @@ CommandObjectMultiword::Execute(const char *args_string, CommandReturnObject &re
error_msg.append (GetCommandName());
error_msg.append (" ");
error_msg.append (sub_command);
- error_msg.append ("'");
+ error_msg.append ("'.");
if (num_subcmd_matches > 0)
{
@@ -251,23 +249,27 @@ CommandObjectMultiword::HandleCompletion
&temp_matches);
if (cmd_obj != NULL)
{
- matches.DeleteStringAtIndex (0);
- input.Shift();
- cursor_char_position = 0;
- input.AppendArgument ("");
- return cmd_obj->HandleCompletion (input,
- cursor_index,
- cursor_char_position,
- match_start_point,
- max_return_elements,
- word_complete,
- matches);
+ if (input.GetArgumentCount() == 1)
+ {
+ word_complete = true;
+ }
+ else
+ {
+ matches.DeleteStringAtIndex (0);
+ input.Shift();
+ cursor_char_position = 0;
+ input.AppendArgument ("");
+ return cmd_obj->HandleCompletion (input,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ word_complete,
+ matches);
+ }
}
- else
- return matches.GetSize();
}
- else
- return matches.GetSize();
+ return matches.GetSize();
}
else
{
diff --git a/source/Commands/CommandObjectPlatform.cpp b/source/Commands/CommandObjectPlatform.cpp
index 959c5cd1d0d7..866587fb4ebc 100644
--- a/source/Commands/CommandObjectPlatform.cpp
+++ b/source/Commands/CommandObjectPlatform.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectPlatform.h"
// C Includes
@@ -558,7 +556,7 @@ protected:
if (platform_sp)
{
if (m_option_working_dir.GetOptionValue().OptionWasSet())
- platform_sp->SetWorkingDirectory (ConstString(m_option_working_dir.GetOptionValue().GetCurrentValue().GetPath().c_str()));
+ platform_sp->SetWorkingDirectory(m_option_working_dir.GetOptionValue().GetCurrentValue());
}
else
{
@@ -572,10 +570,7 @@ protected:
GetOptions ()
{
if (m_options.DidFinalize() == false)
- {
- m_options.Append(new OptionPermissions());
m_options.Finalize();
- }
return &m_options;
}
protected:
@@ -621,7 +616,7 @@ public:
mode = options_permissions->m_permissions;
else
mode = lldb::eFilePermissionsUserRWX | lldb::eFilePermissionsGroupRWX | lldb::eFilePermissionsWorldRX;
- Error error = platform_sp->MakeDirectory(cmd_line.c_str(), mode);
+ Error error = platform_sp->MakeDirectory(FileSpec{cmd_line, false}, mode);
if (error.Success())
{
result.SetStatus (eReturnStatusSuccessFinishResult);
@@ -1201,7 +1196,7 @@ public:
}
else
{
- result.AppendMessageWithFormat("Eroor getting file size of %s (remote)\n", remote_file_path.c_str());
+ result.AppendMessageWithFormat("Error getting file size of %s (remote)\n", remote_file_path.c_str());
result.SetStatus (eReturnStatusFailed);
}
}
@@ -1241,8 +1236,8 @@ public:
const char* dst = args.GetArgumentAtIndex(1);
FileSpec src_fs(src, true);
- FileSpec dst_fs(dst, false);
-
+ FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString(), false);
+
PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
if (platform_sp)
{
@@ -1277,7 +1272,7 @@ public:
"platform process launch",
"Launch a new process on a remote platform.",
"platform process launch program",
- eFlagRequiresTarget | eFlagTryTargetAPILock),
+ eCommandRequiresTarget | eCommandTryTargetAPILock),
m_options (interpreter)
{
}
@@ -1975,7 +1970,7 @@ CommandObjectPlatformProcessAttach::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_ALL, false, "plugin", 'P' , OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
{ LLDB_OPT_SET_1, false, "pid", 'p' , OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
{ LLDB_OPT_SET_2, false, "name", 'n' , OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
- { LLDB_OPT_SET_2, false, "waitfor", 'w' , OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Wait for the the process with <process-name> to launch."},
+ { LLDB_OPT_SET_2, false, "waitfor", 'w' , OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
{ 0, false, NULL , 0 , 0 , NULL, NULL, 0, eArgTypeNone, NULL }
};
@@ -2085,7 +2080,7 @@ public:
CommandObjectPlatformShell (CommandInterpreter &interpreter) :
CommandObjectRaw (interpreter,
"platform shell",
- "Run a shell command on a the selected platform.",
+ "Run a shell command on the selected platform.",
"platform shell <shell-command>",
0),
m_options(interpreter)
@@ -2142,7 +2137,7 @@ public:
if (end_options)
{
- Args args (raw_command_line, end_options - raw_command_line);
+ Args args (llvm::StringRef(raw_command_line, end_options - raw_command_line));
if (!ParseOptions (args, result))
return false;
}
@@ -2155,7 +2150,7 @@ public:
Error error;
if (platform_sp)
{
- const char *working_dir = NULL;
+ FileSpec working_dir{};
std::string output;
int status = -1;
int signo = -1;
diff --git a/source/Commands/CommandObjectPlugin.cpp b/source/Commands/CommandObjectPlugin.cpp
index 658c077bc3ea..63fa4a82cf91 100644
--- a/source/Commands/CommandObjectPlugin.cpp
+++ b/source/Commands/CommandObjectPlugin.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectPlugin.h"
#include "lldb/Host/Host.h"
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index d47311e5cb5f..4414bdf2a2c8 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectProcess.h"
// C Includes
@@ -32,6 +30,7 @@
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Target/UnixSignals.h"
using namespace lldb;
using namespace lldb_private;
@@ -92,7 +91,7 @@ protected:
}
else
{
- Error destroy_error (process->Destroy());
+ Error destroy_error (process->Destroy(false));
if (destroy_error.Success())
{
result.SetStatus (eReturnStatusSuccessFinishResult);
@@ -124,7 +123,7 @@ public:
"process launch",
"Launch the executable in the debugger.",
NULL,
- eFlagRequiresTarget,
+ eCommandRequiresTarget,
"restart"),
m_options (interpreter)
{
@@ -249,9 +248,7 @@ protected:
if (launch_args.GetArgumentCount() == 0)
{
- Args target_setting_args;
- if (target->GetRunArguments(target_setting_args))
- m_options.launch_info.GetArguments().AppendArguments (target_setting_args);
+ m_options.launch_info.GetArguments().AppendArguments (target->GetProcessLaunchInfo().GetArguments());
}
else
{
@@ -265,13 +262,18 @@ protected:
if (error.Success())
{
- const char *archname = exe_module_sp->GetArchitecture().GetArchitectureName();
ProcessSP process_sp (target->GetProcessSP());
if (process_sp)
{
+ // There is a race condition where this thread will return up the call stack to the main command
+ // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
+ // a chance to call PushProcessIOHandler().
+ process_sp->SyncIOHandler (0, 2000);
+
const char *data = stream.GetData();
if (data && strlen(data) > 0)
result.AppendMessage(stream.GetData());
+ const char *archname = exe_module_sp->GetArchitecture().GetArchitectureName();
result.AppendMessageWithFormat ("Process %" PRIu64 " launched: '%s' (%s)\n", process_sp->GetID(), exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
result.SetStatus (eReturnStatusSuccessFinishResult);
result.SetDidChangeProcessState (true);
@@ -529,8 +531,6 @@ protected:
ModuleSP old_exec_module_sp = target->GetExecutableModule();
ArchSpec old_arch_spec = target->GetArchitecture();
- ProcessSP process_sp;
- Error error;
if (command.GetArgumentCount())
{
result.AppendErrorWithFormat("Invalid arguments for '%s'.\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
@@ -539,70 +539,21 @@ protected:
}
m_interpreter.UpdateExecutionContext(nullptr);
- ListenerSP listener_sp (new Listener("lldb.CommandObjectProcessAttach.DoExecute.attach.hijack"));
- m_options.attach_info.SetHijackListener(listener_sp);
-
- // If no process info was specified, then use the target executable
- // name as the process to attach to by default
- if (!m_options.attach_info.ProcessInfoSpecified ())
- {
- if (old_exec_module_sp)
- m_options.attach_info.GetExecutableFile().GetFilename() = old_exec_module_sp->GetPlatformFileSpec().GetFilename();
-
- if (!m_options.attach_info.ProcessInfoSpecified ())
- {
- error.SetErrorString ("no process specified, create a target with a file, or specify the --pid or --name command option");
- }
- }
-
+ StreamString stream;
+ const auto error = target->Attach(m_options.attach_info, &stream);
if (error.Success())
{
- if (state != eStateConnected && platform_sp != nullptr && platform_sp->CanDebugProcess())
- {
- target->SetPlatform(platform_sp);
- process = platform_sp->Attach(m_options.attach_info, m_interpreter.GetDebugger(), target, error).get();
- }
- else
- {
- if (state != eStateConnected)
- {
- const char *plugin_name = m_options.attach_info.GetProcessPluginName();
- process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name, nullptr).get();
- if (process == nullptr)
- error.SetErrorStringWithFormat("failed to create process using plugin %s", plugin_name);
- }
- if (process)
- {
- process->HijackProcessEvents(listener_sp.get());
- error = process->Attach(m_options.attach_info);
- }
- }
- }
-
- if (error.Success() && process != nullptr)
- {
- result.SetStatus (eReturnStatusSuccessContinuingNoResult);
- StreamString stream;
- StateType state = process->WaitForProcessToStop (nullptr, nullptr, false, listener_sp.get(), &stream);
-
- process->RestoreProcessEvents();
- result.SetDidChangeProcessState (true);
-
- if (stream.GetData())
- result.AppendMessage(stream.GetData());
-
- if (state == eStateStopped)
+ ProcessSP process_sp (target->GetProcessSP());
+ if (process_sp)
{
+ if (stream.GetData())
+ result.AppendMessage(stream.GetData());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ result.SetDidChangeProcessState (true);
}
else
{
- const char *exit_desc = process->GetExitDescription();
- if (exit_desc)
- result.AppendErrorWithFormat ("attach failed: %s", exit_desc);
- else
- result.AppendError ("attach failed: process did not stop (no such process or permission problem?)");
- process->Destroy();
+ result.AppendError("no error returned from Target::Attach, and target has no process");
result.SetStatus (eReturnStatusFailed);
}
}
@@ -686,10 +637,10 @@ public:
"process continue",
"Continue execution of all threads in the current process.",
"process continue",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options(interpreter)
{
}
@@ -809,6 +760,8 @@ protected:
}
}
+ const uint32_t iohandler_id = process->GetIOHandlerID();
+
StreamString stream;
Error error;
if (synchronous_execution)
@@ -819,9 +772,9 @@ protected:
if (error.Success())
{
// There is a race condition where this thread will return up the call stack to the main command
- // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
- // a chance to call PushProcessIOHandler().
- process->SyncIOHandler(2000);
+ // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
+ // a chance to call PushProcessIOHandler().
+ process->SyncIOHandler(iohandler_id, 2000);
result.AppendMessageWithFormat ("Process %" PRIu64 " resuming\n", process->GetID());
if (synchronous_execution)
@@ -947,9 +900,9 @@ public:
"process detach",
"Detach from the current process being debugged.",
"process detach",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched),
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched),
m_options(interpreter)
{
}
@@ -1228,10 +1181,10 @@ public:
"process load",
"Load a shared library into the current process.",
"process load <filename> [<filename> ...]",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused )
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused )
{
}
@@ -1285,10 +1238,10 @@ public:
"process unload",
"Unload a shared library from the current process using the index returned by a previous call to \"process load\".",
"process unload <index>",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused )
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused )
{
}
@@ -1349,7 +1302,7 @@ public:
"process signal",
"Send a UNIX signal to the current process being debugged.",
NULL,
- eFlagRequiresProcess | eFlagTryTargetAPILock)
+ eCommandRequiresProcess | eCommandTryTargetAPILock)
{
CommandArgumentEntry arg;
CommandArgumentData signal_arg;
@@ -1431,9 +1384,9 @@ public:
"process interrupt",
"Interrupt the current process being debugged.",
"process interrupt",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched)
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched)
{
}
@@ -1493,9 +1446,9 @@ public:
"process kill",
"Terminate the current process being debugged.",
"process kill",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched)
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched)
{
}
@@ -1518,7 +1471,7 @@ protected:
if (command.GetArgumentCount() == 0)
{
- Error error (process->Destroy());
+ Error error (process->Destroy(true));
if (error.Success())
{
result.SetStatus (eReturnStatusSuccessFinishResult);
@@ -1554,9 +1507,9 @@ public:
"process save-core",
"Save the current process as a core file using an appropriate file type.",
"process save-core FILE",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched)
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched)
{
}
@@ -1618,7 +1571,7 @@ public:
"process status",
"Show the current status and location of executing process.",
"process status",
- eFlagRequiresProcess | eFlagTryTargetAPILock)
+ eCommandRequiresProcess | eCommandTryTargetAPILock)
{
}
@@ -1632,7 +1585,7 @@ public:
{
Stream &strm = result.GetOutputStream();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
- // No need to check "process" for validity as eFlagRequiresProcess ensures it is valid
+ // No need to check "process" for validity as eCommandRequiresProcess ensures it is valid
Process *process = m_exe_ctx.GetProcessPtr();
const bool only_threads_with_stop_reason = true;
const uint32_t start_frame = 0;
@@ -1776,8 +1729,8 @@ public:
void
PrintSignalHeader (Stream &str)
{
- str.Printf ("NAME PASS STOP NOTIFY\n");
- str.Printf ("========== ===== ===== ======\n");
+ str.Printf ("NAME PASS STOP NOTIFY\n");
+ str.Printf ("=========== ===== ===== ======\n");
}
void
@@ -1787,7 +1740,7 @@ public:
bool suppress;
bool notify;
- str.Printf ("%-10s ", sig_name);
+ str.Printf ("%-11s ", sig_name);
if (signals.GetSignalInfo (signo, suppress, stop, notify))
{
bool pass = !suppress;
diff --git a/source/Commands/CommandObjectQuit.cpp b/source/Commands/CommandObjectQuit.cpp
index dd0efc61b2d0..31f82b987c1c 100644
--- a/source/Commands/CommandObjectQuit.cpp
+++ b/source/Commands/CommandObjectQuit.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectQuit.h"
// C Includes
@@ -17,6 +15,7 @@
// Project includes
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Target/Process.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Commands/CommandObjectRegister.cpp b/source/Commands/CommandObjectRegister.cpp
index 81b79b8cd8b2..fae5af42f405 100644
--- a/source/Commands/CommandObjectRegister.cpp
+++ b/source/Commands/CommandObjectRegister.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectRegister.h"
// C Includes
@@ -25,6 +23,7 @@
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionGroupFormat.h"
#include "lldb/Interpreter/OptionValueArray.h"
+#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
@@ -47,10 +46,10 @@ public:
"register read",
"Dump the contents of one or more register values from the current frame. If no register is specified, dumps them all.",
NULL,
- eFlagRequiresFrame |
- eFlagRequiresRegContext |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresFrame |
+ eCommandRequiresRegContext |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_format_options (eFormatDefault),
m_command_options ()
@@ -143,7 +142,7 @@ public:
const RegisterSet * const reg_set = reg_ctx->GetRegisterSet(set_idx);
if (reg_set)
{
- strm.Printf ("%s:\n", reg_set->name);
+ strm.Printf ("%s:\n", (reg_set->name ? reg_set->name : "unknown") );
strm.IndentMore ();
const size_t num_registers = reg_set->num_registers;
for (size_t reg_idx = 0; reg_idx < num_registers; ++reg_idx)
@@ -376,10 +375,10 @@ public:
"register write",
"Modify a single register value.",
NULL,
- eFlagRequiresFrame |
- eFlagRequiresRegContext |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused)
+ eCommandRequiresFrame |
+ eCommandRequiresRegContext |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused)
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
diff --git a/source/Commands/CommandObjectSettings.cpp b/source/Commands/CommandObjectSettings.cpp
index ed677afabcb5..ccbf98c767f1 100644
--- a/source/Commands/CommandObjectSettings.cpp
+++ b/source/Commands/CommandObjectSettings.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectSettings.h"
// C Includes
@@ -18,6 +16,7 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/CommandCompletions.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
using namespace lldb;
using namespace lldb_private;
@@ -243,7 +242,7 @@ protected:
// Split the raw command into var_name and value pair.
llvm::StringRef raw_str(command);
std::string var_value_string = raw_str.split(var_name).second.str();
- const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false);
+ const char *var_value_cstr = Args::StripSpaces(var_value_string, true, false, false);
Error error;
if (m_options.m_global)
diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index a88a9b1f0cac..7c5f127cb51a 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectSource.h"
// C Includes
@@ -253,7 +251,7 @@ public:
"source list",
"Display source code (as specified) based on the current executable's debug info.",
NULL,
- eFlagRequiresTarget),
+ eCommandRequiresTarget),
m_options (interpreter)
{
}
@@ -539,9 +537,9 @@ protected:
{
SymbolContext sc;
sc_list_symbols.GetContextAtIndex (i, sc);
- if (sc.symbol)
+ if (sc.symbol && sc.symbol->ValueIsAddress())
{
- const Address &base_address = sc.symbol->GetAddress();
+ const Address &base_address = sc.symbol->GetAddressRef();
Function *function = base_address.CalculateSymbolContextFunction();
if (function)
{
@@ -690,13 +688,15 @@ protected:
bool show_module = true;
bool show_inlined_frames = true;
const bool show_function_arguments = true;
+ const bool show_function_name = true;
sc.DumpStopContext(&result.GetOutputStream(),
m_exe_ctx.GetBestExecutionContextScope(),
sc.line_entry.range.GetBaseAddress(),
show_fullpaths,
show_module,
show_inlined_frames,
- show_function_arguments);
+ show_function_arguments,
+ show_function_name);
result.GetOutputStream().EOL();
if (m_options.num_lines == 0)
diff --git a/source/Commands/CommandObjectSyntax.cpp b/source/Commands/CommandObjectSyntax.cpp
index 5093c3b99339..e9fa084fc0b5 100644
--- a/source/Commands/CommandObjectSyntax.cpp
+++ b/source/Commands/CommandObjectSyntax.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectSyntax.h"
// C Includes
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 9188283966f1..448da0ede245 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectTarget.h"
// C Includes
@@ -50,6 +48,7 @@
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/ABI.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/StackFrame.h"
@@ -388,6 +387,12 @@ protected:
core_file.GetPath(core_path, sizeof(core_path));
if (core_file.Exists())
{
+ if (!core_file.Readable())
+ {
+ result.AppendMessageWithFormat ("Core file '%s' is not readable.\n", core_path);
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
FileSpec core_file_dir;
core_file_dir.GetDirectory() = core_file.GetDirectory();
target_sp->GetExecutableSearchPaths ().Append (core_file_dir);
@@ -600,10 +605,20 @@ public:
"Delete one or more targets by target index.",
NULL,
0),
- m_option_group (interpreter),
- m_cleanup_option (LLDB_OPT_SET_1, false, "clean", 'c', "Perform extra cleanup to minimize memory consumption after deleting the target.", false, false)
- {
- m_option_group.Append (&m_cleanup_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group(interpreter),
+ m_all_option(LLDB_OPT_SET_1, false, "all", 'a', "Delete all targets.", false, true),
+ m_cleanup_option(
+ LLDB_OPT_SET_1,
+ false,
+ "clean", 'c',
+ "Perform extra cleanup to minimize memory consumption after deleting the target. "
+ "By default, LLDB will keep in memory any modules previously loaded by the target as well "
+ "as all of its debug info. Specifying --clean will unload all of these shared modules and "
+ "cause them to be reparsed again the next time the target is run",
+ false, true)
+ {
+ m_option_group.Append(&m_all_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Append(&m_cleanup_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
@@ -625,90 +640,89 @@ protected:
const size_t argc = args.GetArgumentCount();
std::vector<TargetSP> delete_target_list;
TargetList &target_list = m_interpreter.GetDebugger().GetTargetList();
- bool success = true;
TargetSP target_sp;
- if (argc > 0)
+
+ if (m_all_option.GetOptionValue())
+ {
+ for (int i = 0; i < target_list.GetNumTargets(); ++i)
+ delete_target_list.push_back(target_list.GetTargetAtIndex(i));
+ }
+ else if (argc > 0)
{
const uint32_t num_targets = target_list.GetNumTargets();
// Bail out if don't have any targets.
if (num_targets == 0) {
result.AppendError("no targets to delete");
result.SetStatus(eReturnStatusFailed);
- success = false;
+ return false;
}
- for (uint32_t arg_idx = 0; success && arg_idx < argc; ++arg_idx)
+ for (uint32_t arg_idx = 0; arg_idx < argc; ++arg_idx)
{
const char *target_idx_arg = args.GetArgumentAtIndex(arg_idx);
+ bool success = false;
uint32_t target_idx = StringConvert::ToUInt32 (target_idx_arg, UINT32_MAX, 0, &success);
- if (success)
+ if (!success)
{
- if (target_idx < num_targets)
- {
- target_sp = target_list.GetTargetAtIndex (target_idx);
- if (target_sp)
- {
- delete_target_list.push_back (target_sp);
- continue;
- }
- }
- if (num_targets > 1)
- result.AppendErrorWithFormat ("target index %u is out of range, valid target indexes are 0 - %u\n",
- target_idx,
- num_targets - 1);
- else
- result.AppendErrorWithFormat("target index %u is out of range, the only valid index is 0\n",
- target_idx);
-
+ result.AppendErrorWithFormat("invalid target index '%s'\n", target_idx_arg);
result.SetStatus (eReturnStatusFailed);
- success = false;
+ return false;
}
- else
+ if (target_idx < num_targets)
{
- result.AppendErrorWithFormat("invalid target index '%s'\n", target_idx_arg);
- result.SetStatus (eReturnStatusFailed);
- success = false;
+ target_sp = target_list.GetTargetAtIndex (target_idx);
+ if (target_sp)
+ {
+ delete_target_list.push_back (target_sp);
+ continue;
+ }
}
+ if (num_targets > 1)
+ result.AppendErrorWithFormat ("target index %u is out of range, valid target indexes are 0 - %u\n",
+ target_idx,
+ num_targets - 1);
+ else
+ result.AppendErrorWithFormat("target index %u is out of range, the only valid index is 0\n",
+ target_idx);
+
+ result.SetStatus (eReturnStatusFailed);
+ return false;
}
}
else
{
target_sp = target_list.GetSelectedTarget();
- if (target_sp)
- {
- delete_target_list.push_back (target_sp);
- }
- else
+ if (!target_sp)
{
result.AppendErrorWithFormat("no target is currently selected\n");
result.SetStatus (eReturnStatusFailed);
- success = false;
+ return false;
}
+ delete_target_list.push_back (target_sp);
}
- if (success)
+
+ const size_t num_targets_to_delete = delete_target_list.size();
+ for (size_t idx = 0; idx < num_targets_to_delete; ++idx)
{
- const size_t num_targets_to_delete = delete_target_list.size();
- for (size_t idx = 0; idx < num_targets_to_delete; ++idx)
- {
- target_sp = delete_target_list[idx];
- target_list.DeleteTarget(target_sp);
- target_sp->Destroy();
- }
- // If "--clean" was specified, prune any orphaned shared modules from
- // the global shared module list
- if (m_cleanup_option.GetOptionValue ())
- {
- const bool mandatory = true;
- ModuleList::RemoveOrphanSharedModules(mandatory);
- }
- result.GetOutputStream().Printf("%u targets deleted.\n", (uint32_t)num_targets_to_delete);
- result.SetStatus(eReturnStatusSuccessFinishResult);
+ target_sp = delete_target_list[idx];
+ target_list.DeleteTarget(target_sp);
+ target_sp->Destroy();
+ }
+ // If "--clean" was specified, prune any orphaned shared modules from
+ // the global shared module list
+ if (m_cleanup_option.GetOptionValue ())
+ {
+ const bool mandatory = true;
+ ModuleList::RemoveOrphanSharedModules(mandatory);
}
+ result.GetOutputStream().Printf("%u targets deleted.\n", (uint32_t)num_targets_to_delete);
+ result.SetStatus(eReturnStatusSuccessFinishResult);
- return result.Succeeded();
+ return true;
}
OptionGroupOptions m_option_group;
+ OptionGroupBoolean m_all_option;
OptionGroupBoolean m_cleanup_option;
};
@@ -730,7 +744,7 @@ public:
"target variable",
"Read global variable(s) prior to, or while running your binary.",
NULL,
- eFlagRequiresTarget),
+ eCommandRequiresTarget),
m_option_group (interpreter),
m_option_variable (false), // Don't include frame options
m_option_format (eFormatDefault),
@@ -773,6 +787,10 @@ public:
{
DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions());
+ if (false == valobj_sp->GetTargetSP()->GetDisplayRuntimeSupportValues() &&
+ true == valobj_sp->IsRuntimeSupportValue())
+ return;
+
switch (var_sp->GetScope())
{
case eValueTypeVariableGlobal:
@@ -1722,17 +1740,16 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod
DumpFullpath (strm, &module->GetFileSpec(), 0);
strm.PutCString(":\n");
strm.IndentMore ();
- //Symtab::DumpSymbolHeader (&strm);
for (i=0; i < num_matches; ++i)
{
Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]);
- DumpAddress (interpreter.GetExecutionContext().GetBestExecutionContextScope(),
- symbol->GetAddress(),
- verbose,
- strm);
-
-// strm.Indent ();
-// symbol->Dump (&strm, interpreter.GetExecutionContext().GetTargetPtr(), i);
+ if (symbol && symbol->ValueIsAddress())
+ {
+ DumpAddress (interpreter.GetExecutionContext().GetBestExecutionContextScope(),
+ symbol->GetAddressRef(),
+ verbose,
+ strm);
+ }
}
strm.IndentLess ();
return num_matches;
@@ -2547,7 +2564,7 @@ public:
"target modules dump line-table",
"Dump the line table for one or more compilation units.",
NULL,
- eFlagRequiresTarget)
+ eCommandRequiresTarget)
{
}
@@ -3462,28 +3479,24 @@ protected:
case 's':
case 'S':
{
- SymbolVendor *symbol_vendor = module->GetSymbolVendor();
+ const SymbolVendor *symbol_vendor = module->GetSymbolVendor();
if (symbol_vendor)
{
- SymbolFile *symbol_file = symbol_vendor->GetSymbolFile();
- if (symbol_file)
+ const FileSpec symfile_spec = symbol_vendor->GetMainFileSpec();
+ if (format_char == 'S')
{
- if (format_char == 'S')
+ // Dump symbol file only if different from module file
+ if (!symfile_spec || symfile_spec == module->GetFileSpec())
{
- FileSpec &symfile_spec = symbol_file->GetObjectFile()->GetFileSpec();
- // Dump symbol file only if different from module file
- if (!symfile_spec || symfile_spec == module->GetFileSpec())
- {
- print_space = false;
- break;
- }
- // Add a newline and indent past the index
- strm.Printf ("\n%*s", indent, "");
+ print_space = false;
+ break;
}
- DumpFullpath (strm, &symbol_file->GetObjectFile()->GetFileSpec(), width);
- dump_object_name = true;
- break;
+ // Add a newline and indent past the index
+ strm.Printf ("\n%*s", indent, "");
}
+ DumpFullpath (strm, &symfile_spec, width);
+ dump_object_name = true;
+ break;
}
strm.Printf("%.*s", width, "<NONE>");
}
@@ -3641,10 +3654,10 @@ public:
"target modules show-unwind",
"Show synthesized unwind instructions for a function.",
NULL,
- eFlagRequiresTarget |
- eFlagRequiresProcess |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresTarget |
+ eCommandRequiresProcess |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options (interpreter)
{
}
@@ -3767,7 +3780,7 @@ protected:
{
result.GetOutputStream().Printf("Synchronous (restricted to call-sites) UnwindPlan is '%s'\n", callsite_unwind_plan->GetSourceName().AsCString());
}
- UnwindPlanSP fast_unwind_plan = func_unwinders_sp->GetUnwindPlanFastUnwind(*thread.get());
+ UnwindPlanSP fast_unwind_plan = func_unwinders_sp->GetUnwindPlanFastUnwind(*target, *thread.get());
if (fast_unwind_plan.get())
{
result.GetOutputStream().Printf("Fast UnwindPlan is '%s'\n", fast_unwind_plan->GetSourceName().AsCString());
@@ -4001,7 +4014,7 @@ public:
"target modules lookup",
"Look up information within executable and dependent shared library images.",
NULL,
- eFlagRequiresTarget),
+ eCommandRequiresTarget),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -4381,7 +4394,7 @@ public:
CommandObjectParsed (interpreter,
"target symbols add",
"Add a debug symbol file to one of the target's current modules by specifying a path to a debug symbols file, or using the options to specify a module to download symbols for.",
- "target symbols add [<symfile>]", eFlagRequiresTarget),
+ "target symbols add [<symfile>]", eCommandRequiresTarget),
m_option_group (interpreter),
m_file_option (LLDB_OPT_SET_1, false, "shlib", 's', CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Fullpath or basename for module to find debug symbols for."),
m_current_frame_option (LLDB_OPT_SET_2, false, "frame", 'F', "Locate the debug symbols the currently selected frame.", false, true)
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index 199d16b85205..5f38ad4900d6 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectThread.h"
// C Includes
@@ -18,6 +16,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/State.h"
#include "lldb/Core/SourceManager.h"
+#include "lldb/Core/ValueObject.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -240,11 +239,11 @@ public:
"thread backtrace",
"Show the stack for one or more threads. If no threads are specified, show the currently selected thread. Use the thread-index \"all\" to see all threads.",
NULL,
- eFlagRequiresProcess |
- eFlagRequiresThread |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresProcess |
+ eCommandRequiresThread |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options(interpreter)
{
}
@@ -432,6 +431,12 @@ public:
m_step_in_avoid_no_debug = eLazyBoolCalculate;
m_step_out_avoid_no_debug = eLazyBoolCalculate;
m_run_mode = eOnlyDuringStepping;
+
+ // Check if we are in Non-Stop mode
+ lldb::TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
+ if (target_sp.get() != nullptr && target_sp->GetNonStopModeEnabled())
+ m_run_mode = eOnlyThisThread;
+
m_avoid_regexp.clear();
m_step_in_target.clear();
m_class_name.clear();
@@ -465,11 +470,11 @@ public:
StepType step_type,
StepScope step_scope) :
CommandObjectParsed (interpreter, name, help, syntax,
- eFlagRequiresProcess |
- eFlagRequiresThread |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresProcess |
+ eCommandRequiresThread |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_step_type (step_type),
m_step_scope (step_scope),
m_options (interpreter)
@@ -579,6 +584,7 @@ protected:
if (m_step_type == eStepTypeInto)
{
StackFrame *frame = thread->GetStackFrameAtIndex(0).get();
+ assert(frame != nullptr);
if (frame->HasDebugInformation ())
{
@@ -667,6 +673,8 @@ protected:
process->GetThreadList().SetSelectedThreadByID (thread->GetID());
+ const uint32_t iohandler_id = process->GetIOHandlerID();
+
StreamString stream;
Error error;
if (synchronous_execution)
@@ -677,7 +685,7 @@ protected:
// There is a race condition where this thread will return up the call stack to the main command handler
// and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
// a chance to call PushProcessIOHandler().
- process->SyncIOHandler(2000);
+ process->SyncIOHandler(iohandler_id, 2000);
if (synchronous_execution)
{
@@ -752,10 +760,10 @@ public:
"thread continue",
"Continue execution of one or more threads in an active process.",
NULL,
- eFlagRequiresThread |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused)
+ eCommandRequiresThread |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused)
{
CommandArgumentEntry arg;
CommandArgumentData thread_idx_arg;
@@ -1064,10 +1072,10 @@ public:
"thread until",
"Run the current or specified thread until it reaches a given line number or address or leaves the current function.",
NULL,
- eFlagRequiresThread |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresThread |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -1343,10 +1351,10 @@ public:
"thread select",
"Select a thread as the currently active thread.",
NULL,
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused )
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused )
{
CommandArgumentEntry arg;
CommandArgumentData thread_idx_arg;
@@ -1419,10 +1427,10 @@ public:
"thread list",
"Show a summary of all current threads in a process.",
"thread list",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused )
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused )
{
}
@@ -1464,10 +1472,10 @@ public:
"thread info",
"Show an extended summary of information about thread(s) in a process.",
"thread info",
- eFlagRequiresProcess |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused),
+ eCommandRequiresProcess |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused),
m_options (interpreter)
{
m_add_return = false;
@@ -1656,10 +1664,10 @@ public:
"Return from the currently selected frame, short-circuiting execution of the frames below it, with an optional return value,"
" or with the -x option from the innermost function evaluation.",
"thread return",
- eFlagRequiresFrame |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -1884,10 +1892,10 @@ public:
"thread jump",
"Sets the program counter to a new address.",
"thread jump",
- eFlagRequiresFrame |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options (interpreter)
{
}
@@ -2068,11 +2076,11 @@ public:
"Show thread plans for one or more threads. If no threads are specified, show the "
"currently selected thread. Use the thread-index \"all\" to see all threads.",
NULL,
- eFlagRequiresProcess |
- eFlagRequiresThread |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresProcess |
+ eCommandRequiresThread |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_options(interpreter)
{
}
@@ -2120,11 +2128,11 @@ public:
"Only user visible plans can be discarded, use the index from \"thread plan list\""
" without the \"-i\" argument.",
NULL,
- eFlagRequiresProcess |
- eFlagRequiresThread |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused )
+ eCommandRequiresProcess |
+ eCommandRequiresThread |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused )
{
CommandArgumentEntry arg;
CommandArgumentData plan_index_arg;
diff --git a/source/Commands/CommandObjectType.cpp b/source/Commands/CommandObjectType.cpp
index 3a4c60c00f8b..7c8061a6ca08 100644
--- a/source/Commands/CommandObjectType.cpp
+++ b/source/Commands/CommandObjectType.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectType.h"
// C Includes
@@ -4249,7 +4247,7 @@ public:
nullptr,
nullptr,
nullptr,
- eFlagRequiresFrame),
+ eCommandRequiresFrame),
m_formatter_name(formatter_name ? formatter_name : ""),
m_discovery_function(discovery_func)
{
diff --git a/source/Commands/CommandObjectVersion.cpp b/source/Commands/CommandObjectVersion.cpp
index 2d950a89c9b3..70e101c22330 100644
--- a/source/Commands/CommandObjectVersion.cpp
+++ b/source/Commands/CommandObjectVersion.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectVersion.h"
// C Includes
diff --git a/source/Commands/CommandObjectWatchpoint.cpp b/source/Commands/CommandObjectWatchpoint.cpp
index bef59ca30b3c..650fd253af02 100644
--- a/source/Commands/CommandObjectWatchpoint.cpp
+++ b/source/Commands/CommandObjectWatchpoint.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "CommandObjectWatchpoint.h"
#include "CommandObjectWatchpointCommand.h"
@@ -27,6 +25,7 @@
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "llvm/ADT/StringRef.h"
@@ -924,10 +923,10 @@ public:
"If watchpoint setting fails, consider disable/delete existing ones "
"to free up resources.",
NULL,
- eFlagRequiresFrame |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_option_watchpoint ()
{
@@ -1131,10 +1130,10 @@ public:
"If watchpoint setting fails, consider disable/delete existing ones "
"to free up resources.",
NULL,
- eFlagRequiresFrame |
- eFlagTryTargetAPILock |
- eFlagProcessMustBeLaunched |
- eFlagProcessMustBePaused ),
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_option_watchpoint ()
{
@@ -1211,7 +1210,7 @@ protected:
if (end_options)
{
- Args args (raw_command, end_options - raw_command);
+ Args args (llvm::StringRef(raw_command, end_options - raw_command));
if (!ParseOptions (args, result))
return false;
diff --git a/source/Commands/CommandObjectWatchpointCommand.cpp b/source/Commands/CommandObjectWatchpointCommand.cpp
index 275ee925adcc..d7d064e5fed9 100644
--- a/source/Commands/CommandObjectWatchpointCommand.cpp
+++ b/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
// C Includes
// C++ Includes