Bug 8442 - -Wformat-nonliteral vs printcmd.c - make "(gdb) printf" host independant
Summary: -Wformat-nonliteral vs printcmd.c - make "(gdb) printf" host independant
Status: RESOLVED OBSOLETE
Alias: None
Product: gdb
Classification: Unclassified
Component: cli (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-16 18:08 UTC by ac131313
Modified: 2021-12-28 19:49 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ac131313 2003-08-16 18:08:01 UTC
[Converted from Gnats 1337]

printcmd.c is taking user input strings and then passing them through to printf.  It should, I think, instead implement a full "%" parser.  If nothing else it would eliminate a few limitations (such as %ll support being dependant on the host's CC and printf).

Release:
unknown
Comment 1 Daniel Jacobowitz 2003-08-18 04:17:01 UTC
From: Daniel Jacobowitz <drow@mvista.com>
To: ac131313@redhat.com
Cc: gdb-gnats@sources.redhat.com
Subject: Re: cli/1337: -Wformat-nonliteral vs printcmd.c - make "(gdb) printf" host independant
Date: Mon, 18 Aug 2003 00:17:01 -0400

 On Sat, Aug 16, 2003 at 06:06:30PM -0000, ac131313@redhat.com wrote:
 > 
 > >Number:         1337
 > >Category:       cli
 > >Synopsis:       -Wformat-nonliteral vs printcmd.c - make "(gdb) printf" host independant
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    unassigned
 > >State:          open
 > >Class:          maintenance
 > >Submitter-Id:   net
 > >Arrival-Date:   Sat Aug 16 18:08:01 UTC 2003
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     ac131313@redhat.com
 > >Release:        unknown-1.0
 > >Organization:
 > >Environment:
 > 
 > >Description:
 > printcmd.c is taking user input strings and then passing them through
 > to printf.  It should, I think, instead implement a full "%" parser. 
 > If nothing else it would eliminate a few limitations (such as %ll
 > support being dependant on the host's CC and printf).
 
 Could we use the publicly available libvsnprintf for this?  I think
 it's a GNU or else public domain project; there was some talk about
 adding it to libiberty.
 
 -- 
 Daniel Jacobowitz
 MontaVista Software                         Debian GNU/Linux Developer

Comment 2 ac131313 2003-08-18 15:34:09 UTC
From: Andrew Cagney <ac131313@redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-gnats@sources.redhat.com
Subject: Re: cli/1337: -Wformat-nonliteral vs printcmd.c - make "(gdb) printf"
 host independant
Date: Mon, 18 Aug 2003 11:34:09 -0400

 > Description:
 > 
 >> printcmd.c is taking user input strings and then passing them through
 >> to printf.  It should, I think, instead implement a full "%" parser. 
 >> If nothing else it would eliminate a few limitations (such as %ll
 >> support being dependant on the host's CC and printf).
 > 
 > 
 > Could we use the publicly available libvsnprintf for this?  I think
 > it's a GNU or else public domain project; there was some talk about
 > adding it to libiberty.
 
 Does it use <stdargs.h>?  If not that, and the type casting system, 
 would also need to be abstracted.  GDB's printf [effectively] extracts 
 its argument list from an array of 'struct value'.
 
 Andrew
 
 

Comment 3 Daniel Jacobowitz 2003-08-18 15:34:59 UTC
From: Daniel Jacobowitz <drow@mvista.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-gnats@sources.redhat.com
Subject: Re: cli/1337: -Wformat-nonliteral vs printcmd.c - make "(gdb) printf" host independant
Date: Mon, 18 Aug 2003 11:34:59 -0400

 On Mon, Aug 18, 2003 at 11:34:09AM -0400, Andrew Cagney wrote:
 > >Description:
 > >
 > >>printcmd.c is taking user input strings and then passing them through
 > >>to printf.  It should, I think, instead implement a full "%" parser. 
 > >>If nothing else it would eliminate a few limitations (such as %ll
 > >>support being dependant on the host's CC and printf).
 > >
 > >
 > >Could we use the publicly available libvsnprintf for this?  I think
 > >it's a GNU or else public domain project; there was some talk about
 > >adding it to libiberty.
 > 
 > Does it use <stdargs.h>?  If not that, and the type casting system, 
 > would also need to be abstracted.  GDB's printf [effectively] extracts 
 > its argument list from an array of 'struct value'.
 
 No idea.  It could probably be adapted.
 
 -- 
 Daniel Jacobowitz
 MontaVista Software                         Debian GNU/Linux Developer
Comment 4 Tom Tromey 2012-12-19 14:47:05 UTC
We have the parser now, but still not the formatting part.
So, things like %ll are still dependent on the host.
This has gotten into gdbserver now as well.
Comment 5 Tom Tromey 2021-12-28 19:49:56 UTC
I think that now there isn't any big issue with relying on the
host printf in the limited way that we do.