This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: insight crash


Fernando Nasser wrote:

> Barry Branham wrote:
> >
> > Fernando Nasser wrote:
> >
> > > Barry Branham wrote:
> > > >
> > > > I recompiled gnomine with -g.  Insight again just starts with a blank source
> > > > window - no menu bar, just the frame.  'ddd' opens it fine, however.
> > > >
> > >
> > > At the bottom of the source window there are two comboboxes.  Do they
> > > show
> > > any files in there?
> > >
> >
> > No, it's just a frame from the window manager.
> >
>
> Something went wrong when instantiating the Source Window class...
>
> You can see what went wrong by setting the following environment
> variables:
>
> setenv GDBTK_DEBUGFILE /dev/tty
> setenv GDBTK_DEBUG 2
>
> Take a look at the log and see if there is an obvious error message
> (or post it so I can take a look).
>

Did this and discovered that Insight was missing some ".itcl"  files from the
/usr/local/share/gdbtcl directory.  Namely: gdbmenubar.itcl, gdbtoolbar.itcl,
srcmenubar.itcl and srctoolbar.itcl.  Copied them from ./gdb/gdbtk/library/ and got a
proper source window.  It was very nice do see - so much nicer to use than the 'ddd'
interface.  However when I ran the gnomine program I could not continue after it stopped
at the first (default) breakpoint - the control functions were not enabled..  I can't
interpret this gdb tty output but it's rather lengthy so I won't include it. Maybe you
know the problem here - i.e. why the controls are disabled.

Obviously something didn't work in the Insight installation so the real question is what
is wrong with the install process.


>
> > It occured to me it might help you if I got the to top of the stack trace I sent last
> > time from running Insight with Dash so I made a tall window and held the return key.
> > Here's the result:
> >
> Now we are cooking.
>
> It seems that you've hit a bug in the GDB C++ symbol overloading
> routines.
>
> I Will revert the order of the frames so I can comment:
>
> >
> > #130919 0x813153c in gdb_search (clientData=0x8131344, interp=0x8358b58, objc=5,
> >     objv=0x83597d4) at ./gdbtk/generic/gdbtk-cmds.c:1618
>
> Here is where Insight calls GDB to get information about the symbol
> "main".
>
> > #130918 0x80982e9 in search_symbols (
> > regexp=0x83ab470 "main",
> >
> > kind=FUNCTIONS_NAMESPACE,
> >     nfiles=0
> >
> > , files=0x0, matches=0xbfffdab4) at symtab.c:2555
>
> Here we are not in Insight anymore.  We are in GDB (file symtab.c) where
> this function "search_symbols", looking for "main". We are looking for a
> function
> because  kind=FUNCTIONS_NAMESPACE.
>
> Here is this function definition (from GDB sources).
>
> /* Search the symbol table for matches to the regular expression REGEXP,
>    returning the results in *MATCHES.
>
>    Only symbols of KIND are searched:
>    FUNCTIONS_NAMESPACE - search all functions
>    TYPES_NAMESPACE     - search all type names
>    METHODS_NAMESPACE   - search all methods NOT IMPLEMENTED
>    VARIABLES_NAMESPACE - search all symbols, excluding functions, type
> names,
>    and constants (enums)
>
>    free_search_symbols should be called when *MATCHES is no longer
> needed.
>  */
> void
> search_symbols (char *regexp, namespace_enum kind, int nfiles, char
> *files[],
>                 struct symbol_search **matches)
>
> > #130917 0x8096100 in lookup_symbol (name=0x85759a8
> > "mainWindowWidget__C14VkSimpleWindow",
> >     block=0x0, namespace=VAR_NAMESPACE, is_a_field_of_this=0x0, symtab=0x0) at
> > symtab.c:595
>
> We found a partial match (it is not a function though).
>
> > #130916 0x8096100 in lookup_symbol (name=0x85759a8
> > "mainWindowWidget__C14VkSimpleWindow",
> >     block=0x863ac6c, namespace=VAR_NAMESPACE, is_a_field_of_this=0x0, symtab=0x0)
> >     at symtab.c:595
>
> Found the same symbol again.
>
> > #130915 0x8096100 in lookup_symbol (name=0x85759a8
> > "mainWindowWidget__C14VkSimpleWindow",
> >     block=0x863ac6c, namespace=VAR_NAMESPACE, is_a_field_of_this=0x0, symtab=0x0)
> >     at symtab.c:595
>
> And again.
>
> And this repeats until memory is exhausted.
>
> (gdb) bt
> #0  0x401cb245 in chunk_alloc (ar_ptr=0x0, nb=0) at malloc.c:2736
> #1  0x401cb08e in __libc_malloc (bytes=32) at malloc.c:2704
> #2  0x80d853a in xmmalloc (md=0x0, size=32) at utils.c:1024
> #3  0x80d85a8 in xmalloc (size=32) at utils.c:1059
> #4  0x8185274 in string_need (s=0xbf800290, n=16) at cplus-dem.c:4721
> #5  0x81853c5 in string_appendn (p=0xbf800290,
>
> It may be possible to repeat this crash without the GUI.  Maybe a
> "info function main" command in console mode (gdb -nw) will also
> dump core.
>
> If I could reproduce this here I could ask someone from the GDB symbols
> area
> to take a look at it.
>
> Can you try to cause the core dump with a soer of Hello, world! program
> that links to
> this library and send me the binary?  I could foward this to someone I
> believe will
> be able to tell us something about this...

