Re: [Cgdb-devel] [ 790050 ] segfault in filedlg - patch
Brought to you by:
bobbybrasko,
crouchingturbo
From: Bob R. <bo...@br...> - 2003-08-20 15:07:05
|
Anyways, Here is the patch. I applied it to cvs, but that has had a bunch of code applied to it since cgdb-0.3.4. So, you can either use=20 whats in cvs or patch what you have. Index: tgdb/annotate-two/src/commands.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cgdb/cgdb/tgdb/annotate-two/src/commands.c,v retrieving revision 1.8 diff -w -u -r1.8 commands.c --- tgdb/annotate-two/src/commands.c 19 Aug 2003 17:59:37 -0000 1.8 +++ tgdb/annotate-two/src/commands.c 20 Aug 2003 13:42:30 -0000 @@ -457,6 +457,10 @@ } =20 void commands_send_gui_sources(struct commands *c, struct queue *q){ + /* If the inferior program was not compiled with debug, then no sources + * will be available. If no sources are available, do not return the + * TGDB_UPDATE_SOURCE_FILES command. */ + if ( queue_size ( c->source_files ) > 0 ) tgdb_append_command ( q, TGDB_UPDATE_SOURCE_FILES, c->source_files ); } Thanks, Bobby On Wed, Aug 20, 2003 at 09:11:05AM -0400, Bob Rossi wrote: > Hi Bartosz, >=20 > Thanks for the patch. I have reproduced the problem you are seeing. > I think you are right about saying the patch belongs in TGDB. I will > look into fixing TGDB so that it returns TGDB_SOURCES_DENIED the > first time, and not just every time after the first time. >=20 > Also, because of this bug, I found another bug that needs to be fixed. > The second time, when you actually do get the message > "...No sources available...", you have to hit ESC or 'q' to get out of > the file dialog mode, before you can hit any other keys ( CGDB thinks it > is in the filedlg ). If the error occurs, I think it should leave you in > CGDB's window. >=20 > So, I'll try to fix these 2 bugs today. >=20 > By the way, are you working with Robert Lemmen? I know he has done some > work for packing CGDB with debian. I don't know exactly what he did, but > I know he worked on it a little. His Email is rob...@se... if > you want to find out what he is doing. >=20 > Thanks for the heads up, > Bob Rossi >=20 >=20 > On Tue, Aug 19, 2003 at 09:36:56PM +0200, Bartosz Zapalowski wrote: > > Hi > >=20 > > Here's a patch that solves the bug #790050. > >=20 > > I plan to package cgdb for Debian and have this package sponsored. > > Because of that you can expect more patches from me, because I want no > > bugs in programs I package, got it ;). > >=20 > > This patch is rather a quick hack, and not the proper solution. However, > > the source code is hard do hack, hence this workaround. > >=20 > > The proper fix would be to patch tgdb sources. Try the following > > *before* applying this patch: > > $ cgdb > > ESC, o > > q > > ESC, o > >=20 > > As you can see, at first you get a blank screen. At a second 'o' command > > you get > > Error: No sources available! Was program compiled with debug? > >=20 > > As I figured out, the problem is in annotate-two, which incorrectly > > parses gdb output for the first time (or maybe it's gdb bad boy?). > >=20 > > --=20 > > Bartosz Zapalowski > > ba...@kl... >=20 > > diff -ruN cgdb-0.3.4-old/cgdb/src/cgdb.c cgdb-0.3.4-new/cgdb/src/cgdb.c > > --- cgdb-0.3.4-old/cgdb/src/cgdb.c 2003-06-24 03:25:35.000000000 +0200 > > +++ cgdb-0.3.4-new/cgdb/src/cgdb.c 2003-08-19 21:15:10.000000000 +0200 > > @@ -366,6 +366,12 @@ > > =20 > > if_clear_filedlg(); > > =20 > > + if (queue_size (q) =3D=3D 0) { > > + if_display_message("Error:", 0, =20 > > + " No sources available! Was program compiled with debug?"); > > + break; > > + } > > + > > while ( queue_size ( q ) > 0 ) { > > s =3D queue_pop( q ); > > =20 >=20 >=20 >=20 |