Due to some unavoidable feature of gdb, such as:
1, under windows, When I use gdb with python supported, when showing a local uninitialized variable, such as a vector<string>, the gdb will crash.
2, when debugging, when I select some piece of code, the debugger plugin try to evaluate the "whole piece of the code", this will always cause gdb to crash.
So, can some devs to add an option that when the user hold the "ctrl" key, and the caret hover event send, then the debugger plugin just send the expression to gdb.
any ideas?
Both Loaden and I have just modify the code to:
void DebuggerGDB::OnValueTooltip(CodeBlocksEvent& event)
{
event.Skip();
if (!m_pProcess || !IsStopped())
return;
if (!Manager::Get()->GetConfigManager(_T("debugger"))->ReadBool(_T("eval_tooltip"), false))
return;
if (!wxGetKeyState(WXK_CONTROL)) // does not work!!!!!
return;
But the code does not work.
wxGetKeyState(WXK_CONTROL) this function always get false.
any comments about this?
why I can't query the ctrl key information???
thanks.
Edit:
In this post: one more years ago.
http://forums.codeblocks.org/index.php/topic,10616.msg72724.html
By the way, I want to use "CTRL" key while mouse hovering some text to get the ValueTooltip shown.
So, I try to add the code:
Code:
+// if (!wxGetKeyState(WXK_CONTROL))
+// return;
But it didn't works as I expect. Can you give me some suggestions?
Thanks
Hi,
I think I tried it once (to show debugger event only when CTRL is down) however, the problem was that under Windows I did not receive the 'dwell' events from scintilla if CONTROL is down - so I dropped it.
Do you get the dwell event when control key is down? (Windows)
Eran
You are right, I just find this.
from the file: F:\cb\codeblocks_trunk\src\sdk\wxscintilla\src\wxscintilla.cpp
I think it is the point where this message sent.
case SCN_DWELLSTART:
evt.SetEventType (wxEVT_SCI_DWELLSTART);
evt.SetX(scn.x);
evt.SetY(scn.y);
break;
case SCN_DWELLEND:
evt.SetEventType (wxEVT_SCI_DWELLEND);
evt.SetX(scn.x);
evt.SetY(scn.y);
break;
but not sure the key value is already saved here:
void wxScintilla::NotifyParent (SCNotification* _scn)
{
SCNotification& scn = *_scn;
wxScintillaEvent evt (0, GetId());
evt.SetEventObject(this);
evt.SetPosition(scn.position);
evt.SetKey(scn.ch);
evt.SetModifiers(scn.modifiers);
switch (scn.nmhdr.code) {
Can we use the evt.GetKey???
Can we use the evt.GetKey???
I think you misunderstood me...
What I meant is:
When the CONTROL key is DOWN you will not receive the wxEVT_SCI_DWELLSTART event. (this is on Windows 7 with the latest wxScintilla)
If you *do* receive the event, then I suggest that you try:
if(wxGetMouseState().ControlDown())
Eran
Index: plugins/debuggergdb/debuggergdb.cpp
===================================================================
--- plugins/debuggergdb/debuggergdb.cpp (revision 6903)
+++ plugins/debuggergdb/debuggergdb.cpp (working copy)
@@ -2648,6 +2648,11 @@
if (!Manager::Get()->GetConfigManager(_T("debugger"))->ReadBool(_T("eval_tooltip"), false))
return;
+ if (!::wxGetKeyState(WXK_CONTROL)) // does not work!!!!!
+ return;
+ //if(! (::GetAsyncKeyState(VK_CONTROL)&0x80))
+ // return;
+
EditorBase* base = event.GetEditor();
cbEditor* ed = base && base->IsBuiltinEditor() ? static_cast<cbEditor*>(base) : 0;
if (!ed)
Index: sdk/wxscintilla/src/scintilla/src/Editor.cxx
===================================================================
--- sdk/wxscintilla/src/scintilla/src/Editor.cxx (revision 6903)
+++ sdk/wxscintilla/src/scintilla/src/Editor.cxx (working copy)
@@ -5379,7 +5379,10 @@
}
int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) {
- DwellEnd(false);
+
+ if (!ctrl)
+ DwellEnd(false);
+
int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
(alt ? SCI_ALT : 0);
int msg = kmap.Find(key, modifiers);
This patch try to solve the problem, but it failed. when holding the ctrl, the tip show about 0.1 second and disappeared quickly.
any one can help me? thanks.
@Jens and Morten
I have solved the problem, see the patch:
Index: plugins/debuggergdb/debuggergdb.cpp
===================================================================
--- plugins/debuggergdb/debuggergdb.cpp (revision 6903)
+++ plugins/debuggergdb/debuggergdb.cpp (working copy)
@@ -2648,6 +2648,9 @@
if (!Manager::Get()->GetConfigManager(_T("debugger"))->ReadBool(_T("eval_tooltip"), false))
return;
+ if (!::wxGetKeyState(WXK_CONTROL)) // does not work!!!!!
+ return;
+
EditorBase* base = event.GetEditor();
cbEditor* ed = base && base->IsBuiltinEditor() ? static_cast<cbEditor*>(base) : 0;
if (!ed)
Index: plugins/debuggergdb/gdb_tipwindow.cpp
===================================================================
--- plugins/debuggergdb/gdb_tipwindow.cpp (revision 6903)
+++ plugins/debuggergdb/gdb_tipwindow.cpp (working copy)
@@ -222,9 +222,10 @@
Close();
}
-void GDBTipWindow::OnKey(wxKeyEvent& /*event*/)
+void GDBTipWindow::OnKey(wxKeyEvent& event)
{
- Close();
+ if(!event.ControlDown())
+ Close();
// not using event.Skip() here to save us from a bad crash...
}
Index: sdk/wxscintilla/src/scintilla/src/Editor.cxx
===================================================================
--- sdk/wxscintilla/src/scintilla/src/Editor.cxx (revision 6903)
+++ sdk/wxscintilla/src/scintilla/src/Editor.cxx (working copy)
@@ -5379,7 +5379,10 @@
}
int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) {
- DwellEnd(false);
+
+ if (!ctrl)
+ DwellEnd(false);
+
int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
(alt ? SCI_ALT : 0);
int msg = kmap.Find(key, modifiers);
I need the filter out the control key event on the GDB tip window. I'm really strange why both of your system works correctly with my last patch?? any ideas??
BTW:
From the codelite's change log, eranif has use this feature for debugger:
rev 4672 of Codelite trunk
- New: debugger tooltip is now enabled only if CTRL key is down (configurable via the debugger settings page)
- Updated various scripts to set the new codelite version to 2.9.0
-------------------------------
M : /trunk/InnoSetup/make_packages.bat
M : /trunk/Interfaces/debugger.h
M : /trunk/LiteEditor/app.cpp
M : /trunk/LiteEditor/cl_editor.cpp
M : /trunk/LiteEditor/context_cpp.cpp
M : /trunk/LiteEditor/debuggersettingsbasedlg.cpp
M : /trunk/LiteEditor/debuggersettingsbasedlg.h
M : /trunk/LiteEditor/debuggersettingsdlg.cpp
M : /trunk/LiteEditor/frame.cpp
M : /trunk/LiteEditor/manager.cpp
M : /trunk/Runtime/config/debuggers.xml.default
M : /trunk/Runtime/config/debuggers.xml.gtk
M : /trunk/formbuilder/DebuggerSettings.fbp
M : /trunk/make_deb.sh
M : /trunk/make_src_targz.sh
M : /trunk/sdk/wxscintilla/src/scintilla/src/Editor.cxx
Do we need to implement this feature???
another question is:
How can this be done in Codeblocks:
The codelite's code is like below:
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.
Ollydbg: it will be ugly, if possible:)
agreed. really ugly.
we need to consider a better way.
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:
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)
};