Skip to content

Commit 908692b

Browse files
authored
Merge pull request #9188 from jasonmolenda/cp/r131631627-no-binaries-found-dont-crash
[lldb] Don't crash when attaching to pid and no binaries found (llvm#100287)
2 parents 3307508 + cd880b4 commit 908692b

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lldb/source/Commands/CommandObjectProcess.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,25 +369,23 @@ class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach {
369369

370370
// Okay, we're done. Last step is to warn if the executable module has
371371
// changed:
372-
char new_path[PATH_MAX];
373372
ModuleSP new_exec_module_sp(target->GetExecutableModule());
374373
if (!old_exec_module_sp) {
375374
// We might not have a module if we attached to a raw pid...
376375
if (new_exec_module_sp) {
377-
new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
378-
result.AppendMessageWithFormat("Executable module set to \"%s\".\n",
379-
new_path);
376+
result.AppendMessageWithFormat(
377+
"Executable binary set to \"%s\".\n",
378+
new_exec_module_sp->GetFileSpec().GetPath().c_str());
380379
}
380+
} else if (!new_exec_module_sp) {
381+
result.AppendWarningWithFormat("No executable binary.");
381382
} else if (old_exec_module_sp->GetFileSpec() !=
382383
new_exec_module_sp->GetFileSpec()) {
383-
char old_path[PATH_MAX];
384-
385-
old_exec_module_sp->GetFileSpec().GetPath(old_path, PATH_MAX);
386-
new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
387384

388385
result.AppendWarningWithFormat(
389-
"Executable module changed from \"%s\" to \"%s\".\n", old_path,
390-
new_path);
386+
"Executable binary changed from \"%s\" to \"%s\".\n",
387+
old_exec_module_sp->GetFileSpec().GetPath().c_str(),
388+
new_exec_module_sp->GetFileSpec().GetPath().c_str());
391389
}
392390

393391
if (!old_arch_spec.IsValid()) {

0 commit comments

Comments
 (0)