This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: breakpoints/1052: GDB 5.3 (macro supporting) - macro value is string without quotes.
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 13 Feb 2003 16:08:00 -0000
- Subject: Re: breakpoints/1052: GDB 5.3 (macro supporting) - macro value is string without quotes.
- Reply-to: Daniel Jacobowitz <drow at mvista dot com>
The following reply was made to PR breakpoints/1052; it has been noted by GNATS.
From: Daniel Jacobowitz <drow@mvista.com>
To: "Gvozdeva, Svetlana" <Svetlana_Gvozdeva@stl.sarov.ru>
Cc: gdb-gnats@sources.redhat.com, miwako.tokugawa@intel.com
Subject: Re: breakpoints/1052: GDB 5.3 (macro supporting) - macro value is string without quotes.
Date: Thu, 13 Feb 2003 11:03:10 -0500
On Thu, Feb 13, 2003 at 08:47:58AM +0300, Gvozdeva, Svetlana wrote:
> Hello, Daniel.
>
> I think that it is not correct (I meant both 1052 && 1053).
> If there is limit for printing of macro values then GDB's help should
> contain information about it.
> Right now I do not see this information in help.
>
> As I see GDB performs macro substitution in whole command line (that is why
> we get bad command line).
> But I think that command 'print' should print value for all kinds of macros.
>
> First phase can be to find if command argument is exist (variable or macro
> symbol) and second phase can be printing of macro value if argument is macro
> symbol.
> I think that printing of macro should be the similar to printing of
> variable. If variable is visible then it should be variable value. If macro
> is visible then it should be macro value.
>
> As I see GDB prints 'p 234' without problem but symbol '234' is not variable
> or macro symbol or other symbol.
We don't special-case printing a variable; it's an expression
evaluator.
My point is that "p 234" prints the value of the C expression "234". "p
var" prints the value of the C expression "var". "p MACRO" is printing
the value of the C expression "MACRO" which happens to not be a valid
expression. I don't see a problem with the current behavior.
Let's see if anyone else has an opinion.
> -----Original Message-----
> From: Daniel Jacobowitz [mailto:drow@mvista.com]
> Sent: Wednesday, February 12, 2003 6:16 PM
> To: Gvozdeva, Svetlana
> Cc: gdb-gnats@sources.redhat.com; miwako.tokugawa@intel.com
> Subject: Re: breakpoints/1052: GDB 5.3 (macro supporting) - macro value
> is string without quotes.
>
>
> On Wed, Feb 12, 2003 at 08:28:47AM -0000, sana@stl.sarov.ru wrote:
> >
> > >Number: 1052
> > >Category: breakpoints
> > >Synopsis: GDB 5.3 (macro supporting) - macro value is string
> without quotes.
> > >Confidential: no
> > >Severity: serious
> > >Priority: high
> > >Responsible: unassigned
> > >State: open
> > >Class: sw-bug
> > >Submitter-Id: net
> > >Arrival-Date: Wed Feb 12 08:38:00 UTC 2003
> > >Closed-Date:
> > >Last-Modified:
> > >Originator: sana@stl.sarov.ru
> > >Release: unknown-1.0
> > >Organization:
> > >Environment:
> > 32-bit and 64-bit Linux, GDB 5.3
> > >Description:
> > GDB 5.3 supports work with section .debug_macinfo.
> > During testing it has been found out that GDB 5.3 has problem with
> printing of macro symbols whose value is string without quotes.
> > But it is usual parctice to use such values.
> >
> > tets.c:
> >
> > #define PREFIX small
> > main()
> > {
> > int PREFIX_i = 10, PREFIX_j;
> >
> > PREFIX_j = abs(PREFIX_i);
> > return;
> > }
> >
> >
> > GDB's output for this test is:
> >
> > This GDB was configured as "i686-pc-linux-gnu"...
> > (gdb) b main
> > Breakpoint 1 at 0x8048aef: file test2.c, line 4.
> > (gdb) r
> > Starting program: /home1/sana/macro/tr/a.out
> >
> > Breakpoint 1, main () at test2.c:4
> > 4 int PREFIX_i = 10, PREFIX_j;
> > (gdb) p PREFIX
> > No symbol "small" in current context.
> > (gdb)
>
> Same question as for your other report - why do you think this is a
> bug, and what do you expect GDB to do when you say "p PREFIX"? "macro
> expand PREFIX" will work, but "PREFIX" as an expression is a syntax
> error because small is undeclared.
>
>
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer