diff options
author | Pedro Alves <palves@redhat.com> | 2017-09-29 17:15:36 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-09-29 17:15:36 +0100 |
commit | 256642e857886f1e3da86ce2484f9df5a5a6b904 (patch) | |
tree | 80086d69d81e32f997070c0ca6700a7c38f94b27 /gdb/remote.c | |
parent | b6bb34680b9c99961b6cd635853552ec6569a2a4 (diff) | |
download | gdb-256642e857886f1e3da86ce2484f9df5a5a6b904.zip gdb-256642e857886f1e3da86ce2484f9df5a5a6b904.tar.gz gdb-256642e857886f1e3da86ce2484f9df5a5a6b904.tar.bz2 |
Constify unpack_varlen_hex & fix fallout
I ran into non-const unpack_varlen_hex while working on something
else, and decided to just fix it first. Ends up constifying a good
deal of remote packet parsing.
gdb/ChangeLog:
2017-09-29 Pedro Alves <palves@redhat.com>
* common/rsp-low.c (unpack_varlen_hex): Constify.
* common/rsp-low.h (unpack_varlen_hex): Constify.
* linux-nat.c (linux_child_static_tracepoint_markers_by_strid):
Constify.
* remote.c (remote_set_permissions, read_ptid)
(remote_current_thread, remote_get_threads_with_qthreadinfo)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(stop_reply_extract_thread, remote_parse_stop_reply): Constify.
* tracepoint.c (parse_trace_status, parse_tracepoint_status)
(parse_tracepoint_definition, parse_tsv_definition)
(parse_static_tracepoint_marker_definition): Constify.
* tracepoint.h (parse_static_tracepoint_marker_definition)
(parse_trace_status, parse_tracepoint_status)
(parse_tracepoint_definition, parse_tsv_definition): Constify.
gdb/gdbserver/ChangeLog:
2017-09-29 Pedro Alves <palves@redhat.com>
* ax.c (gdb_parse_agent_expr): Constify.
* ax.h (gdb_parse_agent_expr): Constify.
* mem-break.c (add_breakpoint_condition, add_breakpoint_commands):
Constify.
* mem-break.h (add_breakpoint_condition, add_breakpoint_commands): Constify.
* remote-utils.c (hex_or_minus_one, read_ptid): Constify.
* remote-utils.h (read_ptid): Constify.
* server.c (handle_qxfer_exec_file, handle_query, handle_v_cont)
(process_point_options, process_serial_event): Constify.
* tracepoint.c (add_tracepoint_action, cmd_qtdp, cmd_qtdpsrc)
(cmd_qtdv, cmd_qtenable_disable, cmd_qtro, cmd_qtframe, cmd_qtp)
(cmd_qtbuffer): Constify.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index a0c6f6c..54d810f 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -185,7 +185,7 @@ static void show_remote_protocol_packet_cmd (struct ui_file *file, const char *value); static char *write_ptid (char *buf, const char *endbuf, ptid_t ptid); -static ptid_t read_ptid (char *buf, char **obuf); +static ptid_t read_ptid (const char *buf, const char **obuf); static void remote_set_permissions (struct target_ops *self); @@ -592,7 +592,7 @@ remote_get_noisy_reply () { ULONGEST ul; CORE_ADDR from, to, org_to; - char *p, *pp; + const char *p, *pp; int adjusted_size = 0; int relocated = 0; @@ -2445,14 +2445,15 @@ write_ptid (char *buf, const char *endbuf, ptid_t ptid) return buf; } -/* Extract a PTID from BUF. If non-null, OBUF is set to the to one - passed the last parsed char. Returns null_ptid on error. */ +/* Extract a PTID from BUF. If non-null, OBUF is set to one past the + last parsed char. Returns null_ptid if no thread id is found, and + throws an error if the thread id has an invalid format. */ static ptid_t -read_ptid (char *buf, char **obuf) +read_ptid (const char *buf, const char **obuf) { - char *p = buf; - char *pp; + const char *p = buf; + const char *pp; ULONGEST pid = 0, tid = 0; if (*p == 'p') @@ -3088,7 +3089,7 @@ remote_current_thread (ptid_t oldpid) getpkt (&rs->buf, &rs->buf_size, 0); if (rs->buf[0] == 'Q' && rs->buf[1] == 'C') { - char *obuf; + const char *obuf; ptid_t result; result = read_ptid (&rs->buf[2], &obuf); @@ -3232,7 +3233,7 @@ remote_get_threads_with_qthreadinfo (struct target_ops *ops, if (rs->use_threadinfo_query) { - char *bufp; + const char *bufp; putpkt ("qfThreadInfo"); getpkt (&rs->buf, &rs->buf_size, 0); @@ -3482,7 +3483,7 @@ remote_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR addr, if (*p++ == 'm') { - parse_static_tracepoint_marker_definition (p, &p, marker); + parse_static_tracepoint_marker_definition (p, NULL, marker); return 1; } @@ -3497,7 +3498,7 @@ remote_static_tracepoint_markers_by_strid (struct target_ops *self, VEC(static_tracepoint_marker_p) *markers = NULL; struct static_tracepoint_marker *marker = NULL; struct cleanup *old_chain; - char *p; + const char *p; /* Ask for a first packet of static tracepoint marker definition. */ @@ -3790,7 +3791,7 @@ stop_reply_extract_thread (char *stop_reply) { if (stop_reply[0] == 'T' && strlen (stop_reply) > 3) { - char *p; + const char *p; /* Txx r:val ; r:val (...) */ p = &stop_reply[3]; @@ -3798,7 +3799,7 @@ stop_reply_extract_thread (char *stop_reply) /* Look for "register" named "thread". */ while (*p != '\0') { - char *p1; + const char *p1; p1 = strchr (p, ':'); if (p1 == NULL) @@ -6836,7 +6837,7 @@ remote_parse_stop_reply (char *buf, struct stop_reply *event) { struct remote_arch_state *rsa = get_remote_arch_state (); ULONGEST addr; - char *p; + const char *p; int skipregs = 0; event->ptid = null_ptid; @@ -6860,7 +6861,7 @@ remote_parse_stop_reply (char *buf, struct stop_reply *event) p = &buf[3]; /* after Txx */ while (*p) { - char *p1; + const char *p1; int fieldsize; p1 = strchr (p, ':'); @@ -6998,7 +6999,7 @@ Packet: '%s'\n"), else { ULONGEST pnum; - char *p_temp; + const char *p_temp; if (skipregs) { @@ -7068,7 +7069,7 @@ Packet: '%s'\n"), break; case 'w': /* Thread exited. */ { - char *p; + const char *p; ULONGEST value; event->ws.kind = TARGET_WAITKIND_THREAD_EXITED; @@ -7082,7 +7083,7 @@ Packet: '%s'\n"), case 'W': /* Target exited. */ case 'X': { - char *p; + const char *p; int pid; ULONGEST value; |