+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.
+
2017-09-29 Pedro Alves <palves@redhat.com>
* remote.c (target_buf, target_buf_size): Delete.
/* See rsp-low.h. */
-char *
-unpack_varlen_hex (char *buff, /* packet to parse */
+const char *
+unpack_varlen_hex (const char *buff, /* packet to parse */
ULONGEST *result)
{
int nibble;
in RESULT. Reads until a non-hex digit is seen. Returns a pointer
to the terminating character. */
-extern char *unpack_varlen_hex (char *buff, ULONGEST *result);
+extern const char *unpack_varlen_hex (const char *buff, ULONGEST *result);
/* HEX is a string of characters representing hexadecimal digits.
Convert pairs of hex digits to bytes and store sequentially into
+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.
+
2017-09-29 Pedro Alves <palves@redhat.com>
* proc-service.c (ps_pdread): Return PS_ERR if reading memory
of bytes in expression, a comma, and then the bytes. */
struct agent_expr *
-gdb_parse_agent_expr (char **actparm)
+gdb_parse_agent_expr (const char **actparm)
{
- char *act = *actparm;
+ const char *act = *actparm;
ULONGEST xlen;
struct agent_expr *aexpr;
/* The packet form of an agent expression consists of an 'X', number
of bytes in expression, a comma, and then the bytes. */
-struct agent_expr *gdb_parse_agent_expr (char **actparm);
+struct agent_expr *gdb_parse_agent_expr (const char **actparm);
/* Release an agent expression. */
void gdb_free_agent_expr (struct agent_expr *aexpr);
/* Add a target-side condition CONDITION to a breakpoint. */
int
-add_breakpoint_condition (struct gdb_breakpoint *bp, char **condition)
+add_breakpoint_condition (struct gdb_breakpoint *bp, const char **condition)
{
- char *actparm = *condition;
+ const char *actparm = *condition;
struct agent_expr *cond;
if (condition == NULL)
/* Add a target-side command COMMAND to the breakpoint at ADDR. */
int
-add_breakpoint_commands (struct gdb_breakpoint *bp, char **command,
+add_breakpoint_commands (struct gdb_breakpoint *bp, const char **command,
int persist)
{
- char *actparm = *command;
+ const char *actparm = *command;
struct agent_expr *cmd;
if (command == NULL)
Returns false on failure. On success, advances CONDITION pointer
past the condition and returns true. */
-int add_breakpoint_condition (struct gdb_breakpoint *bp, char **condition);
+int add_breakpoint_condition (struct gdb_breakpoint *bp,
+ const char **condition);
/* Set target-side commands COMMANDS to the breakpoint at ADDR.
Returns false on failure. On success, advances COMMANDS past the
commands and returns true. If PERSIST, the commands should run
even while GDB is disconnected. */
-int add_breakpoint_commands (struct gdb_breakpoint *bp, char **commands,
+int add_breakpoint_commands (struct gdb_breakpoint *bp, const char **commands,
int persist);
int any_persistent_commands (void);
}
static ULONGEST
-hex_or_minus_one (char *buf, char **obuf)
+hex_or_minus_one (const char *buf, const char **obuf)
{
ULONGEST ret;
/* 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. */
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')
#define STDIO_CONNECTION_NAME "stdio"
int remote_connection_is_stdio (void);
-ptid_t read_ptid (char *buf, char **obuf);
+ptid_t read_ptid (const char *buf, const char **obuf);
char *write_ptid (char *buf, ptid_t ptid);
int putpkt (char *buf);
/* Handle qXfer:exec-file:read. */
static int
-handle_qxfer_exec_file (const char *const_annex,
+handle_qxfer_exec_file (const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, LONGEST len)
{
if (the_target->pid_to_exec_file == NULL || writebuf != NULL)
return -2;
- if (const_annex[0] == '\0')
+ if (annex[0] == '\0')
{
if (current_thread == NULL)
return -1;
}
else
{
- char *annex = (char *) alloca (strlen (const_annex) + 1);
-
- strcpy (annex, const_annex);
annex = unpack_varlen_hex (annex, &pid);
-
if (annex[0] != '\0')
return -1;
}
if (the_target->get_tib_address != NULL
&& startswith (own_buf, "qGetTIBAddr:"))
{
- char *annex;
+ const char *annex;
int n;
CORE_ADDR tlb;
ptid_t ptid = read_ptid (own_buf + 12, &annex);
if (startswith (own_buf, "qCRC:"))
{
/* CRC check (compare-section). */
- char *comma;
+ const char *comma;
ULONGEST base;
int len;
unsigned long long crc;
static void
handle_v_cont (char *own_buf)
{
- char *p, *q;
+ const char *p;
int n = 0, i = 0;
struct thread_resume *resume_info;
struct thread_resume default_action { null_ptid };
if (p[0] == 'S' || p[0] == 'C')
{
- int sig;
- sig = strtol (p + 1, &q, 16);
+ char *q;
+ int sig = strtol (p + 1, &q, 16);
if (p == q)
goto err;
p = q;
}
else if (p[0] == ':')
{
+ const char *q;
ptid_t ptid = read_ptid (p + 1, &q);
if (p == q)
after the last processed option. */
static void
-process_point_options (struct gdb_breakpoint *bp, char **packet)
+process_point_options (struct gdb_breakpoint *bp, const char **packet)
{
- char *dataptr = *packet;
+ const char *dataptr = *packet;
int persist;
/* Check if data has the correct format. */
char type = own_buf[1];
int res;
const int insert = ch == 'Z';
- char *p = &own_buf[3];
+ const char *p = &own_buf[3];
p = unpack_varlen_hex (p, &addr);
kind = strtol (p + 1, &dataptr, 16);
is telling us to drop that list and use this one
instead. */
clear_breakpoint_conditions_and_commands (bp);
- process_point_options (bp, &dataptr);
+ const char *options = dataptr;
+ process_point_options (bp, &options);
}
}
else
/* Append another action to perform when the tracepoint triggers. */
static void
-add_tracepoint_action (struct tracepoint *tpoint, char *packet)
+add_tracepoint_action (struct tracepoint *tpoint, const char *packet)
{
- char *act;
+ const char *act;
if (*packet == 'S')
{
while (*act)
{
- char *act_start = act;
+ const char *act_start = act;
struct tracepoint_action *action = NULL;
switch (*act)
ULONGEST addr;
ULONGEST count;
struct tracepoint *tpoint;
- char *actparm;
- char *packet = own_buf;
+ const char *packet = own_buf;
packet += strlen ("QTDP:");
}
else if (*packet == 'X')
{
- actparm = (char *) packet;
- tpoint->cond = gdb_parse_agent_expr (&actparm);
- packet = actparm;
+ tpoint->cond = gdb_parse_agent_expr (&packet);
}
else if (*packet == '-')
break;
{
ULONGEST num, addr, start, slen;
struct tracepoint *tpoint;
- char *packet = own_buf;
- char *saved, *srctype, *src;
+ const char *packet = own_buf;
+ const char *saved;
+ char *srctype, *src;
size_t nbytes;
struct source_string *last, *newlast;
char *varname;
size_t nbytes;
struct trace_state_variable *tsv;
- char *packet = own_buf;
+ const char *packet = own_buf;
packet += strlen ("QTDV:");
static void
cmd_qtenable_disable (char *own_buf, int enable)
{
- char *packet = own_buf;
+ const char *packet = own_buf;
ULONGEST num, addr;
struct tracepoint *tp;
{
ULONGEST start, end;
struct readonly_region *roreg;
- char *packet = own_buf;
+ const char *packet = own_buf;
trace_debug ("Want to mark readonly regions");
ULONGEST frame, pc, lo, hi, num;
int tfnum, tpnum;
struct traceframe *tframe;
- char *packet = own_buf;
+ const char *packet = own_buf;
packet += strlen ("QTFrame:");
{
ULONGEST num, addr;
struct tracepoint *tpoint;
- char *packet = own_buf;
+ const char *packet = own_buf;
packet += strlen ("qTP:");
{
ULONGEST offset, num, tot;
unsigned char *tbp;
- char *packet = own_buf;
+ const char *packet = own_buf;
packet += strlen ("qTBuffer:");
int pid = ptid_get_pid (inferior_ptid);
VEC(static_tracepoint_marker_p) *markers = NULL;
struct static_tracepoint_marker *marker = NULL;
- char *p = s;
+ const char *p = s;
ptid_t ptid = ptid_build (pid, 0, 0);
/* Pause all */
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);
{
ULONGEST ul;
CORE_ADDR from, to, org_to;
- char *p, *pp;
+ const char *p, *pp;
int adjusted_size = 0;
int relocated = 0;
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')
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);
if (rs->use_threadinfo_query)
{
- char *bufp;
+ const char *bufp;
putpkt ("qfThreadInfo");
getpkt (&rs->buf, &rs->buf_size, 0);
if (*p++ == 'm')
{
- parse_static_tracepoint_marker_definition (p, &p, marker);
+ parse_static_tracepoint_marker_definition (p, NULL, marker);
return 1;
}
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. */
{
if (stop_reply[0] == 'T' && strlen (stop_reply) > 3)
{
- char *p;
+ const char *p;
/* Txx r:val ; r:val (...) */
p = &stop_reply[3];
/* Look for "register" named "thread". */
while (*p != '\0')
{
- char *p1;
+ const char *p1;
p1 = strchr (p, ':');
if (p1 == NULL)
{
struct remote_arch_state *rsa = get_remote_arch_state ();
ULONGEST addr;
- char *p;
+ const char *p;
int skipregs = 0;
event->ptid = null_ptid;
p = &buf[3]; /* after Txx */
while (*p)
{
- char *p1;
+ const char *p1;
int fieldsize;
p1 = strchr (p, ':');
else
{
ULONGEST pnum;
- char *p_temp;
+ const char *p_temp;
if (skipregs)
{
break;
case 'w': /* Thread exited. */
{
- char *p;
+ const char *p;
ULONGEST value;
event->ws.kind = TARGET_WAITKIND_THREAD_EXITED;
case 'W': /* Target exited. */
case 'X':
{
- char *p;
+ const char *p;
int pid;
ULONGEST value;
the remote protocol and the trace file reader. */
void
-parse_trace_status (char *line, struct trace_status *ts)
+parse_trace_status (const char *line, struct trace_status *ts)
{
- char *p = line, *p1, *p2, *p3, *p_temp;
+ const char *p = line, *p1, *p2, *p3, *p_temp;
int end;
ULONGEST val;
}
void
-parse_tracepoint_status (char *p, struct breakpoint *bp,
+parse_tracepoint_status (const char *p, struct breakpoint *bp,
struct uploaded_tp *utp)
{
ULONGEST uval;
an "uploaded tracepoint". */
void
-parse_tracepoint_definition (char *line, struct uploaded_tp **utpp)
+parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp)
{
- char *p;
+ const char *p;
char piece;
ULONGEST num, addr, step, pass, orig_size, xlen, start;
int enabled, end;
enum bptype type;
- char *cond, *srctype, *buf;
+ const char *srctype;
+ char *cond, *buf;
struct uploaded_tp *utp = NULL;
p = line;
uploaded object. */
void
-parse_tsv_definition (char *line, struct uploaded_tsv **utsvp)
+parse_tsv_definition (const char *line, struct uploaded_tsv **utsvp)
{
- char *p, *buf;
+ const char *p;
+ char *buf;
ULONGEST num, initval, builtin;
int end;
struct uploaded_tsv *utsv = NULL;
the parsed marker definition. */
void
-parse_static_tracepoint_marker_definition (char *line, char **pp,
+parse_static_tracepoint_marker_definition (const char *line, const char **pp,
struct static_tracepoint_marker *marker)
{
- char *p, *endp;
+ const char *p, *endp;
ULONGEST addr;
int end;
};
extern void parse_static_tracepoint_marker_definition
- (char *line, char **pp,
+ (const char *line, const char **pp,
struct static_tracepoint_marker *marker);
extern void release_static_tracepoint_marker (struct static_tracepoint_marker *);
extern void free_current_marker (void *arg);
const char *srctype, const char *src,
char *buf, int buf_size);
-extern void parse_trace_status (char *line, struct trace_status *ts);
+extern void parse_trace_status (const char *line, struct trace_status *ts);
-extern void parse_tracepoint_status (char *p, struct breakpoint *tp,
+extern void parse_tracepoint_status (const char *p, struct breakpoint *tp,
struct uploaded_tp *utp);
-extern void parse_tracepoint_definition (char *line,
+extern void parse_tracepoint_definition (const char *line,
struct uploaded_tp **utpp);
-extern void parse_tsv_definition (char *line, struct uploaded_tsv **utsvp);
+extern void parse_tsv_definition (const char *line, struct uploaded_tsv **utsvp);
extern struct uploaded_tp *get_uploaded_tp (int num, ULONGEST addr,
struct uploaded_tp **utpp);