Author Topic: show debugger tip under curser when ctrl key is pressed  (Read 28017 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: show debugger tip under curser when ctrl key is pressed
« Reply #15 on: December 22, 2010, 07:05:10 am »
Do we need to implement this feature???
I'd say no. I don't think this is very intuitive to be honest. When debugging I am very used to see the tooltips as that's the default I want to see in a debugging session. I think forcing the use of control will make this feature pretty much hidden. And the other way round, too: Making this an option would in fact mean nearly nobody will use it. So: What's wrong with showing the tooltips in the debugger session?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #16 on: December 22, 2010, 07:13:38 am »
Do we need to implement this feature???
I'd say no. I don't think this is very intuitive to be honest. When debugging I am very used to see the tooltips as that's the default I want to see in a debugging session. I think forcing the use of control will make this feature pretty much hidden. And the other way round, too: Making this an option would in fact mean nearly nobody will use it. So: What's wrong with showing the tooltips in the debugger session?!
I think the reason is:

1, this way, we can show both tooltip by cc(do not hold ctrl) and tooltip by gdb(hold the ctrl), and they never be conflict.
2, I don't want to gdb to show something when the mouse hover something, especially some complex data structure, this will
    2a: cause gdb to crash when gdb try to evaluate a complex statement( I think ofb has don some thing to debugger_branch in the last patch to forbid get to evaluate a long or multiline statement)
    2b: slow down the debugging stage, I need to wait until something to be shown.
    2c: gdb will crash when showing some uninitialized data. like uninitialized c++ vector, but holding the ctrl will give a change to avoid the crash.


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: show debugger tip under curser when ctrl key is pressed
« Reply #17 on: December 22, 2010, 07:19:05 am »
2, I don't want to gdb to show something when the mouse hover something, especially some complex data structure, this will
    2a: cause gdb to crash when gdb try to evaluate a complex statement( I think ofb has don some thing to debugger_branch in the last patch to forbid get to evaluate a long or multiline statement)
    2b: slow down the debugging stage, I need to wait until something to be shown.
    2c: gdb will crash when showing some uninitialized data. like uninitialized c++ vector, but holding the ctrl will give a change to avoid the crash.
Well - what about a toggle-button in the debugger's toolbar then? To globally enable/disable the evaluation of the cursor... In addition the timer when the tooltip kicks in could be increased. Surely crashes should be fixed and not hidden by disabling options. But in fact I never saw the debugger crash with the branch. :shock:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #18 on: December 22, 2010, 07:33:15 am »
2, I don't want to gdb to show something when the mouse hover something, especially some complex data structure, this will
    2a: cause gdb to crash when gdb try to evaluate a complex statement( I think ofb has don some thing to debugger_branch in the last patch to forbid get to evaluate a long or multiline statement)
    2b: slow down the debugging stage, I need to wait until something to be shown.
    2c: gdb will crash when showing some uninitialized data. like uninitialized c++ vector, but holding the ctrl will give a change to avoid the crash.
Well - what about a toggle-button in the debugger's toolbar then?
agreed.

Quote
To globally enable/disable the evaluation of the cursor... In addition the timer when the tooltip kicks in could be increased. Surely crashes should be fixed and not hidden by disabling options. But in fact I never saw the debugger crash with the branch. :shock:
did you use the gdb pretty printer?
See the post of mine in the gdb (all the test was under Codeblocks, even I use the gdb cvs 20101216, it will still crash)
http://sourceware.org/ml/gdb/2010-10/msg00045.html
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Max

  • Guest
Re: show debugger tip under curser when ctrl key is pressed
« Reply #19 on: December 22, 2010, 09:17:44 am »

I'd say no. I don't think this is very intuitive to be honest. When debugging I am very used to see the tooltips as that's the default I want to see in a debugging session.
[/quote]

Try to put the cursor, may be as an involuntary action due to mouse moving,  over a std::vector<double> of 50000 elements ...wait and good luck!

Max

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: show debugger tip under curser when ctrl key is pressed
« Reply #20 on: December 22, 2010, 10:59:47 am »
Try to put the cursor, may be as an involuntary action due to mouse moving,  over a std::vector<double> of 50000 elements ...wait and good luck!
I see your point, but again: I don't believe the default case is users having std::vector<double> of 50000 elements. So an option for those who have which can be toggled easily via a toolbar is the way to go IMHO.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: show debugger tip under curser when ctrl key is pressed
« Reply #21 on: December 22, 2010, 12:33:16 pm »
Morten: The problem is if you hover your mouse on an uninitialized vector. Then the size is not 50000, but uint_t(-1) or something that large.

Ollydbg: I'll add an item to my TODO: add a option to disable the gdb_types.script
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #22 on: December 22, 2010, 12:37:42 pm »
Morten: The problem is if you hover your mouse on an uninitialized vector. Then the size is not 50000, but uint_t(-1) or something that large.

Ollydbg: I'll add an item to my TODO: add a option to disable the gdb_types.script


thank you obf!!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #23 on: January 04, 2011, 06:15:40 am »
@all

Just a reminder, I just noticed that Codelite has an enhanced feature. see the log

Quote
- Debugger: when the option to show the debugger tip only if CTRL key is down is ON, the tip will now be shown immediately without the need to "move" the mouse

-------------------------------
M : /trunk/LiteEditor/cl_editor.cpp 
M : /trunk/LiteEditor/context_cpp.cpp

In-fact, I'm trying to implement this feature several days ago. (by hacking the scintilla source code, but failed).

So, eranif has done a great job!!!! thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #24 on: January 04, 2011, 06:36:33 am »
another question is:

How can this be done in Codeblocks:
The codelite's code is like below:
Code

void LEditor::OnKeyDown(wxKeyEvent &event)
{
// Hide tooltip dialog if its ON
IDebugger *   dbgr                = DebuggerMgr::Get().GetActiveDebugger();
bool          dbgTipIsShown       = ManagerST::Get()->GetDebuggerTip()->IsShown();
bool          keyIsControl        = event.GetKeyCode() == WXK_CONTROL;

if(dbgTipIsShown && !keyIsControl) {

// If any key is pressed, but the CONTROL key hide the
// debugger tip
ManagerST::Get()->GetDebuggerTip()->HideDialog();

} else if(dbgr && dbgr->IsRunning() && ManagerST::Get()->DbgCanInteract() && keyIsControl) {

DebuggerInformation info;
DebuggerMgr::Get().GetDebuggerInformation(dbgr->GetName(), info);

if(info.showTooltipsOnlyWithControlKeyIsDown) {
// CONTROL Key + Debugger is running and interactive
// and no debugger tip is shown -> emulate "Dwell" event
wxScintillaEvent sciEvent;
wxPoint pt ( ScreenToClient(wxGetMousePosition()) );
sciEvent.SetPosition( PositionFromPointClose(pt.x, pt.y));

m_context->OnDbgDwellStart(sciEvent);
}
}
...

Any one can help me???

thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #25 on: January 05, 2011, 01:10:12 pm »
Is it possible to emulate a wxEVT_SCI_DWELLSTART event, and send it directly to the debugger plugin?
(I do not need the other plugin to receive this event in this situation)
thanks!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: show debugger tip under curser when ctrl key is pressed
« Reply #26 on: January 05, 2011, 01:38:18 pm »
Ollydbg: it will be ugly, if possible:)

There is a need for tooltip redesign, but I'm not sure what could be done to improve the current situation.

Probably the best solution is tooltip grouping...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #27 on: January 05, 2011, 01:42:28 pm »
Ollydbg: it will be ugly, if possible:)
agreed. really ugly.
we need to consider a better way.


Quote
There is a need for tooltip redesign, but I'm not sure what could be done to improve the current situation.

Probably the best solution is tooltip grouping...
tooltip grouping. you mean just stack the tip window one by one??

Currently, As I know, the tip windows is just a wxWindow, see
plugins\debuggergdb\gdb_tipwindow.cpp(trunk)
see:
Code
class GDBTipWindowView : public wxWindow
{
public:
    GDBTipWindowView(wxWindow *parent);

    // event handlers
    void OnPaint(wxPaintEvent& event);
    void OnMouseClick(wxMouseEvent& event);
    void OnMouseMove(wxMouseEvent& event);

#if !wxUSE_POPUPWIN
    void OnKillFocus(wxFocusEvent& event);
#endif // wxUSE_POPUPWIN

    // calculate the client rect we need to display the text
    void Adjust(const wxString& symbol, const wxString& typ, const wxString& addr, const wxString& contents, wxCoord maxLength);

private:
    wxSize GetTextSize(wxArrayString& array, const wxString& text, wxCoord maxLength, int indentationAfterFirstLine = 0);
    void PrintArray(wxDC& dc, wxPoint& pt, const wxArrayString& array);
    wxString AdjustContents(const wxString& contents);

    GDBTipWindow* m_parent;
    wxCoord m_headerHeight;

    wxString m_symbol;
    wxString m_type;
    wxString m_address;
    wxString m_contents;

#if !wxUSE_POPUPWIN
    long m_creationTime;
#endif // !wxUSE_POPUPWIN

    DECLARE_EVENT_TABLE()
    DECLARE_NO_COPY_CLASS(GDBTipWindowView)
};
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: show debugger tip under curser when ctrl key is pressed
« Reply #28 on: January 05, 2011, 02:05:19 pm »
By grouping I mean:
1. display all tooltips vertically in different windows
or
2. display all tooltips vertically in one window

Another option is to have tooltip manager which shows only one tooltip at a time.
And there are tooltip priorities, so the best priority wins.
Maybe this is the simpler solution.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: show debugger tip under curser when ctrl key is pressed
« Reply #29 on: January 05, 2011, 02:10:48 pm »
By grouping I mean:
1. display all tooltips vertically in different windows
or
2. display all tooltips vertically in one window

Another option is to have tooltip manager which shows only one tooltip at a time.
And there are tooltip priorities, so the best priority wins.
Maybe this is the simpler solution.
I would prefer only one window. and the idea tooltip manager is a good solution. Currently the tooltip from codecompletion and gdb will battle.  (we have discussed this issue one years ago)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.