This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[RFA:] [patch] Initialize disassemble_info member private_data indis-asm.h
- To: binutils at sourceware dot cygnus dot com
- Subject: [RFA:] [patch] Initialize disassemble_info member private_data indis-asm.h
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- Date: Sat, 16 Dec 2000 22:46:35 -0500 (EST)
Not initializing the private_data member in the initializer
macros seems like an oversight.
A disassemble-function has no way of knowing whether this is
initialized or not, in case it needs to initialize this member
and have it contain useful information that should live until the
next call, but not be re-initialized unnecessarily (like when
using dynamically allocated memory). Well perhaps it could
(ab)use the insn_info_valid member, but a caller seems free to
clobber this as it feels like it. See description of insn_info_valid
in dis-asm.h and a clobber in objdump.c:disassemble_bytes.
Ok to commit?
* dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Initialize
private_data member.
Index: dis-asm.h
===================================================================
RCS file: /cvs/src/src/include/dis-asm.h,v
retrieving revision 1.18
diff -p -c -r1.18 dis-asm.h
*** dis-asm.h 2000/09/29 18:07:47 1.18
--- dis-asm.h 2000/12/17 03:18:03
*************** extern int generic_symbol_at_address
*** 258,263 ****
--- 258,264 ----
(INFO).stream = (PTR)(STREAM), \
(INFO).symbols = NULL, \
(INFO).num_symbols = 0, \
+ (INFO).private_data = NULL, \
(INFO).buffer = NULL, \
(INFO).buffer_vma = 0, \
(INFO).buffer_length = 0, \
brgds, H-P