This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [Patch, microblaze]: Communicate in larger blocks with the target.
- From: Tom Tromey <tromey at redhat dot com>
- To: Ajit Kumar Agarwal <ajit dot kumar dot agarwal at xilinx dot com>
- Cc: "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>, Michael Eager <eager at eagercon dot com>, Vinod Kathail <vinodk at xilinx dot com>, Vidhumouli Hunsigida <vidhum at xilinx dot com>, Nagaraju Mekala <nmekala at xilinx dot com>
- Date: Tue, 17 Jun 2014 10:30:37 -0600
- Subject: Re: [Patch, microblaze]: Communicate in larger blocks with the target.
- Authentication-results: sourceware.org; auth=none
- References: <41df2189-0a72-4543-ba31-297f81e663d7 at BN1AFFO11FD025 dot protection dot gbl>
>>>>> "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