Skip to content

Commit 46ed794

Browse files
committed
[lldb] Improve corefile saving ergonomics
This patch improves the way the user can save the process state into a corefile by adding completion handler that would provide tab completion for the corefile path and also resolves the corefile path to expand relative path. Differential Revision: https://reviews.llvm.org/D152842 Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent f9e2c6c commit 46ed794

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lldb/source/API/SBProcess.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ lldb::SBError SBProcess::SaveCore(const char *file_name,
11771177
}
11781178

11791179
FileSpec core_file(file_name);
1180+
FileSystem::Instance().Resolve(core_file);
11801181
error.ref() = PluginManager::SaveCore(process_sp, core_file, core_style,
11811182
flavor);
11821183

lldb/source/Commands/CommandObjectProcess.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,13 @@ class CommandObjectProcessSaveCore : public CommandObjectParsed {
13051305

13061306
Options *GetOptions() override { return &m_options; }
13071307

1308+
void
1309+
HandleArgumentCompletion(CompletionRequest &request,
1310+
OptionElementVector &opt_element_vector) override {
1311+
CommandCompletions::InvokeCommonCompletionCallbacks(
1312+
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
1313+
}
1314+
13081315
class CommandOptions : public Options {
13091316
public:
13101317
CommandOptions() = default;
@@ -1353,6 +1360,7 @@ class CommandObjectProcessSaveCore : public CommandObjectParsed {
13531360
if (process_sp) {
13541361
if (command.GetArgumentCount() == 1) {
13551362
FileSpec output_file(command.GetArgumentAtIndex(0));
1363+
FileSystem::Instance().Resolve(output_file);
13561364
SaveCoreStyle corefile_style = m_options.m_requested_save_core_style;
13571365
Status error =
13581366
PluginManager::SaveCore(process_sp, output_file, corefile_style,

0 commit comments

Comments
 (0)