* [patch, testsuite] store memory address in unsigned type
@ 2011-05-13 11:07 Yao Qi
2011-05-13 15:46 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2011-05-13 11:07 UTC (permalink / raw)
To: gdb-patches
[-- 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-14 6:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-13 11:07 [patch, testsuite] store memory address in unsigned type Yao Qi
2011-05-13 15:46 ` Tom Tromey
2011-05-14 6:07 ` [committed] " Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox