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]

Re: [Patch, microblaze]: Communicate in larger blocks with the target.


>>>>> "Ajit" == Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com> writes:

Ajit> +  insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long)); 
Ajit> +  buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte)); 

Just for future reference -- since from other reviews it looks like the
patch will need bigger updates -- gdb doesn't use "calloc".  Instead it
uses wrapper around the standard allocation functions, e.g.,
xcalloc... though if one is allocating typed arrays then I think the
wrapper macros like XNEWVEC (see include/libiberty.h) are to be
preferred, as they are more type-safe.

Ajit> +  free(insn_block); 
Ajit> +  free(buf_block); 

Likewise gdb uses xfree.  Though in most cases one must use cleanups
instead, to be exception-safe.  I didn't look to see whether that was
the case for your patch.

Tom


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