Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Jason Molenda <jason-swarelist@molenda.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: PATCH: Add type_sprint() function to return type in string form
Date: Tue, 22 Apr 2003 03:26:00 -0000	[thread overview]
Message-ID: <20030422032629.GB5033@nevyn.them.org> (raw)
In-Reply-To: <20030418152426.A93348@molenda.com>

On Fri, Apr 18, 2003 at 03:24:26PM -0700, Jason Molenda wrote:
> There are a few places in gdb where code prints an error message
> with a type included in it.  The only way for these functions to
> print a type is with type_print(), which takes a ui_file stream to
> print its output to.  This means they either have to send the output
> to gdb_stderr, or build up a fake memory ui_file and retrieve the
> contents.
> 
> This patch adds a type_sprint() which does the latter and returns the
> xmalloc()'ed string.
> 
> The current code gives bogus data to an MI client.  We had a bug that
> gave this output at Apple:
> 
> -> 64-var-list-children "var7" 2
> <- 64^error,msg="."
> -> 65-exec-status
> <- (gdb) 
> <- &"Type TWindow has no component named TWindow"
> <- 65^done,status="stopped"
> 
> This happens because this particular error reporter looked like this:
> 
>   fprintf_unfiltered (gdb_stderr, "Type ");
>   type_print (type, "", gdb_stderr, -1);
>   fprintf_unfiltered (gdb_stderr, " has no component named ");
>   fputs_filtered (name, gdb_stderr);
>   error (".");
> 
> Similar code shows up in a few places, so it made sense to create a 
> single function to format a type into a string and return the string.
> 
> I can drop the ada-lang.c part of the patch if that will complicate
> the approval, but given that this code is clearly derived from
> gdbtypes.c, I don't think the change is particularly controversial.
> 
> This patch adds no new testsuite failures on RHL7.1 (gcc 2.96, stabs).

I think this is OK.  Sit on it for another day or two and check it in
if no one objects in that time, please.

> 
> 2003-04-18  Jason Molenda  (jmolenda @ apple.com)
> 
>         * typeprint.c (type_sprint): New function to return string form
>         of types.  Use as type_print, sans a stream.
>         * value.h (type_sprint): Add prototype.
>         * ada-lang.c (ada_lookup_struct_elt_type): Use type_sprint() when
>         building error message.
>         * gdbtypes.c (lookup_struct_elt_type): Ditto.
>         * varobj.c (varobj_get_type): Use type_sprint() to get the type
>         in a string form.


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2003-04-22  3:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-18 22:24 Jason Molenda
2003-04-22  3:26 ` Daniel Jacobowitz [this message]
2003-04-22 16:48   ` Andrew Cagney
2003-04-22 16:55     ` Daniel Jacobowitz
2003-04-22 17:29       ` Andrew Cagney
2003-04-22 17:33         ` Daniel Jacobowitz
2003-04-22 19:21           ` Andrew Cagney
2003-04-22 19:28             ` Daniel Jacobowitz
2003-04-22 20:16               ` Andrew Cagney
2003-04-22 20:22                 ` Daniel Jacobowitz
2003-04-22 20:35                   ` Jason Molenda
2003-04-22 21:15               ` Andrew Cagney
2003-04-22 19:55             ` Kevin Buettner
2003-04-23 14:23 ` Jason Molenda
2003-04-23 17:37   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030422032629.GB5033@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jason-swarelist@molenda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox