qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Doug Gale <doug16k@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] gdbstub: add tracing
Date: Fri, 1 Dec 2017 11:02:31 +0000	[thread overview]
Message-ID: <20171201110231.GJ23501@stefanha-x1.localdomain> (raw)
In-Reply-To: <20171127042815.30725-1-doug16k@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2092 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

      reply	other threads:[~2017-12-01 16:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27  4:28 [Qemu-devel] [PATCH v3] gdbstub: add tracing Doug Gale
2017-12-01 11:02 ` Stefan Hajnoczi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171201110231.GJ23501@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=doug16k@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).