← Back to team overview

kicad-developers team mailing list archive

Re: Segfault when running DRC

 

The invalid read seems to be a bug in wxWidgets:

src/gtk/window.cpp:1543

static void SendSetCursorEvent(wxWindowGTK* win, int x, int y)
{
    wxSetCursorEvent event(x, y);
    wxWindowGTK* w = win;
    do {
        if (w->GTKProcessEvent(event))
        {
            gs_overrideCursor = &event.GetCursor();
            win->GTKUpdateCursor();
            gs_needCursorResetMap[win] = true;
            return;
        }
        // this is how wxMSW works...
        if (w->GetCursor().IsOk())
            break;
        w = w->GetParent();
    } while (w);
    if (gs_needCursorResetMap[win])
        win->GTKUpdateCursor();
}

event is a local variable on the stack and as a result, as soon as this
function returns gs_overrideCursor is invalid.

I'm not yet sure if this has any relationship whatsoever to the crash
I'm hunting.

On Fri, 2014-08-15 at 23:31 -0400, Andrew Zonenberg wrote:
> I'm not using codelight itself, just their precompiled wx binaries, so I
> can easily remove the binary package, it was just less work than
> compiling from source.
> 
> I'm investigating further now, I fixed an unrelated missing variable
> initializer in the process and will be submitting a patch to that
> shortly.
> 
> On Fri, 2014-08-15 at 22:14 -0500, Dick Hollenbeck wrote:
> > On 08/15/2014 08:32 PM, Andrew Zonenberg wrote:
> > > Does not crash when run under Valgrind, instead gives this error:
> > > 
> > > ==32723== Invalid read of size 8
> > 
> > ^ this error?  I've seen that before and never could figure it out, nor was it ever the
> > cause of any problem running valgrind.
> > 
> > I would say build your own wxwidgets from the 3.0.1 source.  We're dealing with an unknown
> > problem, so one has to revert to probabilities at that point.
> > 
> > I think the highest probability is that there is some incompatibility in your software
> > stack.  Building wx from source is an easy experiment.  You do not have to remove the wx
> > package if it makes codelight happy.
> > 
> > Follow the instructions I gave in an earlier email today.  Then after configuring the
> > kicad build, I run
> > 
> > (ccmake is in the package cmake-curses-gui I think.)
> > 
> > $ ccmake .
> > 
> > in the build directory.  Then I paste in
> > 
> >   /opt/wx3.0-stl/bin/wx-config
> > 
> > into the field named:  wxWidgets_CONFIG_EXECUTABLE and reconfigure in ccmake.
> > 
> > Likewise for the debug build, which over time will be very helpful for you.
> > 
> > 
> > Obviously the first part of the /opt/wx3.0-stl/bin/wx-config string came from the --prefix
> > argument to the wx configure command.
> > 
> > Don't forget to run $ sudo ldconfig
> > after installing the home made wx libraries.
> > 
> > 
> > 
> > 
> > 
> > > ==32723==    at 0x5D00EC0: wxCursor::GetCursor() const (cursor.cpp:287)
> > > ==32723==    by 0x5D20A8D: wxWindow::GTKUpdateCursor(bool, bool)
> > > (window.cpp:3752)
> > > ==32723==    by 0x5D002A0: UpdateCursors(wxWindow*, bool)
> > > (cursor.cpp:331)
> > > ==32723==    by 0x5D00F42: SetGlobalCursor(wxCursor const&)
> > > (cursor.cpp:350)
> > > ==32723==    by 0x5D0109C: wxEndBusyCursor() (cursor.cpp:376)
> > > ==32723==    by 0x1D3FCCDB:
> > > DIALOG_DRC_CONTROL::OnStartdrcClick(wxCommandEvent&)
> > > (dialog_drc.cpp:172)
> > > ==32723==    by 0x65F92DE:
> > > wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&,
> > > wxEvent&) const (appbase.cpp:623)
> > > ==32723==    by 0x6750FF1:
> > > wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
> > > wxEvtHandler*, wxEvent&) (event.cpp:1384)
> > > ==32723==    by 0x67513A5:
> > > wxEvtHandler::SearchDynamicEventTable(wxEvent&) (event.cpp:1743)
> > > ==32723==    by 0x6751445: wxEvtHandler::TryHereOnly(wxEvent&)
> > > (event.cpp:1577)
> > > ==32723==    by 0x6751502: wxEvtHandler::ProcessEventLocally(wxEvent&)
> > > (event.h:3671)
> > > ==32723==    by 0x6751564: wxEvtHandler::ProcessEvent(wxEvent&)
> > > (event.cpp:1487)
> > > ==32723==  Address 0x7feffdee8 is not stack'd, malloc'd or (recently)
> > > free'd
> > > 
> > > 
> > > On Fri, 2014-08-15 at 21:19 -0400, Andrew Zonenberg wrote:
> > >> Happens every time I run DRC on this board. I don't want to change the
> > >> design for fear of not being able to reproduce it.
> > >>
> > >> This is with the Codelite packages of wx3.0.1 and BZR 5073 kicad on
> > >> Debian 7.
> > >>
> > >> Program received signal SIGSEGV, Segmentation fault.
> > >> IA__gdk_cursor_ref (cursor=cursor@entry=0xf2e66c318c48348)
> > >> at /tmp/buildd/gtk+2.0-2.24.10/gdk/gdkcursor.c:57
> > >> 57	/tmp/buildd/gtk+2.0-2.24.10/gdk/gdkcursor.c: No such file or
> > >> directory.
> > >> (gdb) bt
> > >> #0  IA__gdk_cursor_ref (cursor=cursor@entry=0xf2e66c318c48348)
> > >> at /tmp/buildd/gtk+2.0-2.24.10/gdk/gdkcursor.c:57
> > >> #1  0x00007ffff47cc691 in IA__gdk_window_set_cursor (window=0xbe3120,
> > >> cursor=0xf2e66c318c48348) at /tmp/buildd/gtk
> > >> +2.0-2.24.10/gdk/gdkwindow.c:8199
> > >> #2  0x00007ffff6b8897f in wxWindow::GTKUpdateCursor (this=0x8273f0,
> > >> isBusyOrGlobalCursor=<optimized out>, isRealize=false)
> > >> at ../src/gtk/window.cpp:3761
> > >> #3  0x00007ffff6b682a1 in UpdateCursors (win=win@entry=0x8273f0,
> > >> isBusyOrGlobalCursor=<optimized out>) at ../src/gtk/cursor.cpp:331
> > >> #4  0x00007ffff6b68f43 in SetGlobalCursor (cursor=...)
> > >> at ../src/gtk/cursor.cpp:350
> > >> #5  0x00007ffff6b6909d in wxEndBusyCursor ()
> > >> at ../src/gtk/cursor.cpp:376
> > >> #6  0x00007fffe26f4cdc in DIALOG_DRC_CONTROL::OnStartdrcClick
> > >> (this=0x3645700, event=...)
> > >> at /nfs/home/azonenberg/Documents/local/programming/3rdparty/kicad/pcbnew/dialogs/dialog_drc.cpp:172
> > >> #7  0x00007ffff627c2df in wxAppConsoleBase::CallEventHandler
> > >> (this=0x7b29e0, handler=0x3645700, functor=..., event=...)
> > >> at ../src/common/appbase.cpp:623
> > >>
> > >>
> > >> _______________________________________________
> > >> Mailing list: https://launchpad.net/~kicad-developers
> > >> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > >> Unsubscribe : https://launchpad.net/~kicad-developers
> > >> More help   : https://help.launchpad.net/ListHelp
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > Mailing list: https://launchpad.net/~kicad-developers
> > > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > > Unsubscribe : https://launchpad.net/~kicad-developers
> > > More help   : https://help.launchpad.net/ListHelp
> > > 
> > 
> > 
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

-- 
Andrew Zonenberg
PhD student, security group
Computer Science Department
Rensselaer Polytechnic Institute
http://colossus.cs.rpi.edu/~azonenberg/

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References