diff options
author | Tom de Vries <tdevries@suse.de> | 2024-07-24 16:32:35 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-07-24 16:32:35 +0200 |
commit | 75ece951b544fa1b530340cfa8a04bfb6f5bbaae (patch) | |
tree | bdca111e435039b44112c81cc03f5f3aa7c2428d /gdb/ppc-netbsd-tdep.c | |
parent | de272a5e905afb20ec0a2c192538acf9c9103974 (diff) | |
download | binutils-75ece951b544fa1b530340cfa8a04bfb6f5bbaae.zip binutils-75ece951b544fa1b530340cfa8a04bfb6f5bbaae.tar.gz binutils-75ece951b544fa1b530340cfa8a04bfb6f5bbaae.tar.bz2 |
[gdb/exp] Fix ptype $_creal/$_cimag
Consider test.c, compiled with -g:
...
__complex__ float cf = 1 + 2i;
int main (void) { return 0; }
...
The values of cf and its components are:
...
$ gdb -q a.out
Reading symbols from a.out...
(gdb) p cf
$1 = 1 + 2i
(gdb) p $_creal(cf)
$2 = 1
(gdb) p $_cimag(cf)
$3 = 2
...
and their respective types are:
...
(gdb) ptype $1
type = complex float
(gdb) ptype $2
type = float
(gdb) ptype $3
type = float
...
Now let's try that again, using ptype directly:
...
(gdb) ptype cf
type = complex float
(gdb) ptype $_creal(cf)
type = int
(gdb) ptype $_cimag(cf)
type = int
...
The last two types should have been float, not int.
Fix this by extending the internal function handlers creal_internal_fn and
cimag_internal_fn with the noside parameter, such that we get instead:
...
(gdb) ptype $_creal(cf)
type = float
(gdb) ptype $_cimag(cf)
type = float
...
Tested on x86_64-linux.
Reviewed-By: Keith Seitz <keiths@redhat.com>
PR exp/31816
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31816
Diffstat (limited to 'gdb/ppc-netbsd-tdep.c')
0 files changed, 0 insertions, 0 deletions