diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2016-01-28 10:28:56 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2016-01-28 10:28:56 -0500 |
commit | 8424cc978c8c76aca7945d50408762de65646095 (patch) | |
tree | 3525c71e308de0a6e4eab6ea409ac6fe67a5f94b /gdb/gdbserver/server.c | |
parent | 7fe8399de97e50f631ce28ceb42515862a927556 (diff) | |
download | gdb-8424cc978c8c76aca7945d50408762de65646095.zip gdb-8424cc978c8c76aca7945d50408762de65646095.tar.gz gdb-8424cc978c8c76aca7945d50408762de65646095.tar.bz2 |
Import strchrnul from gnulib and use it
For a forthcoming patch, I need a "skip_to_colon" function. I noticed
there are two skip_to_semicolon (one in gdb and one in gdbserver). I
thought we could put it in common/, and generalize it for any character.
It turns out that the strchrnul function does exactly that. I imported
the corresponding module from gnulib, for those systems that do not have
it.
There are probably more places where this function can be used instead
of doing the work by hand (I am looking at
remote-utils.c::look_up_one_symbol).
gdb/ChangeLog:
* remote.c (skip_to_semicolon): Remove.
(remote_parse_stop_reply): Use strchrnul instead of
skip_to_semicolon.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
strchrnul.
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Regenerate.
* gnulib/import/Makefile.in: Regenerate.
* gnulib/import/m4/gnulib-cache.m4: Regenerate.
* gnulib/import/m4/gnulib-comp.m4: Regenerate.
* gnulib/import/m4/rawmemchr.m4: New file.
* gnulib/import/m4/strchrnul.m4: New file.
* gnulib/import/rawmemchr.c: New file.
* gnulib/import/rawmemchr.valgrind: New file.
* gnulib/import/strchrnul.c: New file.
* gnulib/import/strchrnul.valgrind: New file.
gdb/gdbserver/ChangeLog:
* server.c (skip_to_semicolon): Remove.
(process_point_options): Use strchrnul instead of
skip_to_semicolon.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r-- | gdb/gdbserver/server.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 301dea9..ef715e7 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -3820,15 +3820,6 @@ main (int argc, char *argv[]) gdb_assert_not_reached ("captured_main should never return"); } -/* Skip PACKET until the next semi-colon (or end of string). */ - -static void -skip_to_semicolon (char **packet) -{ - while (**packet != '\0' && **packet != ';') - (*packet)++; -} - /* Process options coming from Z packets for a breakpoint. PACKET is the packet buffer. *PACKET is updated to point to the first char after the last processed option. */ @@ -3856,7 +3847,7 @@ process_point_options (struct breakpoint *bp, char **packet) if (debug_threads) debug_printf ("Found breakpoint condition.\n"); if (!add_breakpoint_condition (bp, &dataptr)) - skip_to_semicolon (&dataptr); + dataptr = strchrnul (dataptr, ';'); } else if (startswith (dataptr, "cmds:")) { @@ -3866,14 +3857,14 @@ process_point_options (struct breakpoint *bp, char **packet) persist = (*dataptr == '1'); dataptr += 2; if (add_breakpoint_commands (bp, &dataptr, persist)) - skip_to_semicolon (&dataptr); + dataptr = strchrnul (dataptr, ';'); } else { fprintf (stderr, "Unknown token %c, ignoring.\n", *dataptr); /* Skip tokens until we find one that we recognize. */ - skip_to_semicolon (&dataptr); + dataptr = strchrnul (dataptr, ';'); } } *packet = dataptr; |