mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 05:47:26 +08:00
gdb: const-ify unpack_* functions in remote.c
Const-ify the unpack_* functions, and then adjust the callers accordingly. gdb/ChangeLog: * remote.c (class remote_target) <remote_unpack_thread_info_response, parse_threadlist_response>: Constify parameter and/or return value and or local variable. (stub_unpack_int): Likewise. (unpack_nibble): Likewise. (unpack_byte): Likewise. (unpack_int): Likewise. (unpack_string): Likewise. (unpack_threadid): Likewise. (remote_target::remote_unpack_thread_info_response): Likewise. (remote_target::parse_threadlist_response): Likewise. Change-Id: Ibda75f664d6e3452df00f85af7134533049171b7
This commit is contained in:
@ -1,3 +1,18 @@
|
|||||||
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
|
* remote.c (class remote_target)
|
||||||
|
<remote_unpack_thread_info_response,
|
||||||
|
parse_threadlist_response>: Constify parameter and/or return
|
||||||
|
value and or local variable.
|
||||||
|
(stub_unpack_int): Likewise.
|
||||||
|
(unpack_nibble): Likewise.
|
||||||
|
(unpack_byte): Likewise.
|
||||||
|
(unpack_int): Likewise.
|
||||||
|
(unpack_string): Likewise.
|
||||||
|
(unpack_threadid): Likewise.
|
||||||
|
(remote_target::remote_unpack_thread_info_response): Likewise.
|
||||||
|
(remote_target::parse_threadlist_response): Likewise.
|
||||||
|
|
||||||
2021-01-15 Andrew Burgess <andrew.burgess@embecosm.com>
|
2021-01-15 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
* tui/tui.c (tui_is_window_visible): Compare to nullptr, not 0.
|
* tui/tui.c (tui_is_window_visible): Compare to nullptr, not 0.
|
||||||
|
49
gdb/remote.c
49
gdb/remote.c
@ -793,12 +793,12 @@ public: /* Remote specific methods. */
|
|||||||
|
|
||||||
char *write_ptid (char *buf, const char *endbuf, ptid_t ptid);
|
char *write_ptid (char *buf, const char *endbuf, ptid_t ptid);
|
||||||
|
|
||||||
int remote_unpack_thread_info_response (char *pkt, threadref *expectedref,
|
int remote_unpack_thread_info_response (const char *pkt, threadref *expectedref,
|
||||||
gdb_ext_thread_info *info);
|
gdb_ext_thread_info *info);
|
||||||
int remote_get_threadinfo (threadref *threadid, int fieldset,
|
int remote_get_threadinfo (threadref *threadid, int fieldset,
|
||||||
gdb_ext_thread_info *info);
|
gdb_ext_thread_info *info);
|
||||||
|
|
||||||
int parse_threadlist_response (char *pkt, int result_limit,
|
int parse_threadlist_response (const char *pkt, int result_limit,
|
||||||
threadref *original_echo,
|
threadref *original_echo,
|
||||||
threadref *resultlist,
|
threadref *resultlist,
|
||||||
int *doneflag);
|
int *doneflag);
|
||||||
@ -1017,7 +1017,7 @@ static CORE_ADDR remote_address_masked (CORE_ADDR);
|
|||||||
|
|
||||||
static void print_packet (const char *);
|
static void print_packet (const char *);
|
||||||
|
|
||||||
static int stub_unpack_int (char *buff, int fieldlength);
|
static int stub_unpack_int (const char *buff, int fieldlength);
|
||||||
|
|
||||||
struct packet_config;
|
struct packet_config;
|
||||||
|
|
||||||
@ -2999,19 +2999,19 @@ struct gdb_ext_thread_info
|
|||||||
|
|
||||||
#define BUF_THREAD_ID_SIZE (OPAQUETHREADBYTES * 2)
|
#define BUF_THREAD_ID_SIZE (OPAQUETHREADBYTES * 2)
|
||||||
|
|
||||||
static char *unpack_nibble (char *buf, int *val);
|
static const char *unpack_nibble (const char *buf, int *val);
|
||||||
|
|
||||||
static char *unpack_byte (char *buf, int *value);
|
static const char *unpack_byte (const char *buf, int *value);
|
||||||
|
|
||||||
static char *pack_int (char *buf, int value);
|
static char *pack_int (char *buf, int value);
|
||||||
|
|
||||||
static char *unpack_int (char *buf, int *value);
|
static const char *unpack_int (const char *buf, int *value);
|
||||||
|
|
||||||
static char *unpack_string (char *src, char *dest, int length);
|
static const char *unpack_string (const char *src, char *dest, int length);
|
||||||
|
|
||||||
static char *pack_threadid (char *pkt, threadref *id);
|
static char *pack_threadid (char *pkt, threadref *id);
|
||||||
|
|
||||||
static char *unpack_threadid (char *inbuf, threadref *id);
|
static const char *unpack_threadid (const char *inbuf, threadref *id);
|
||||||
|
|
||||||
void int_to_threadref (threadref *id, int value);
|
void int_to_threadref (threadref *id, int value);
|
||||||
|
|
||||||
@ -3121,7 +3121,7 @@ stubhex (int ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
stub_unpack_int (char *buff, int fieldlength)
|
stub_unpack_int (const char *buff, int fieldlength)
|
||||||
{
|
{
|
||||||
int nibble;
|
int nibble;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
@ -3137,15 +3137,15 @@ stub_unpack_int (char *buff, int fieldlength)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
unpack_nibble (char *buf, int *val)
|
unpack_nibble (const char *buf, int *val)
|
||||||
{
|
{
|
||||||
*val = fromhex (*buf++);
|
*val = fromhex (*buf++);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
unpack_byte (char *buf, int *value)
|
unpack_byte (const char *buf, int *value)
|
||||||
{
|
{
|
||||||
*value = stub_unpack_int (buf, 2);
|
*value = stub_unpack_int (buf, 2);
|
||||||
return buf + 2;
|
return buf + 2;
|
||||||
@ -3161,8 +3161,8 @@ pack_int (char *buf, int value)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
unpack_int (char *buf, int *value)
|
unpack_int (const char *buf, int *value)
|
||||||
{
|
{
|
||||||
*value = stub_unpack_int (buf, 8);
|
*value = stub_unpack_int (buf, 8);
|
||||||
return buf + 8;
|
return buf + 8;
|
||||||
@ -3192,8 +3192,8 @@ pack_string (char *pkt, char *string)
|
|||||||
}
|
}
|
||||||
#endif /* 0 (unused) */
|
#endif /* 0 (unused) */
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
unpack_string (char *src, char *dest, int length)
|
unpack_string (const char *src, char *dest, int length)
|
||||||
{
|
{
|
||||||
while (length--)
|
while (length--)
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
@ -3215,11 +3215,11 @@ pack_threadid (char *pkt, threadref *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
unpack_threadid (char *inbuf, threadref *id)
|
unpack_threadid (const char *inbuf, threadref *id)
|
||||||
{
|
{
|
||||||
char *altref;
|
char *altref;
|
||||||
char *limit = inbuf + BUF_THREAD_ID_SIZE;
|
const char *limit = inbuf + BUF_THREAD_ID_SIZE;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
altref = (char *) id;
|
altref = (char *) id;
|
||||||
@ -3334,7 +3334,7 @@ pack_threadinfo_request (char *pkt, int mode, threadref *id)
|
|||||||
the process. */
|
the process. */
|
||||||
|
|
||||||
int
|
int
|
||||||
remote_target::remote_unpack_thread_info_response (char *pkt,
|
remote_target::remote_unpack_thread_info_response (const char *pkt,
|
||||||
threadref *expectedref,
|
threadref *expectedref,
|
||||||
gdb_ext_thread_info *info)
|
gdb_ext_thread_info *info)
|
||||||
{
|
{
|
||||||
@ -3342,7 +3342,7 @@ remote_target::remote_unpack_thread_info_response (char *pkt,
|
|||||||
int mask, length;
|
int mask, length;
|
||||||
int tag;
|
int tag;
|
||||||
threadref ref;
|
threadref ref;
|
||||||
char *limit = pkt + rs->buf.size (); /* Plausible parsing limit. */
|
const char *limit = pkt + rs->buf.size (); /* Plausible parsing limit. */
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
|
|
||||||
/* info->threadid = 0; FIXME: implement zero_threadref. */
|
/* info->threadid = 0; FIXME: implement zero_threadref. */
|
||||||
@ -3465,18 +3465,17 @@ pack_threadlist_request (char *pkt, int startflag, int threadcount,
|
|||||||
/* Encoding: 'q':8,'M':8,count:16,done:8,argthreadid:64,(threadid:64)* */
|
/* Encoding: 'q':8,'M':8,count:16,done:8,argthreadid:64,(threadid:64)* */
|
||||||
|
|
||||||
int
|
int
|
||||||
remote_target::parse_threadlist_response (char *pkt, int result_limit,
|
remote_target::parse_threadlist_response (const char *pkt, int result_limit,
|
||||||
threadref *original_echo,
|
threadref *original_echo,
|
||||||
threadref *resultlist,
|
threadref *resultlist,
|
||||||
int *doneflag)
|
int *doneflag)
|
||||||
{
|
{
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
char *limit;
|
|
||||||
int count, resultcount, done;
|
int count, resultcount, done;
|
||||||
|
|
||||||
resultcount = 0;
|
resultcount = 0;
|
||||||
/* Assume the 'q' and 'M chars have been stripped. */
|
/* Assume the 'q' and 'M chars have been stripped. */
|
||||||
limit = pkt + (rs->buf.size () - BUF_THREAD_ID_SIZE);
|
const char *limit = pkt + (rs->buf.size () - BUF_THREAD_ID_SIZE);
|
||||||
/* done parse past here */
|
/* done parse past here */
|
||||||
pkt = unpack_byte (pkt, &count); /* count field */
|
pkt = unpack_byte (pkt, &count); /* count field */
|
||||||
pkt = unpack_nibble (pkt, &done);
|
pkt = unpack_nibble (pkt, &done);
|
||||||
|
Reference in New Issue
Block a user