From: Yao Qi <yao@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [patch, testsuite] store memory address in unsigned type
Date: Fri, 13 May 2011 11:07:00 -0000 [thread overview]
Message-ID: <4DCD10CC.6030801@codesourcery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
In gdb.trace/tfile.c:add_memory_block(), we store memory address in
long, and assign (extend) to long long. It is not correct if the MSB of
address is 1, and signed extension will fill the upper 32-bit of long
long with 1, which is not what we want here.
This patch is to use unsigned type. OK?
--
Yao (é½å°§)
[-- Attachment #2: unsigned_address.patch --]
[-- Type: text/x-patch, Size: 803 bytes --]
gdb/testsuite/
2011-05-13 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.c (add_memory_block): Store address in unsigned
type.
Index: testsuite/gdb.trace/tfile.c
===================================================================
--- testsuite/gdb.trace/tfile.c (revision 325446)
+++ testsuite/gdb.trace/tfile.c (working copy)
@@ -49,13 +49,13 @@
add_memory_block (char *addr, int size)
{
short short_x;
- long long ll_x;
+ unsigned long long ll_x;
*((char *) trptr) = 'M';
trptr += 1;
- ll_x = (long) addr;
- memcpy (trptr, &ll_x, sizeof (long long));
- trptr += sizeof (long long);
+ ll_x = (unsigned long) addr;
+ memcpy (trptr, &ll_x, sizeof (unsigned long long));
+ trptr += sizeof (unsigned long long);
short_x = size;
memcpy (trptr, &short_x, 2);
trptr += 2;
next reply other threads:[~2011-05-13 11:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-13 11:07 Yao Qi [this message]
2011-05-13 15:46 ` Tom Tromey
2011-05-14 6:07 ` [committed] " Yao Qi
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=4DCD10CC.6030801@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@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