This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: [patch, rfc] Give gdbarch an obstack part 1 of 2


Hello,

This patch adds an obstack to the per-architecture object. If per-architecture code needs to allocate extra per-architecture memory they can just grab it from the obstack knowing that, should the architecture ever be discarded then so too will the memory.

This eliminates the need to include a free method in per-architecture data, and makes memory management for this part of gdb more consistent with other parts (namely the symbol table).

I'll look to commit in a week, and then follow up with a patch to convert the clients to using the obstack-alloc instead of xmalloc.

I've checked this part in. Now for part 2.


Andrew


2003-07-15 Andrew Cagney <cagney@redhat.com>

	* gdbarch.c Include "gdb_obstack.h".
	(struct gdbarch): Add an "obstack".
	(alloc_gdbarch_data): Allocate the gdbarch data using
	GDBARCH_OBSTACK_CALLOC.
	(free_gdbarch_data): Delete function.
	(gdbarch_obstack_zalloc): New function.
	(gdbarch_free): Free the obstack, do not call free_gdbarch_data.
	Assert that the architecture is not initialized.
	(gdbarch_alloc): Allocate an obstack, allocate the architecture
	vector from the obstack.
	(alloc_gdbarch_data, init_gdbarch_swap): Allocate memory using the
	architecture obstack.
	(GDBARCH_OBSTACK_CALLOC, GDBARCH_OBSTACK_ZALLOC): Define.
	(set_gdbarch_data): Assert that the data is not initialized.
	(struct gdbarch_data): Delete member "free".
	(register_gdbarch_data): Do not initialize "free".
	* gdbarch.h, gdbarch.c: Re-generate.
	



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]