public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug guile/26533] FAIL: gdb.guile/scm-type.exp: lang_c: test_fields: cast to array with two arguments
Date: Tue, 18 May 2021 10:24:14 +0000	[thread overview]
Message-ID: <bug-26533-4717-xm9hG0UomA@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26533-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26533

--- Comment #11 from Tom de Vries <vries at gcc dot gnu.org> ---
I ported the test-case to the command line (hopefully, that'll be easier to
debug).

Using this python script to ignore errors:
...
$ cat ignore-errors.py 
class IgnoreErrorsCommand (gdb.Command):
    """Execute a single command, ignoring all errors.
Only one-line commands are supported.
This is primarily useful in scripts."""

    def __init__ (self):
        super (IgnoreErrorsCommand, self).__init__ ("ignore-errors",
                                                    gdb.COMMAND_OBSCURE,
                                                    # FIXME...
                                                    gdb.COMPLETE_COMMAND)

    def invoke (self, arg, from_tty):
        try:
            gdb.execute (arg, from_tty)
        except:
            pass

IgnoreErrorsCommand ()
...

and this command file:
...
$ cat cmd.gdb
source ignore-errors.py
set height 0
set width 0
dir
dir /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.guile
file
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.guile/scm-type/scm-type
guile (display "test\n")
delete breakpoints
info breakpoints
break -qualified main
run 
guile (define (print x) (format #t "= ~A" x) (newline))
guile (define (raw-print x) (format #t "= ~S" x) (newline))
guile (use-modules (gdb))
guile (use-modules (gdb iterator))
break 88
continue
guile (print (length (type-fields (value-type (parse-and-eval "ts")))))
print st
guile (define st (history-ref 0))
guile (define st-type (value-type st))
guile (define fields (type-fields st-type))
guile (print (length fields))
guile (print (field-name (car fields)))
guile (print (field-name (cadr fields)))
guile (print (field-name (type-field st-type "a")))
guile (print (type-has-field? st-type "b"))
guile (print (type-has-field? st-type "nosuch"))
guile (print (type-num-fields (value-type st)))
guile (define fi (make-field-iterator st-type))
guile (print (iterator-map field-bitpos fi))
ignore-errors guile (print (make-field-iterator (field-type (type-field st-type
"a"))))
print ar
guile (define ar (history-ref 0))
guile (define ar0 (value-subscript ar 0))
guile (print (value-cast ar0 (type-array (value-type ar0) 1)))
guile (print (value-cast ar0 (type-array (value-type ar0) 0 1)))
...

And this command line:
...
$ gdb -q -batch outputs/gdb.guile/scm-type/scm-type -x cmd.gdb
...

When run like so in conjunction with stress -c 5:
...
$ for n in $(seq 100); do gdb -q -batch outputs/gdb.guile/scm-type/scm-type -x
cmd.gdb; echo $?; done 2>&1 | tee LOG
...
I get:
...
$ grep wrong -i LOG
ERROR: In procedure gdbscm_type_array: Wrong type argument in position 1
(expecting gdb:type): #<finalized smob 22771c0>
ERROR: In procedure gdbscm_type_array: Wrong type argument in position 1
(expecting gdb:type): #<finalized smob 21db1b0>
ERROR: In procedure gdbscm_type_array: Wrong type argument in position 1
(expecting gdb:type): #<finalized smob 233b1c0>
ERROR: In procedure gdbscm_type_array: Wrong type argument in position 1
(expecting gdb:type): #<finalized smob 22801c0>
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-05-18 10:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 10:31 [Bug guile/26533] New: " vries at gcc dot gnu.org
2020-08-25 10:32 ` [Bug guile/26533] " vries at gcc dot gnu.org
2020-08-25 11:34 ` vries at gcc dot gnu.org
2020-08-25 11:41 ` vries at gcc dot gnu.org
2020-08-25 14:45 ` vries at gcc dot gnu.org
2020-08-25 14:48 ` vries at gcc dot gnu.org
2020-09-13 14:14 ` ludo at gnu dot org
2020-09-13 14:18 ` ludo at gnu dot org
2020-09-13 20:42 ` ludo at gnu dot org
2020-09-14  4:27 ` vries at gcc dot gnu.org
2020-09-14  6:11 ` vries at gcc dot gnu.org
2021-05-18 10:24 ` vries at gcc dot gnu.org [this message]
2021-05-18 10:26 ` vries at gcc dot gnu.org

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=bug-26533-4717-xm9hG0UomA@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).