diff options
author | Ian Lance Taylor <ian@airs.com> | 1998-06-12 15:13:28 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1998-06-12 15:13:28 +0000 |
commit | 80ade9931a73bf205ca878f323d3ce3d25653811 (patch) | |
tree | e055987b0f211a379ca24b0ba435118fbcd72d13 /opcodes | |
parent | 1be932424c84bcfa54e1906c2a2dd50c702bb94e (diff) | |
download | gdb-80ade9931a73bf205ca878f323d3ce3d25653811.zip gdb-80ade9931a73bf205ca878f323d3ce3d25653811.tar.gz gdb-80ade9931a73bf205ca878f323d3ce3d25653811.tar.bz2 |
Fri Jun 12 11:04:06 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Fix problems when bfd_vma is wider than long.
* i386-dis.c: Make op_address and start_pc unsigned.
(set_op): Make parameter unsigned.
(print_insn_x86): Cast to bfd_vma when passing a value to
print_address_func.
* ns32k-dis.c (CORE_ADDR): Don't define.
(print_insn_ns32k): Change type of addr to bfd_vma. Use
bfd_scan_vma to read back address.
(print_insn_arg): Change type of addr to bfd_vma. Use sprintf_vma
to format it.
* m68k-dis.c (COERCE32): Cast to bfd_signed_vma to avoid overflow.
(NEXTULONG): New definition.
(print_insn_m68k): Avoid overflow when computing third argument of
print_insn_arg.
(print_insn_arg): Use NEXTULONG to fetch 32 bit address values.
Use disp instead of val to store offset values.
(print_indexed): Use base_disp instead of word to store base
displacement, to avoid overflow.
* m10300-dis.c (disassemble): Cast value to long when computing
pc-relative address, to get correct sign extension.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 23 | ||||
-rw-r--r-- | opcodes/i386-dis.c | 15 |
2 files changed, 31 insertions, 7 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index a668a1a..37ce3a9 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,26 @@ +Fri Jun 12 11:04:06 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + Fix problems when bfd_vma is wider than long. + * i386-dis.c: Make op_address and start_pc unsigned. + (set_op): Make parameter unsigned. + (print_insn_x86): Cast to bfd_vma when passing a value to + print_address_func. + * ns32k-dis.c (CORE_ADDR): Don't define. + (print_insn_ns32k): Change type of addr to bfd_vma. Use + bfd_scan_vma to read back address. + (print_insn_arg): Change type of addr to bfd_vma. Use sprintf_vma + to format it. + * m68k-dis.c (COERCE32): Cast to bfd_signed_vma to avoid overflow. + (NEXTULONG): New definition. + (print_insn_m68k): Avoid overflow when computing third argument of + print_insn_arg. + (print_insn_arg): Use NEXTULONG to fetch 32 bit address values. + Use disp instead of val to store offset values. + (print_indexed): Use base_disp instead of word to store base + displacement, to avoid overflow. + * m10300-dis.c (disassemble): Cast value to long when computing + pc-relative address, to get correct sign extension. + Wed Jun 10 15:58:37 1998 Doug Evans <devans@canuck.cygnus.com> * m32r-opc.c: Regenerate. diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 15c08d8..64aacdf 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -189,7 +189,7 @@ static void OP_EM PARAMS ((int, int)); static void OP_MS PARAMS ((int, int)); static void append_seg PARAMS ((void)); -static void set_op PARAMS ((int op)); +static void set_op PARAMS ((unsigned int op)); static void putop PARAMS ((char *template, int sizeflag)); static void dofloat PARAMS ((int sizeflag)); static int get16 PARAMS ((void)); @@ -1146,8 +1146,9 @@ ckprefix () } static char op1out[100], op2out[100], op3out[100]; -static int op_address[3], op_ad, op_index[3]; -static int start_pc; +static int op_ad, op_index[3]; +static unsigned int op_address[3]; +static unsigned int start_pc; /* @@ -1326,7 +1327,7 @@ print_insn_x86 (pc, info, sizeflag) if (*first) { if (op_index[0] != -1) - (*info->print_address_func) (op_address[op_index[0]], info); + (*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info); else (*info->fprintf_func) (info->stream, "%s", first); needcomma = 1; @@ -1336,7 +1337,7 @@ print_insn_x86 (pc, info, sizeflag) if (needcomma) (*info->fprintf_func) (info->stream, ","); if (op_index[1] != -1) - (*info->print_address_func) (op_address[op_index[1]], info); + (*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info); else (*info->fprintf_func) (info->stream, "%s", second); needcomma = 1; @@ -1346,7 +1347,7 @@ print_insn_x86 (pc, info, sizeflag) if (needcomma) (*info->fprintf_func) (info->stream, ","); if (op_index[2] != -1) - (*info->print_address_func) (op_address[op_index[2]], info); + (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info); else (*info->fprintf_func) (info->stream, "%s", third); } @@ -1929,7 +1930,7 @@ get16 () static void set_op (op) - int op; + unsigned int op; { op_index[op_ad] = op_ad; op_address[op_ad] = op; |