On Sun, Nov 26, 2017 at 11:28:15PM -0500, Doug Gale wrote: > -static int put_packet_binary(GDBState *s, const char *buf, int len) > +static int put_packet_binary(GDBState *s, const char *buf, int len, bool > dump) > { > int csum, i; > uint8_t *p; > > + if (TRACE_GDBSTUB_IO_BINARYREPLY_ENABLED && dump)
TRACE_GDBSTUB_IO_BINARYREPLY_ENABLED is a compile-time constant. To avoid the overhead when the trace event is compiled in but disabled at runtime, use: if (trace_event_get_state_backends(TRACE_GDBSTUB_IO_BINARYREPLY) && dump) > + hexdump(buf, len, trace_gdbstub_io_binaryreply); Please run scripts/checkpatch.pl before sending patches. I find it easiest to use a git hook that automatically scans commits that I make: http://blog.vmsplice.net/2011/03/how-to-automatically-run-checkpatchpl.html QEMU coding style always uses curly braces even when the if statement body is only one line: if (TRACE_GDBSTUB_IO_BINARYREPLY_ENABLED && dump) { hexdump(buf, len, trace_gdbstub_io_binaryreply); } > +# gdbstub.c > +gdbstub_op_start(char const *device) "Starting gdbstub using device %s" > +gdbstub_op_exiting(uint8_t code) "notifying exit with code=0x%02x" > +gdbstub_op_hit_watchpoint(char const *type, int cpu_gdb_index, uint64_t > vaddr) "Watchpoint hit, type=\"%s\" cpu=%d, vaddr=0x%" PRIx64 "" > +gdbstub_op_hit_internal_error(void) "RUN_STATE_INTERNAL_ERROR" > +gdbstub_op_hit_shutdown(void) "RUN_STATE_SHUTDOWN" > +gdbstub_op_hit_unknown(int state) "Unknown run state=0x%x" > +gdbstub_op_extra_info(char const *info) "Thread extra info: %s" > +gdbstub_io_reply(char const *message) "Sent: %s" > +gdbstub_io_binaryreply(size_t ofs, char const *line) "0x%04zx: %s" > +gdbstub_io_command(char const *command) "Received: %s" > +gdbstub_err_got_nack(void) "Got NACK, retransmitting" > +gdbstub_io_got_ack(void) "Got ACK" > +gdbstub_io_got_unexpected(char ch) "Got '%c' when expecting ACK/NACK" Please use 0x%02x instead of %c to prevent misleading/corrupt output when the input contains control characters.
signature.asc
Description: PGP signature