This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, This is something I just noticed a few days ago in one of AdaCore's testcases that was similar to gdb.ada/int_deref.exp. Basically, we're trying to dereference an address, which is defined as a pointer to void. So, we do something a little ugly, and we convert the address to an integer first, because the Ada mode allows dereferencing of ints. The proper way, or course, would be use the curly-bracket notation, something like this: print {foo}my_variable'address which converts my_variable'address into a pointer to type "foo" (assuming that my_variable is of type "foo"). But that's not what the testcase is about. In any case, what we realized is that type "integer" is sometimes not large enough to hold the address. This happened for instance on Tru64 where the actual address for our global variable was greater than 2**32. As a result, we tried to dereference the wrong address, resulting in an error (cannot read memory). Fixed thusly (by using long_integer as opposed to integer). 2008-11-28 Joel Brobecker <brobecker@adacore.com> * gdb.ada/int_deref.exp: Convert the addresses into long_integer rather than integer, as integer might not be big enough when on 64bit targets. Tested on x86_64-linux. -- Joel
Attachment:
int_deref.exp.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |