[PATCH v2 12/24] Introduce generic command options framework
Pedro Alves
palves@redhat.com
Tue Jun 4 21:37:00 GMT 2019
On 6/3/19 8:16 PM, Tom Tromey wrote:
>
> Pedro> + if (len > 0 && strncmp ("unlimited", *arg, len) == 0)
>
> I should have mentioned this in an earlier patch, but won't this also
> match things like "unlimitedjunk"?
It won't -- the code reads:
static int
is_unlimited_literal (const char *arg)
{
arg = skip_spaces (arg);
const char *p = skip_to_space (arg);
size_t len = p - arg;
if (len > 0 && strncmp ("unlimited", arg, len) == 0)
return true;
return false;
}
So for "unlimitedjunk", LEN will be 13, which is longer than
strlen ("unlimited"), so the strncmp returns != 0.
Thanks for bringing this up -- I missed adding a test for that
case. I'm adding the below to the new settings.exp testcase.
Also, while writing the test I realized that we don't error
out with:
(gdb) maint test-settings set uinteger unlimited junk
I wrote a follow up patch on top of the series to fix that.
Thanks,
Pedro Alves
diff --git c/gdb/testsuite/gdb.base/settings.exp w/gdb/testsuite/gdb.base/settings.exp
index 36c80086a3d..c62957181e2 100644
--- c/gdb/testsuite/gdb.base/settings.exp
+++ w/gdb/testsuite/gdb.base/settings.exp
@@ -141,7 +141,10 @@ proc test-integer {variant} {
"$set_cmd unlimited"
}
+ gdb_test "$set_cmd unlimitedu" "No symbol table is loaded.*"
+
test_gdb_complete_none "$set_cmd unlimited "
+ test_gdb_complete_none "$set_cmd unlimitedu"
More information about the Gdb-patches
mailing list