[comp.windows.x] XGDB core dumps after GCC 1.32 compilation

schultz@mmm.UUCP (John C Schultz) (01/16/89)

Has anyone successfully compiled XGDB (version 3.0 downloaded from GDB sources
at osu-cis) using GCC 1.32?  Everything compiles and links OK using X11R2 on a
SUN 3/60 under SunOS 3.5 but when I try to debug a file I get

X Toolkit Warning: No type converter registered for 'String' to 'EditMode' conversion

text does not appear in the XGDB window and the next GDB command causes a core
dump regardless of the command.

Before I get desperate and try to debug the core dump, has anyone
solved this problem already?  Or is it a related to using X11R2 rather
than X11R3?
-- 
 john c. schultz   schultz@3M.Com   ..!uiucuxc!mmm!schultz  (612) 733-4047
           3M Center, Bldg 518-1-1, St. Paul, MN 55144-1000
  The opinions expressed herein are, as always, my own and not 3M's.

bob@allosaur.cis.ohio-state.edu (Bob Sutterfield) (01/17/89)

In article <1218@mmm.UUCP> schultz@mmm.UUCP (John C Schultz) writes:
>... [gdb3.0, gcc 1.32, SunOS3.5] ...
>X Toolkit Warning: No type converter registered for 'String' to 'EditMode' conversion
>...is it a related to using X11R2 rather than X11R3?

No, because the same thing happens under R3.  I haven't seen (nor
found) a solution yet.

ken@richsun.UUCP (Ken Marks) (01/18/89)

I found out what was causing the "X Toolkit Warning: No type converter 
registered for 'String' to 'EditMode' conversion" message and what was causing 
the core dump (the two are unrelated).  First, the core dump occurs when the
pointer "fi" is dereferenced in about line 109 of xgdb.c.  As far as I could
tell xgdb_display_source() gets called before everything is set up.  There is
an earlier return that checks that containing_widget is non-NULL.  In this
spirit, I added a test for "fi" being NULL and likewise returned.  

The problem of the type converter comes from the type converter being used
before it was registered (seems obvious).  The function create_text_widget
needs to create a text widget (which registers the type converter) before 
using the type converter to get up its args.  The second chunk of diff fixes
this.  How this ever worked before is a mystery to me, but then again a lot
of things are mysteries to me...

I hope this helps get people going with xgdb.  I personally do not use it
since I feel that it is still a little rough around the edges in terms of user
interface (i.e. It's still not up to the level of a dbxtool).  The points where
it could use some tweaking are 1) place output in a window within xgdb (an 
ansitool widget would be nice) 2) give some visual feedback in the source code
window as to where breakpoints are set and where the program has stopped 
execution (a la dbxtool) 3) add an "expand selection" mechanism 4) add an
option to NOT scroll the source code so that the current line is in the center
of the window (with large windows this gets annoying).

I know the rules: don't compain about problems - fix them and submit the 
patches.  Well, as soon as I get a little breathing room in my schedule, I
plan on it.  Anybody else who is interested in patching this program into a
truely usable piece of code, I would be interested in hearing from you.
(Anybody from SUN consider working on this???...)

			-Ken Marks

>>> Sorry for the ^L's in the diffs, but they are in the code... <<<

*** xgdb.c.orig	Tue Jan 10 14:25:55 1989
--- xgdb.c	Tue Jan 10 15:20:33 1989
***************
*** 105,111 ****
  
    /* Get the symtab and line number of the selected frame.  */
  
!   fi = get_frame_info (selected_frame);
    sal = find_pc_line (fi->pc, fi->next_frame);
  
    /* Strictly this is wrong, but better than a blank display */
--- 105,113 ----
  
    /* Get the symtab and line number of the selected frame.  */
  
!   if ((fi = get_frame_info (selected_frame)) == NULL)
!     return;
! 
    sal = find_pc_line (fi->pc, fi->next_frame);
  
    /* Strictly this is wrong, but better than a blank display */
***************
*** 421,427 ****
--- 423,433 ----
    static Arg fileArgs[3];
    XtTextSource src;
    XtTextSink   sink;
+   Widget text_widget;
  
+   text_widget = XtCreateManagedWidget("disk", textWidgetClass, parent, 
+     NULL, 0);
+ 
    XtSetArg (fileArgs[0], XtNfile, filename);
    src = XtDiskSourceCreate(parent, fileArgs, 1);
    sink = XtAsciiSinkCreate(parent, NULL, 0);
***************
*** 429,435 ****
    XtSetArg (fileArgs[0], XtNtextOptions, scrollVertical);
    XtSetArg (fileArgs[1], XtNtextSource, src);
    XtSetArg (fileArgs[2], XtNtextSink, sink);
!   return XtCreateManagedWidget("disk", textWidgetClass, parent, fileArgs, XtNumber (fileArgs));
  }
  
  /* Entry point to create the widgets representing our display.  */
--- 435,442 ----
    XtSetArg (fileArgs[0], XtNtextOptions, scrollVertical);
    XtSetArg (fileArgs[1], XtNtextSource, src);
    XtSetArg (fileArgs[2], XtNtextSink, sink);
!   XtSetValues(text_widget, fileArgs, XtNumber (fileArgs));
!   return text_widget;
  }
  
  /* Entry point to create the widgets representing our display.  */