Debugger: Don't query the package kit in non-interactive mode.
We always skip loading debug information in this case, so
querying the package kit is just a waste of time. And it could
result in hangs or crashes if the package kit is in an invalid
state (e.g. if we are debugging package_daemon.)
(cherry picked from commit 69f1c57f0cc40fd0d32e61dc01507b234e498df8)
Change-Id: I9ce322bce111a458e830ace2286274bae126a861
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8067
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Diff
src/kits/debugger/debug_info/loading_state_handlers/DwarfLoadingStateHandler.cpp | 48 +++++++++++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 23 deletions(-)
@@ -68,6 +68,11 @@
DwarfFileLoadingState& fileState = dwarfState->GetFileState();
if (!interface->IsInteractive()) {
fileState.state = DWARF_FILE_LOADING_STATE_USER_INPUT_PROVIDED;
return;
}
BString requiredPackage;
try {
@@ -83,29 +88,26 @@
for (;;) {
int32 choice;
BString message;
if (interface->IsInteractive()) {
if (requiredPackage.IsEmpty()) {
message.SetToFormat("The debug information file '%s' for "
"image '%s' is missing. Would you like to locate the file "
"manually?", fileState.externalInfoFileName.String(),
fileState.dwarfFile->Name());
choice = interface->SynchronouslyAskUser("Debug info missing",
message.String(), "Locate", "Skip", NULL);
if (choice == 0)
choice = USER_CHOICE_LOCATE_FILE;
else if (choice == 1)
choice = USER_CHOICE_SKIP;
} else {
message.SetToFormat("The debug information file '%s' for "
"image '%s' is missing, but can be found in the package "
"'%s'. Would you like to install it, or locate the file "
"manually?", fileState.externalInfoFileName.String(),
fileState.dwarfFile->Name(), requiredPackage.String());
choice = interface->SynchronouslyAskUser("Debug info missing",
message.String(), "Install", "Locate", "Skip");
}
} else
choice = USER_CHOICE_SKIP;
if (requiredPackage.IsEmpty()) {
message.SetToFormat("The debug information file '%s' for "
"image '%s' is missing. Would you like to locate the file "
"manually?", fileState.externalInfoFileName.String(),
fileState.dwarfFile->Name());
choice = interface->SynchronouslyAskUser("Debug info missing",
message.String(), "Locate", "Skip", NULL);
if (choice == 0)
choice = USER_CHOICE_LOCATE_FILE;
else if (choice == 1)
choice = USER_CHOICE_SKIP;
} else {
message.SetToFormat("The debug information file '%s' for "
"image '%s' is missing, but can be found in the package "
"'%s'. Would you like to install it, or locate the file "
"manually?", fileState.externalInfoFileName.String(),
fileState.dwarfFile->Name(), requiredPackage.String());
choice = interface->SynchronouslyAskUser("Debug info missing",
message.String(), "Install", "Locate", "Skip");
}
if (choice == USER_CHOICE_INSTALL_PACKAGE) {