Opened 6 years ago

Closed 7 months ago

#14601 closed enhancement (fixed)

[Debugger] add Skip all button

Reported by: diver Owned by: anevilyak
Priority: normal Milestone: R1/beta5
Component: Applications/Debugger Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Beta1.

Sometimes I just want to quickly see function list in Debugger and it doesn't let me offering me to Install debug packages over and over again.

Maybe "Skip all" button can be added or, if possible, Debugger could load the binary and have a button, install debug packages?

Change History (13)

comment:1 by bipolar, 16 months ago

This one was driving me nuts too. I finally had some good result today with the patch below.

Assuming the patch has any merit, I would really appreciate suggestions regarding the wording of the initial question and the one for the button choices (instead of placeholder "To nag or not to nag. [...]", etc.), before submitting it to Gerrit.

diff --git a/src/kits/debugger/debug_info/loading_state_handlers/DwarfLoadingStateHandler.cpp b/src/kits/debugger/debug_info/loading_state_handlers/DwarfLoadingStateHandler.cpp
index fc313a7a..1a2a4547 100644
--- a/src/kits/debugger/debug_info/loading_state_handlers/DwarfLoadingStateHandler.cpp
+++ b/src/kits/debugger/debug_info/loading_state_handlers/DwarfLoadingStateHandler.cpp
@@ -57,6 +57,8 @@ void
 DwarfLoadingStateHandler::HandleState(
 	SpecificImageDebugInfoLoadingState* state, UserInterface* interface)
 {
+	static int sSkipAll = -1;
+
 	DwarfImageDebugInfoLoadingState* dwarfState
 		= dynamic_cast<DwarfImageDebugInfoLoadingState*>(state);
 
@@ -68,6 +70,15 @@ DwarfLoadingStateHandler::HandleState(
 
 	DwarfFileLoadingState& fileState = dwarfState->GetFileState();
 
+	if (sSkipAll == -1)
+		sSkipAll = interface->SynchronouslyAskUser("Debug info missing",
+			"To nag or not to nag. That is the question.", "Always ask", "Skip all", NULL);
+
+	if (sSkipAll == 1) {
+		fileState.state = DWARF_FILE_LOADING_STATE_USER_INPUT_PROVIDED;
+		return;
+	}
+
 	BString requiredPackage;
 	_GetMatchingDebugInfoPackage(fileState.externalInfoFileName,
 		requiredPackage);

comment:2 by bipolar, 16 months ago

For the record: I first tried adding a "Skip all" button, but the underlying code uses BAlert, which only supports up to 3 buttons AFAICT. Debugger has two types of dialogs asking for the missing debug_info packages, on one I was able to add the "Skip all", but the other one already uses the 3 buttons :-(, so no-go there.

comment:3 by pulkomandy, 16 months ago

You can add more buttons using BAlert::AddButton after creating the alert: https://cgit.haiku-os.org/haiku/tree/headers/os/interface/Alert.h#n75

comment:4 by pulkomandy, 16 months ago

However, ideally we should add a checkbox "Do not ask again" instead of more buttons. The code could be similar to what is used in Debug server for the crash dialog: https://cgit.haiku-os.org/haiku/tree/src/servers/debug/DebugWindow.cpp

The main part is usage of BStripeView which is a view that looks the same as the left part of BAlert (also used in a few other places, for example BNotification)

And it would be nice to not use a static variable, maybe?

comment:5 by bipolar, 16 months ago

All good suggestions PulkoMandy, thanks!

And it would be nice to not use a static variable, maybe?

Welp... with my limited skills, that was as far as I could go unassisted :-D

I'll see what I can do, but... people better don't hold their breath waiting for me.

comment:6 by anevilyak, 16 months ago

The static variable is definitely problematic, bearing in mind that if one is debugging multiple teams, they are handled by multiple TeamDebugger instances within the same team/process, so this is asking for state consistency issues.

comment:7 by bipolar, 16 months ago

Thanks anevilyak!

I can see (now :-P) that having that static variable in a library function was not a bright idea. Was the only hammer in my toolshed, I guess :-)

Will try to keep that in mind next time.

comment:8 by anevilyak, 16 months ago

No problem, sorry I've mostly been missing in action, but I can try to offer advice where possible as time allows.

comment:9 by waddlesplash, 16 months ago

IMO the best solution here is not to have a "Skip all" button, but rather to collect all the libraries/packages without debug information and then display a single dialog containing a list with checkboxes to select what packages can be installed, with a "Cancel" option to skip entirely (or "Never ask again" even.)

comment:10 by anevilyak, 16 months ago

A solution like that might potentially require some rearchitecting to work properly ; if I'm remembering how things work correctly, the team image list is walked sequentially, and the TeamDebugger waits for the loading state handler to come back with the debug info package (or not available result) before continuing to either load the current image, or skip and move to the next one. For what you propose to be feasible, it'd need to be able to put images into a pending/unresolved state while it moves on to checking the next one, and I'm not sure how trivial or not that'd be.

comment:11 by pulkomandy, 16 months ago

It's also further complicated by load_add_on/dlopen, which can result in the current alert to show up again much later during the debugging session.

comment:12 by pulkomandy, 12 months ago

I have submitted an implementation here: https://review.haiku-os.org/c/haiku/+/6398

comment:13 by waddlesplash, 7 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

"Don't ask again" was merged in 94457adea214c81486137226c5a5f0eb5854ea03.

Note: See TracTickets for help on using tickets.