This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 13/13] Document "no debug info debugging" improvements
- From: Pedro Alves <palves at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 13 Jul 2017 14:51:49 +0100
- Subject: Re: [PATCH 13/13] Document "no debug info debugging" improvements
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DEAF47CE1A
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DEAF47CE1A
- References: <1499912370-1842-1-git-send-email-palves@redhat.com> <1499912370-1842-14-git-send-email-palves@redhat.com> <d17cfebb-e0f1-ab0a-7878-a54c6edd734e@redhat.com>
On 07/13/2017 12:09 PM, Pedro Alves wrote:
> I woke up thinking that mapping to unprototyped is the wrong
> equivalence -- that it'd be better to assume the function is
> prototyped, since that's how most C functions are written as
> nowadays. Also, there's no such thing as an unprototyped
> function in C++.
>
> Assuming prototyped would allow this, for example:
>
> float mult (float v1, float v2) { return v1 * v2; }
>
> (gdb) p (float) mult (2.0f, 3.0f)
> $1 = 6
> (gdb) p (float) mult ((float) 2, (float) 3)
> $2 = 6
> (gdb) p ((float (*) (float, float)) mult) (2, 3)
> $3 = 6
>
> (gdb) ptype 2.0f
> type = float
> (gdb) ptype 2.0
> type = double
>
> If the function really is unprototyped, then you'd still be
> able to call it correctly via the function pointer cast syntax:
>
> float mult_noproto (v1, v2)
> float v1, v2;
> { return v1 * v2; }
>
> (gdb) p ((float (*) ()) mult_noproto) (2.0f, 3.0f)
> $1 = 6
> (gdb) p ((float (*) ()) mult_noproto) (2.0, 3.0)
> $2 = 6
> (gdb) p ((float (*) ()) mult_noproto) ((float) 2, (float) 3)
> $3 = 6
>
> I'll give this a try, and add those as tests to gdb.base/nodebug.exp.
This worked nicely, see below.
I'll tweak the docs, and send an updated patch.
Thanks,
Pedro Alves