Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <ghost@cs.msu.su>
To: gdb-patches@sources.redhat.com
Subject: Re: Remove type prefix for -var-evaluate-expression/functions
Date: Tue, 04 Apr 2006 07:18:00 -0000	[thread overview]
Message-ID: <e0t6jb$700$1@sea.gmane.org> (raw)
In-Reply-To: <20060317193702.GC19068@nevyn.them.org>

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

Daniel Jacobowitz wrote:

>> > Well I guess mi-var-cmd.exp.  Please remember that I'm not the
>> > maintainer
>> > but just an interested party.  See what Daniel says.  He might want
>> > something for mi2-var-cmd.exp too.
>> 
>> Ok, I'll wait for his comment.
> 
> mi-var-cmd.exp sounds good to me.  I don't think we need it in
> mi2-var-cmd.exp.  I have the same question I asked a moment ago about
> Nick's patch - is there any chance that someone relies on this
> information?
> 
> Here I think the chance is pretty slim; for pointers it's a more
> serious concern, but for functions this is a pretty rare case.
> So not versioning this change makes sense to me.

The new version of the patch, with testsuite change, is attached.

Changelog:
2006-03-15 Vladimir Prus <ghost@cs.msu.su>
        
        * c-valprint.c 
         (c_val_print): Don't print type prefix for functions.
         (c_value_print): Print type prefix for functions here.
        * testsuite/gdb.mi/mi-var-cmd.exp: Test for new behaviour.



- Volodya

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: type_prefix_2.diff --]
[-- Type: text/x-diff; name="type_prefix_2.diff", Size: 2168 bytes --]

Index: c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.39
diff -u -r1.39 c-valprint.c
--- c-valprint.c	18 Jan 2006 21:24:19 -0000	1.39
+++ c-valprint.c	4 Apr 2006 07:09:25 -0000
@@ -356,11 +356,6 @@
 	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
 	  break;
 	}
-      /* FIXME, we should consider, at least for ANSI C language, eliminating
-         the distinction made between FUNCs and POINTERs to FUNCs.  */
-      fprintf_filtered (stream, "{");
-      type_print (type, "", stream, -1);
-      fprintf_filtered (stream, "} ");
       /* Try to print what function it points to, and its address.  */
       print_address_demangle (address, stream, demangle);
       break;
@@ -570,6 +565,16 @@
 	}
     }
 
+  if (TYPE_CODE (type) == TYPE_CODE_FUNC)
+    {
+      /* FIXME, we should consider, at least for ANSI C language, eliminating
+         the distinction made between FUNCs and POINTERs to FUNCs.  */
+      fprintf_filtered (stream, "{");
+      type_print (type, "", stream, -1);
+      fprintf_filtered (stream, "} ");
+    }
+
+
   if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
     {
       /* Attempt to determine real type of object */
Index: testsuite/gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.18
diff -u -r1.18 mi-var-cmd.exp
--- testsuite/gdb.mi/mi-var-cmd.exp	14 Jan 2005 18:17:19 -0000	1.18
+++ testsuite/gdb.mi/mi-var-cmd.exp	4 Apr 2006 07:09:26 -0000
@@ -560,6 +560,15 @@
 mi_gdb_test "-var-update selected_a" \
 	"\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \
 	"update selected_a in do_special_tests"
+	
+mi_gdb_test "-var-create function * *f	" \
+	"\\^done,name=\"function\",numchild=\"0\",type=\"void \\(\\)\"" \
+	"create varobj for function variable"
+
+mi_gdb_test "-var-evaluate-expression function" \
+	"\\^done,value=\"0x.*\"" \
+	"print value of function object"
+
 
 mi_gdb_exit
 return 0

  reply	other threads:[~2006-04-04  7:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-17 14:33 Nick Roberts
2006-03-17 15:03 ` Vladimir Prus
2006-03-18  1:26   ` Daniel Jacobowitz
2006-04-04  7:18     ` Vladimir Prus [this message]
2006-05-05 20:47       ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2006-03-17 10:20 Nick Roberts
2006-03-17 10:42 ` Vladimir Prus
2006-03-15 16:27 Vladimir Prus

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='e0t6jb$700$1@sea.gmane.org' \
    --to=ghost@cs.msu.su \
    --cc=gdb-patches@sources.redhat.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