diff options
Diffstat (limited to 'lldb/source')
17 files changed, 238 insertions, 149 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index dfa66f81e8a..c2a13c09eca 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -704,3 +704,18 @@ SBCommand::AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, c return lldb::SBCommand(new_command_sp); return lldb::SBCommand(); } + +uint32_t +SBCommand::GetFlags () +{ + if (!IsValid()) + return 0; + return m_opaque_sp->GetFlags().Get(); +} + +void +SBCommand::SetFlags (uint32_t flags) +{ + if (IsValid()) + m_opaque_sp->GetFlags().Set(flags); +} diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 2946a0ba4be..bab12c89564 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1455,6 +1455,8 @@ public: 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 diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index c07d9f3b9b9..1d385eadf0b 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -196,7 +196,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), diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index cd382165457..19400eeb519 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -65,10 +65,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 +156,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 +192,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 +314,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 +385,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(); diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 25029a67ebf..efbde4d2c0c 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -315,7 +315,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 (), @@ -388,7 +388,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(); @@ -1034,7 +1034,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 () { @@ -1080,7 +1080,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(); @@ -1335,7 +1335,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 () @@ -1412,7 +1412,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(); @@ -1702,7 +1702,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/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index f62a002f750..16326e4193b 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -1274,7 +1274,7 @@ public: "platform process launch", "Launch a new process on a remote platform.", "platform process launch program", - eFlagRequiresTarget | eFlagTryTargetAPILock), + eCommandRequiresTarget | eCommandTryTargetAPILock), m_options (interpreter) { } diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index a908c4b5474..14b7e2f74c5 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -125,7 +125,7 @@ public: "process launch", "Launch the executable in the debugger.", NULL, - eFlagRequiresTarget, + eCommandRequiresTarget, "restart"), m_options (interpreter) { @@ -639,10 +639,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) { } @@ -900,9 +900,9 @@ public: "process detach", "Detach from the current process being debugged.", "process detach", - eFlagRequiresProcess | - eFlagTryTargetAPILock | - eFlagProcessMustBeLaunched), + eCommandRequiresProcess | + eCommandTryTargetAPILock | + eCommandProcessMustBeLaunched), m_options(interpreter) { } @@ -1181,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 ) { } @@ -1238,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 ) { } @@ -1302,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; @@ -1384,9 +1384,9 @@ public: "process interrupt", "Interrupt the current process being debugged.", "process interrupt", - eFlagRequiresProcess | - eFlagTryTargetAPILock | - eFlagProcessMustBeLaunched) + eCommandRequiresProcess | + eCommandTryTargetAPILock | + eCommandProcessMustBeLaunched) { } @@ -1446,9 +1446,9 @@ public: "process kill", "Terminate the current process being debugged.", "process kill", - eFlagRequiresProcess | - eFlagTryTargetAPILock | - eFlagProcessMustBeLaunched) + eCommandRequiresProcess | + eCommandTryTargetAPILock | + eCommandProcessMustBeLaunched) { } @@ -1507,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) { } @@ -1571,7 +1571,7 @@ public: "process status", "Show the current status and location of executing process.", "process status", - eFlagRequiresProcess | eFlagTryTargetAPILock) + eCommandRequiresProcess | eCommandTryTargetAPILock) { } @@ -1585,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; diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index 6181802c494..0940897bdc9 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -48,10 +48,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 () @@ -377,10 +377,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/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 23fb52bc1e2..3d0c7395aa2 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -253,7 +253,7 @@ public: "source list", "Display source code (as specified) based on the current executable's debug info.", NULL, - eFlagRequiresTarget), + eCommandRequiresTarget), m_options (interpreter) { } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index e9ab673d888..661215df9c6 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -740,7 +740,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), @@ -2561,7 +2561,7 @@ public: "target modules dump line-table", "Dump the line table for one or more compilation units.", NULL, - eFlagRequiresTarget) + eCommandRequiresTarget) { } @@ -3651,10 +3651,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) { } @@ -4011,7 +4011,7 @@ public: "target modules lookup", "Look up information within executable and dependent shared library images.", NULL, - eFlagRequiresTarget), + eCommandRequiresTarget), m_options (interpreter) { CommandArgumentEntry arg; @@ -4391,7 +4391,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/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index d0c82b44f55..78271f25c66 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -241,11 +241,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) { } @@ -472,11 +472,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) @@ -760,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; @@ -1072,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; @@ -1351,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; @@ -1427,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 ) { } @@ -1472,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; @@ -1664,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; @@ -1892,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) { } @@ -2076,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) { } @@ -2128,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/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 3a4c60c00f8..f89b41aa0cf 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -4249,7 +4249,7 @@ public: nullptr, nullptr, nullptr, - eFlagRequiresFrame), + eCommandRequiresFrame), m_formatter_name(formatter_name ? formatter_name : ""), m_discovery_function(discovery_func) { diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index b42e74c11bf..51b3670a2ca 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -925,10 +925,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 () { @@ -1132,10 +1132,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 () { diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index f6e5bcac3a4..29e4744da87 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -228,20 +228,20 @@ CommandObject::CheckRequirements (CommandReturnObject &result) m_exe_ctx = m_interpreter.GetExecutionContext(); const uint32_t flags = GetFlags().Get(); - if (flags & (eFlagRequiresTarget | - eFlagRequiresProcess | - eFlagRequiresThread | - eFlagRequiresFrame | - eFlagTryTargetAPILock )) + if (flags & (eCommandRequiresTarget | + eCommandRequiresProcess | + eCommandRequiresThread | + eCommandRequiresFrame | + eCommandTryTargetAPILock )) { - if ((flags & eFlagRequiresTarget) && !m_exe_ctx.HasTargetScope()) + if ((flags & eCommandRequiresTarget) && !m_exe_ctx.HasTargetScope()) { result.AppendError (GetInvalidTargetDescription()); return false; } - if ((flags & eFlagRequiresProcess) && !m_exe_ctx.HasProcessScope()) + if ((flags & eCommandRequiresProcess) && !m_exe_ctx.HasProcessScope()) { if (!m_exe_ctx.HasTargetScope()) result.AppendError (GetInvalidTargetDescription()); @@ -250,7 +250,7 @@ CommandObject::CheckRequirements (CommandReturnObject &result) return false; } - if ((flags & eFlagRequiresThread) && !m_exe_ctx.HasThreadScope()) + if ((flags & eCommandRequiresThread) && !m_exe_ctx.HasThreadScope()) { if (!m_exe_ctx.HasTargetScope()) result.AppendError (GetInvalidTargetDescription()); @@ -261,7 +261,7 @@ CommandObject::CheckRequirements (CommandReturnObject &result) return false; } - if ((flags & eFlagRequiresFrame) && !m_exe_ctx.HasFrameScope()) + if ((flags & eCommandRequiresFrame) && !m_exe_ctx.HasFrameScope()) { if (!m_exe_ctx.HasTargetScope()) result.AppendError (GetInvalidTargetDescription()); @@ -274,13 +274,13 @@ CommandObject::CheckRequirements (CommandReturnObject &result) return false; } - if ((flags & eFlagRequiresRegContext) && (m_exe_ctx.GetRegisterContext() == nullptr)) + if ((flags & eCommandRequiresRegContext) && (m_exe_ctx.GetRegisterContext() == nullptr)) { result.AppendError (GetInvalidRegContextDescription()); return false; } - if (flags & eFlagTryTargetAPILock) + if (flags & eCommandTryTargetAPILock) { Target *target = m_exe_ctx.GetTargetPtr(); if (target) @@ -288,13 +288,13 @@ CommandObject::CheckRequirements (CommandReturnObject &result) } } - if (GetFlags().AnySet (CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused)) + if (GetFlags().AnySet (eCommandProcessMustBeLaunched | eCommandProcessMustBePaused)) { Process *process = m_interpreter.GetExecutionContext().GetProcessPtr(); if (process == nullptr) { // A process that is not running is considered paused. - if (GetFlags().Test(CommandObject::eFlagProcessMustBeLaunched)) + if (GetFlags().Test(eCommandProcessMustBeLaunched)) { result.AppendError ("Process must exist."); result.SetStatus (eReturnStatusFailed); @@ -318,7 +318,7 @@ CommandObject::CheckRequirements (CommandReturnObject &result) case eStateDetached: case eStateExited: case eStateUnloaded: - if (GetFlags().Test(CommandObject::eFlagProcessMustBeLaunched)) + if (GetFlags().Test(eCommandProcessMustBeLaunched)) { result.AppendError ("Process must be launched."); result.SetStatus (eReturnStatusFailed); @@ -328,7 +328,7 @@ CommandObject::CheckRequirements (CommandReturnObject &result) case eStateRunning: case eStateStepping: - if (GetFlags().Test(CommandObject::eFlagProcessMustBePaused)) + if (GetFlags().Test(eCommandProcessMustBePaused)) { result.AppendError ("Process is running. Use 'process interrupt' to pause execution."); result.SetStatus (eReturnStatusFailed); diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 1baf484cc79..1e16fd3bdc6 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -2878,6 +2878,78 @@ ScriptInterpreterPython::GetShortHelpForCommandObject (StructuredData::GenericSP return got_string; } +uint32_t +ScriptInterpreterPython::GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp) +{ + uint32_t result = 0; + + Locker py_lock (this, + Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); + + static char callee_name[] = "get_flags"; + + if (!cmd_obj_sp) + return result; + + PyObject* implementor = (PyObject*)cmd_obj_sp->GetValue(); + + if (implementor == nullptr || implementor == Py_None) + return result; + + PyObject* pmeth = PyObject_GetAttrString(implementor, callee_name); + + if (PyErr_Occurred()) + { + PyErr_Clear(); + } + + if (pmeth == nullptr || pmeth == Py_None) + { + Py_XDECREF(pmeth); + return result; + } + + if (PyCallable_Check(pmeth) == 0) + { + if (PyErr_Occurred()) + { + PyErr_Clear(); + } + + Py_XDECREF(pmeth); + return result; + } + + if (PyErr_Occurred()) + { + PyErr_Clear(); + } + + Py_XDECREF(pmeth); + + // right now we know this function exists and is callable.. + PyObject* py_return = PyObject_CallMethod(implementor, callee_name, nullptr); + + // if it fails, print the error but otherwise go on + if (PyErr_Occurred()) + { + PyErr_Print(); + PyErr_Clear(); + } + + if (py_return != nullptr && py_return != Py_None) + { + if (PyInt_Check(py_return)) + result = (uint32_t)PyInt_AsLong(py_return); + else if (PyLong_Check(py_return)) + result = (uint32_t)PyLong_AsLong(py_return); + } + Py_XDECREF(py_return); + + return result; +} + bool ScriptInterpreterPython::GetLongHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp, std::string& dest) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 7c71df26edc..eba16a0cbca 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -458,9 +458,9 @@ public: "dump", "Dump information on Objective-C classes known to the current process.", "language objc class-table dump", - eFlagRequiresProcess | - eFlagProcessMustBeLaunched | - eFlagProcessMustBePaused ) + eCommandRequiresProcess | + eCommandProcessMustBeLaunched | + eCommandProcessMustBePaused ) { } @@ -518,9 +518,9 @@ public: "info", "Dump information on a tagged pointer.", "language objc tagged-pointer info", - eFlagRequiresProcess | - eFlagProcessMustBeLaunched | - eFlagProcessMustBePaused ) + eCommandRequiresProcess | + eCommandProcessMustBeLaunched | + eCommandProcessMustBePaused ) { CommandArgumentEntry arg; CommandArgumentData index_arg; diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 65144944205..d95c302b5bb 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -330,7 +330,7 @@ class CommandObjectRenderScriptRuntimeModuleProbe : public CommandObjectParsed : CommandObjectParsed(interpreter, "renderscript module probe", "Initiates a Probe of all loaded modules for kernels and other renderscript objects.", "renderscript module probe", - eFlagRequiresTarget | eFlagRequiresProcess | eFlagProcessMustBeLaunched) + eCommandRequiresTarget | eCommandRequiresProcess | eCommandProcessMustBeLaunched) { } @@ -368,7 +368,7 @@ class CommandObjectRenderScriptRuntimeModuleDump : public CommandObjectParsed CommandObjectRenderScriptRuntimeModuleDump(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "renderscript module dump", "Dumps renderscript specific information for all modules.", "renderscript module dump", - eFlagRequiresProcess | eFlagProcessMustBeLaunched) + eCommandRequiresProcess | eCommandProcessMustBeLaunched) { } |

