Skip to content

[lldb] Add file path completion in for crashlog & process save-core #7015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lldb/docs/python_api_enums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ CommandArgumentType
.. py:data:: eArgTypeColumnNum
.. py:data:: eArgTypeModuleUUID
.. py:data:: eArgTypeLastArg
.. py:data:: eArgTypeCompletionType

.. _SymbolType:

Expand Down
23 changes: 11 additions & 12 deletions lldb/examples/python/crashlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,13 +1179,7 @@ def add_module(image, target):
print(error)


def load_crashlog_in_scripted_process(debugger, crash_log_file, options, result):
crashlog_path = os.path.expanduser(crash_log_file)
if not os.path.exists(crashlog_path):
raise InteractiveCrashLogException(
"crashlog file %s does not exist" % crashlog_path
)

def load_crashlog_in_scripted_process(debugger, crashlog_path, options, result):
crashlog = CrashLogParser.create(debugger, crashlog_path, False).parse()

target = lldb.SBTarget()
Expand Down Expand Up @@ -1469,17 +1463,22 @@ def should_run_in_interactive_mode(options, ci):
ci = debugger.GetCommandInterpreter()

if args:
for crash_log_file in args:
for crashlog_file in args:
crashlog_path = os.path.expanduser(crashlog_file)
if not os.path.exists(crashlog_path):
raise FileNotFoundError(
"crashlog file %s does not exist" % crashlog_path
)
if should_run_in_interactive_mode(options, ci):
try:
load_crashlog_in_scripted_process(
debugger, crash_log_file, options, result
debugger, crashlog_path, options, result
)
except InteractiveCrashLogException as e:
result.SetError(str(e))
else:
crash_log = CrashLogParser.create(
debugger, crash_log_file, options.verbose
debugger, crashlog_path, options.verbose
).parse()
SymbolicateCrashLog(crash_log, options)

Expand All @@ -1494,10 +1493,10 @@ def should_run_in_interactive_mode(options, ci):

def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand(
"command script add -o -c lldb.macosx.crashlog.Symbolicate crashlog"
"command script add -o -c lldb.macosx.crashlog.Symbolicate -C disk-file crashlog"
)
debugger.HandleCommand(
"command script add -o -f lldb.macosx.crashlog.save_crashlog save_crashlog"
"command script add -o -f lldb.macosx.crashlog.save_crashlog -C disk-file save_crashlog"
)
print(
'"crashlog" and "save_crashlog" commands have been installed, use '
Expand Down
33 changes: 0 additions & 33 deletions lldb/include/lldb/Interpreter/CommandCompletions.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,6 @@ namespace lldb_private {
class TildeExpressionResolver;
class CommandCompletions {
public:
enum CommonCompletionTypes {
eNoCompletion = 0u,
eSourceFileCompletion = (1u << 0),
eDiskFileCompletion = (1u << 1),
eDiskDirectoryCompletion = (1u << 2),
eSymbolCompletion = (1u << 3),
eModuleCompletion = (1u << 4),
eSettingsNameCompletion = (1u << 5),
ePlatformPluginCompletion = (1u << 6),
eArchitectureCompletion = (1u << 7),
eVariablePathCompletion = (1u << 8),
eRegisterCompletion = (1u << 9),
eBreakpointCompletion = (1u << 10),
eProcessPluginCompletion = (1u << 11),
eDisassemblyFlavorCompletion = (1u << 12),
eTypeLanguageCompletion = (1u << 13),
eFrameIndexCompletion = (1u << 14),
eModuleUUIDCompletion = (1u << 15),
eStopHookIDCompletion = (1u << 16),
eThreadIndexCompletion = (1u << 17),
eWatchPointIDCompletion = (1u << 18),
eBreakpointNameCompletion = (1u << 19),
eProcessIDCompletion = (1u << 20),
eProcessNameCompletion = (1u << 21),
eRemoteDiskFileCompletion = (1u << 22),
eRemoteDiskDirectoryCompletion = (1u << 23),
eTypeCategoryNameCompletion = (1u << 24),
// This item serves two purposes. It is the last element in the enum, so
// you can add custom enums starting from here in your Option class. Also
// if you & in this bit the base code will not process the option.
eCustomCompletion = (1u << 24)
};

static bool InvokeCommonCompletionCallbacks(
CommandInterpreter &interpreter, uint32_t completion_mask,
lldb_private::CompletionRequest &request, SearchFilter *searcher);
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Interpreter/CommandObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CommandObject : public std::enable_shared_from_this<CommandObject> {
struct ArgumentTableEntry {
lldb::CommandArgumentType arg_type;
const char *arg_name;
CommandCompletions::CommonCompletionTypes completion_type;
lldb::CompletionType completion_type;
OptionEnumValues enum_values;
ArgumentHelpCallback help_function;
const char *help_text;
Expand Down
Loading