Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA/MI testsuite] check for known uiout bugs
Date: Fri, 30 Aug 2002 14:19:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0208301405440.1395-100000@valrhona.uglyboxes.com> (raw)

Hi,

This patch adds a test to mi-basics.exp which tests the following uiout 
bug:

$ ./gdb -i=mi -nw -nx -q
(gdb)
-data-list-register-names -1
^error,msg="bad register number"
(gdb)
-data-list-register-names -1
^error,msg="bad register number"
(gdb)
-data-list-register-names -1
^error,msg="bad register number"
(gdb)
-data-list-register-names -1
^error,msg="bad register number"
(gdb)
-data-list-register-names -1
&"../../src/gdb/ui-out.c:130: gdb-internal-error: push_level: Assertion 
`uiout->level>= 0 && uiout->level < MAX_UI_OUT_LEVELS' failed.\n"
~"An internal GDB error was detected.  This may make further\n"
~"debugging unreliable.  Quit this debugging session? (y or n) "

This happens because the register-handling code does stuff like (pardon 
pseudo-code):

   ui_out_list_begin (...);
   foreach register requested
    {
       if register number is invalid
          return MI_CMD_ERROR
       ui_out_field_string (uiout, "name", REGISTER_NAME (register));
    }

    ui_out_list_end (uiout);
    return MI_CMD_DONE;

In other words, when an MI error occurs (one that doesn't occur via 
error()), the uiout still thinks that it is building a list. It fails to 
reset the uiout to some starting state with uiout->level = 0.

Keith

ChangeLog
2002-08-30  Keith Seitz  <keiths@redhat.com>

        * mi-basics.exp (test_generic_problems): New procedure.
        Add test to check for uiout list/tuple nesting bug.

Patch
Index: testsuite/gdb.mi/mi-basics.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-basics.exp,v
retrieving revision 1.6
diff -p -r1.6 mi-basics.exp
*** testsuite/gdb.mi/mi-basics.exp	27 Jun 2001 17:27:07 -0000	1.6
--- testsuite/gdb.mi/mi-basics.exp	30 Aug 2002 21:14:45 -0000
*************** proc test_dir_specification {} {
*** 164,173 ****
--- 164,195 ----
  #exp_internal 0
  }
  
+ proc test_generic_problems {} {
+ 
+   # Tests a bug with ui-out and nested uiout types. When 
+   # an error is encountered building a nest typed, like
+   # lists or tuples, the uiout is not reset to some sane
+   # state. As a result, uiout still thinks it is building
+   # this nested type. Execute enough of these errors and
+   # an assertion failure occurs. This is most obvious
+   # with invalid register number and the register commands.
+   #
+   # It should be sufficient to test call -data-list-register-names
+   # at least MAX_UIOUT_LEVELS + 1 times. We just assume a really
+   # high MAX_UIOUT_LEVELS to do this.
+   set counter 0
+   for {set i 0} {$i < 20} {incr i} {
+     mi_gdb_test "[expr {200 + $counter}]-data-list-register-names -1" \
+       {.*^error,msg="bad register number"} \
+       "[expr {200 + $counter}]-data-list-register-names -1"
+   }
+ }
+ 
  if [test_mi_interpreter_selection] {
    test_exec_and_symbol_mi_operatons
    test_breakpoints_deletion
    test_dir_specification
+   test_generic_problems
  }
  
  mi_gdb_exit


             reply	other threads:[~2002-08-30 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-30 14:19 Keith Seitz [this message]
2002-08-30 14:48 ` Andrew Cagney
2002-08-30 14:51   ` Keith Seitz
2002-08-30 15:14   ` Keith Seitz
2002-09-02 17:39     ` Andrew Cagney
2002-09-03  9:06       ` Keith Seitz

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=Pine.LNX.4.44.0208301405440.1395-100000@valrhona.uglyboxes.com \
    --to=keiths@redhat.com \
    --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