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 1/3] Rename some trace functions


On 2016-12-02 11:47, Pedro Alves wrote:
Writing a patch.

I had started a patch as well, but was interrupted by a meeting, so I didn't get very far. Thanks for doing it!

Turns out I quoted the MI names, which are a bit different
from the RSP names.  Sigh...

Anyway, here's what it ends up looking like.  I changed
the text of the "request" stop reason, because I thought that
might be a tiny bit more user friendly for the case of the
user using an MI frontend who clicks some "trace stop" button
on the GUI instead of running a "command".

The new message "Trace stopped on user request" looks good to me.

+/* See tracepoint.h.  */
+
+const char *
+get_rsp_name (trace_stop_reason reason)
+{
+  return rsp_trace_stop_reason_names[(int) reason];

Should we prefer static_cast<int>() over (int)?

It might be a good idea to check that the resulting integer is smaller than the array size. If we ever add new stop reasons, we could forget to add array elements, so an error() here would catch it.

Otherwise, LGTM.


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