I copied a ViewKit hello program and built it and ran Insight (with the missing .itcl
files installed) on it and got the same segfault.

Here's the debug output from that:

----------------
I ManagedWin init {}
I ManagedWin _open {DebugWin }
I ManagedWin _create {win=debugwin args=}
I ManagedWin constructor {::.debugwin0.debugwin args=}
I DebugWin constructor {}
W global gdbtk_clear_file GDBTK_CLEAR_FILE
I ManagedWin find SrcWin
I global gdbtk_locate_main {gdbtk_locate_main: Searching MAIN___ MAIN__ main}
I SrcWin point_to_main {could not find main}
I ManagedWin startup {Got active list {ManagedWin::open DebugWin} {ManagedWin::open
SrcWin}}
I ManagedWin _open {DebugWin }
I ManagedWin _open {SrcWin }
I ManagedWin _create {win=srcwin args=}
I GDBWin constructor {GDBWin::constructor }
I ManagedWin constructor {::.srcwin0.srcwin args=}
I TopLevelWin constructor .srcwin0.srcwin
I SrcWin constructor {}
W SrcToolBar _set_runstop normal
W SrcToolBar {} {configuring runstop normal}
W SrcToolBar _set_runstop normal
I global gdbtk_locate_main {gdbtk_locate_main: Searching MAIN___ MAIN__ main}

----------------------
This agrees with your analysis of the stack dump.
Here's the source - VkHello.cc:


////////////////////////////////////////////////////////////////////////////////
///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
//                                                                            //
// This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
// the contents of this file may not be disclosed to third parties, copied    //
// or duplicated in any form, in whole or in part, without the prior written  //
// permission of Silicon Graphics, Inc.                                       //
//                                                                            //
// RESTRICTED RIGHTS LEGEND:                                                  //
// Use,duplication or disclosure by the Government is subject to restrictions //
// as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
// and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
// successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
// rights reserved under the Copyright Laws of the United States.             //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////
// hello.c++: This example displays a simple label in a window. The program
// instantiates a VkApp object and defines a toplevel window class,
// HelloWindow, which is a subclass of VkSimpleWindow.
// Unlike the "generic" examples, this is the more usual way
// to organize a program, as it provides a place to keep
// per-window state and a way to support per-window operations
////////////////////////////////////////////////////////////////////

#include <Vk/VkApp.h>
#include <Vk/VkSimpleWindow.h>
#include <Xm/Label.h>

// Define a top-level window class

class HelloWindow: public VkSimpleWindow {

  protected:

    Widget _label;    // Hang on to widget a a data member

  public:

    HelloWindow ( const char *name );
    ~HelloWindow();
    virtual const char* className();  // Identify this class
};


// The HelloWindow constructor provides a place in which to create a
// widget tree to be installed as a "view" in the window.

HelloWindow::HelloWindow ( const char *name ) : VkSimpleWindow ( name )
{
    _label =  XmCreateLabel ( mainWindowWidget(), "hello", NULL, 0 );

    addView(_label);
}

const char * HelloWindow::className()
{
    return "HelloWindow";
}

HelloWindow::~HelloWindow()
{
    // Empty
}


// Main driver. Just instantiate a VkApp and a top-level window, "show"
// the window and then "run" the application.

int main ( int argc, char **argv )
{
    VkApp        *app = new VkApp("Hello", &argc, argv);
    HelloWindow  *win = new HelloWindow("hello");

    win->show();
    app->run();
}

--------------------------
And the Makefile:
--------------------------

#
#  Makefile for VkHello.cc
#

CXX = g++
OPTIMIZER = -g

CXXFLAGS= $(OPTIMIZER) $(CXXOPTS) $(INCLUDEDIR)

INCLUDEDIR = -I/usr/X11R6/include -I/usr/X11R6/share/include

VKLIBPATH = -L/usr/X11R6/lib

MOTIFLIBS = -lXmu -lXext -lXm -lXp -lXt -lSM -lICE -lX11
VKLIBS =  $(VKLIBPATH) -lvk  -lvkhelp -lXpm -ldl
LLDLIBS=  $(VKLIBS) $(MOTIFLIBS) -lm

PROG = VkHello

$(PROG): $(PROG).o
 $(CXX) $(CXXFLAGS) -o $(PROG) $(PROG).o $(LLDLIBS)

$(PROG).o: $(PROG).cc
 $(CXX) $(CXXFLAGS) -c $(PROG).cc -o $(PROG).o

-------------------------------------

You will need ViewKit which is available from www.viewkit.com and also motif or lesstif.
I'm using openmotif which is rpm'd at www.motifzone.net.

Good luck!
Barry




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]