From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <354586788bf5754b1eff92366e470c4c.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199706021536.LAA02184@linux03.amt.tay1.dec.com> Date: Mon, 2 Jun 1997 11:41:03 -0400 (EDT) From: sperati Subject: UNSOLICITED JUNK E-MAIL. RETRUN TO SENDER. In-Reply-To: On Sun, 1 Jun 1997, Jeff Odom wrote: > Date: Sun, 1 Jun 1997 21:15:18 -0400 (EDT) > From: Jeff Odom > Reply-To: axp-list@redhat.com > To: axp-list@redhat.com > Subject: fix for gdb > Resent-Date: 2 Jun 1997 01:15:23 -0000 > Resent-From: axp-list@redhat.com > Resent-cc: recipient list not shown: ; > > It seems that gdb still has a problem stepping over calls to malloc(). > This is not isolated to only dynamic binaries, but includes static ones as > well. After spending a while tracing through the code, I found the > offending code. This segment, taken from the gdb-4.16axp.patch.gz, seems > to break calls to malloc(): > > diff -urN gdb-4.16/gdb/mdebugread.c gdb-4.16axp/gdb/mdebugread.c > --- gdb-4.16/gdb/mdebugread.c Sat Apr 6 02:09:55 1996 > +++ gdb-4.16axp/gdb/mdebugread.c Wed May 22 19:17:06 1996 > @@ -835,7 +835,23 @@ > if (sh->sc == scUndefined || sh->sc == scNil) > t = mdebug_type_int; > else > - t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name); > + { > + t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name); > + if (STREQ(name, "malloc") && t->code == TYPE_CODE_VOID) > + { > + /* I don't know why, but, at least under Linux/Alpha, > + when linking against a malloc without debugging > + symbols, its read as a function returning void---this > + is bad because it means we cannot call functions with > + string arguments interactively; i.e., "call > + printf("howdy\n")" would fail with the error message > + "program has no memory available". To avoid this, we > + patch up the type and make it void* > + instead. (davidm@azstarnet.com) > + */ > + t = t->pointer_type; > + } > + } > b = top_stack->cur_block; > if (sh->st == stProc) > { > > The problem that this code looks like it is trying to address is that gdb, > on Linux/Alpha, sees malloc() as returning a type void, instead of > (void *). In this code, t is a block with information about a type, and > t->pointer_type is a block with information about a pointer to that type. > > I'm guessing that, in the case of t describing (void), t->pointer_type > should describe (void *). However, in the case of a void type, > t->pointer_type is always NULL. > > I've removed this patch from the source build, and the resulting gdb seems > to work fine. However, I can't help but wonder if the problem that this > patch addressed has been resolved elsewhere, or if I'm just breaking some > other functionality. > > Jeff Odom > System Administrator > The Johns Hopkins Kreiger Mind/Brain Institute > > > -- > To unsubscribe: send e-mail to axp-list-request@redhat.com with > 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com > > -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com