public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: pmuldoon@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  archer-pmuldoon-python-backtrace: Fix summary mode, scalars, all and none output in the CLI
Date: Tue, 11 Sep 2012 14:25:00 -0000	[thread overview]
Message-ID: <20120911142535.12070.qmail@sourceware.org> (raw)

The branch, archer-pmuldoon-python-backtrace has been updated
       via  ce5bf0ab811f2ef1fb528bcdcb6967808c67dc97 (commit)
      from  e66d17148bfb06c08f197b2ab82b4a0a6c368a2e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit ce5bf0ab811f2ef1fb528bcdcb6967808c67dc97
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Tue Sep 11 15:25:08 2012 +0100

    Fix summary mode, scalars, all and none output in the CLI

-----------------------------------------------------------------------

Summary of changes:
 gdb/python/py-framefilter.c                 |   10 +-----
 gdb/testsuite/gdb.python/py-framefilter.c   |   27 ++++++++++++--
 gdb/testsuite/gdb.python/py-framefilter.exp |   52 ++++++++++++++++++++++-----
 3 files changed, 67 insertions(+), 22 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 63cc439..f3b0aaa 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -481,8 +481,6 @@ enumerate_args (PyObject *iter,
 
   get_user_print_options (&opts);
 
-  opts.deref_ref = 1;
-
   if (! ui_out_is_mi_like_p (out))
     {
       /* True in "summary" mode, false otherwise.  */
@@ -1022,10 +1020,9 @@ py_print_frame (PyObject *filter, int print_level, int print_frame_info,
 	  annotate_frame_address ();
 	  ui_out_field_core_addr (out, "addr", gdbarch, address);
 	  annotate_frame_address_end ();
+	  ui_out_text (out, " in ");
 	}
 
-      ui_out_text (out, " in ");
-
       /* Print frame function.  */
       if (PyObject_HasAttrString (filter, "function"))
 	{
@@ -1254,11 +1251,6 @@ apply_frame_filter (struct frame_info *frame, int print_level,
   int success = 0;
   PyObject *iterable;
 
-  /* XXX: Does MI pay attention to this command? */
-  if (cli_print_frame_args_type != NULL)
-    /* Override print_args if the user option is set.  */
-    print_args = strcmp (cli_print_frame_args_type, "none");
-
   cleanups = ensure_python_env (gdbarch, current_language);
 
   iterable = bootstrap_python_frame_filters (frame);
diff --git a/gdb/testsuite/gdb.python/py-framefilter.c b/gdb/testsuite/gdb.python/py-framefilter.c
index 3e7f145..33476e7 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.c
+++ b/gdb/testsuite/gdb.python/py-framefilter.c
@@ -15,11 +15,19 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <stdlib.h>
 
 void funca(void);
 int count = 0;
 
-void end_func (void)
+typedef struct
+{
+  char *nothing;
+  int f;
+  short s;
+} foobar;
+
+void end_func (int foo, char *bar, foobar *fb, foobar bf)
 {
   const char *str = "The End";
   const char *st2 = "Is Near";
@@ -48,13 +56,26 @@ void funcb(int j)
 
 void funca(void)
 {
+  foobar fb;
+  foobar *bf = NULL;
+
   if (count < 10)
     {
       count++;
       funcb(count);
     }
 
-  end_func();
+  fb.nothing = "Foo Bar";
+  fb.f = 42;
+  fb.s = 19;
+
+  bf = alloca (sizeof (foobar));
+  bf->nothing = alloca (128);
+  bf->nothing = "Bar Foo";
+  bf->f = 24;
+  bf->s = 91;
+
+  end_func(21, "Param", bf, fb);
   return;
 }
 
@@ -67,8 +88,6 @@ void func1(void)
 
 int func2(void)
 {
-  int foo = 42;
-
   func1();
   return 1;
 }
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index e08c349..d3da491 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -45,7 +45,6 @@ set remote_obj_python_file [remote_download host ${srcdir}/${subdir}/${testfile}
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" "set auto-load safe-path"
 gdb_load ${binfile}
-gdb_test_no_output "set python print-stack full" "set auto-load safe-path"
 # Verify gdb loaded the script.
 gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*"
 
@@ -65,28 +64,63 @@ gdb_test "info frame-filter" \
     ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*"
 # Test raw
 gdb_test "bt raw" \
-    ".*#0.*end_func.*#22.*in func1.*#27.*in main ().*"
+    ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*"
 
 # Test reverse
 gdb_test "bt" \
-    ".*#0.*cnuf_dne.*#22.*in 1cnuf.*#27.*in niam ().*"
+    ".*#0.*cnuf_dne.*#22.*in 1cnuf.*#27.*in niam \\(\\).*"
 
 # Disable Reverse
 gdb_test_no_output "set python frame-filter disable global Reverse"
 gdb_test "bt" \
-    ".*#0.*end_func.*#22.*in func1.*#27.*in main ().*"
+    ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*"
 
 gdb_test "bt -2" \
-    ".*#26.*func5.*#27.*in main ().*"
+    ".*#26.*func5.*#27.*in main \\(\\).*"
 
 gdb_test "bt 3" \
-    ".*#0.*end_func.*#1.*in funca ().*#2.*in funcb ().*"
+    ".*#0.*end_func.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*"
 
 gdb_test "bt raw full" \
-    ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca ().*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*"
+    ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*"
 
 gdb_test "bt full" \
-    ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca ().*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\).*#23.*in func2 \\(\\).*foo = 42.*"
-
+    ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\).*#23.*in func2 \\(\\).*"
+
+# Test set print frame-arguments
+# none
+gdb_test_no_output "set print frame-arguments none" "turn off frame arguments"
+gdb_test "bt raw 1" \
+    "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \
+    "bt raw no args"
+gdb_test "bt 1" \
+    "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \
+    "bt full no args"
+# scalars
+gdb_test_no_output "set print frame-arguments scalars" "turn off frame arguments"
+gdb_test "bt raw 1" \
+    "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \
+    "bt raw scalars"
+
+gdb_test "bt 1" \
+    "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \
+    "bt scalars"
+# all
+gdb_test_no_output "set print frame-arguments all" "turn off frame arguments"
+gdb_test "bt raw 1" \
+    "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+    "bt raw all args"
+gdb_test "bt 1" \
+    "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+    "bt all args"
+
+# set print address off
+gdb_test_no_output "set print address off" "turn off address printing"
+gdb_test "bt raw 1" \
+    "#0  end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+    "bt raw no address"
+gdb_test "bt 1" \
+    "#0  end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+    "bt no addresss"
 
 remote_file host delete ${remote_python_file}


hooks/post-receive
--
Repository for Project Archer.


                 reply	other threads:[~2012-09-11 14:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120911142535.12070.qmail@sourceware.org \
    --to=pmuldoon@sourceware.org \
    --cc=archer-commits@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).