Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [RFA] Fix scm-ports.exp regression
Date: Tue, 09 Jan 2018 18:27:00 -0000	[thread overview]
Message-ID: <87efmykhw1.fsf@tromey.com> (raw)
In-Reply-To: <37ddb96c-2b32-2fcd-9c36-17f32d8701e3@redhat.com> (Pedro Alves's	message of "Fri, 5 Jan 2018 17:01:54 +0000")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> I think the simplest fix is to use "print/u" rather than "print/d" to
>> get the value of sp_reg in the test case.

Pedro> Can you expand a bit on this rationale, please?

Pedro> There's:
Pedro>  (parse-and-eval \"*(char*) \$sp\")
Pedro> in the context of the diff.  Is that related?  I ask because
Pedro> that "char" in there would look like something that could print
Pedro> as signed or unsigned depending on target.

I don't think that is related.  That expression has a dereference.

What happens is that on x86, this:

	set sp_reg [get_integer_valueof "\$sp" 0]

... ends up setting sp_reg to a negative value, because
get_integer_valueof uses "print/d":

    print /d $sp
    $1 = -11496

Then later the test suite does:

	gdb_test "guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))" \
	    "= $sp_reg" \
	    "seek to \$sp"

... expecting this value to be identical to the saved $sp_reg value.
However it gets:

    guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))
    = 4294955800

"print" is just a wrapper for guile's format:

    gdb_test_no_output "guile (define (print x) (format #t \"= ~A\" x) (newline))"

The seek function returns a scm_t_off, so I would think that this sort
of printing is handled by guile, not by gdb.

IIRC what happened is that "print/d" slightly changed in some cases
during the scalar printing work, and what we're seeing is the result.

Tom


  reply	other threads:[~2018-01-09 18:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 18:20 Tom Tromey
2018-01-05 17:01 ` Pedro Alves
2018-01-09 18:27   ` Tom Tromey [this message]
2018-01-15 16:51     ` Pedro Alves
2018-01-15 18:17       ` Tom Tromey
2018-01-15 20:59         ` Sergio Durigan Junior
2018-01-15 22:10           ` Tom Tromey
2018-01-16  7:39             ` Joel Brobecker
2018-01-05 17:59 Doug Evans via gdb-patches

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=87efmykhw1.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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