* UNSOLICITED JUNK E-MAIL. RETRUN TO SENDER.
[not found] <Pine.LNX.3.95.970601210529.5006A-100000@naphta.mb.jhu.edu>
@ 1997-06-02 15:41 ` sperati
0 siblings, 0 replies; only message in thread
From: sperati @ 1997-06-02 15:41 UTC (permalink / raw)
On Sun, 1 Jun 1997, Jeff Odom wrote:
> Date: Sun, 1 Jun 1997 21:15:18 -0400 (EDT)
> From: Jeff Odom <zeus@jhu.edu>
> 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
^ permalink raw reply [flat|nested] only message in thread