PR gdb/21164: maint print {symbols,msymbols,psymbols} without args crash
Commit Message
On Wednesday, February 15 2017, Pedro Alves wrote:
> On 02/15/2017 08:15 PM, Sergio Durigan Junior wrote:
>
>> This patch fixes that. OK to apply?
>
> Can you add some tests for this, please?
How about this?
Thanks
Comments
On 02/15/2017 10:54 PM, Sergio Durigan Junior wrote:
> On Wednesday, February 15 2017, Pedro Alves wrote:
>
>> On 02/15/2017 08:15 PM, Sergio Durigan Junior wrote:
>>
>>> This patch fixes that. OK to apply?
>>
>> Can you add some tests for this, please?
>
> How about this?
Awesome, thanks! OK with minor nits.
> commit acd6597d63b2501588318466cd308701d09a58f3
> Author: Sergio Durigan Junior <sergiodj@redhat.com>
> Date: Wed Feb 15 15:08:19 2017 -0500
> Hi,
...remove this above...
> This patch fixes that. OK to apply?
...and this "OK" from the commit log and...
> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
> index 2853508..b87cbfc 100644
> --- a/gdb/testsuite/gdb.base/maint.exp
> +++ b/gdb/testsuite/gdb.base/maint.exp
> @@ -561,6 +561,14 @@ gdb_expect {
>
> #set timeout $oldtimeout
>
> +# Testing that the commands work without an argument. For this test,
Write "Test that" here.
> +# we don't need an inferior loaded/running.
> +# See PR gdb/21164.
> +gdb_exit
> +gdb_start
> +gdb_test_no_output "maint print symbols"
> +gdb_test_no_output "maint print msymbols"
> +gdb_test_no_output "maint print psymbols"
Thanks,
Pedro Alves
On Wednesday, February 15 2017, Pedro Alves wrote:
> On 02/15/2017 10:54 PM, Sergio Durigan Junior wrote:
>> On Wednesday, February 15 2017, Pedro Alves wrote:
>>
>>> On 02/15/2017 08:15 PM, Sergio Durigan Junior wrote:
>>>
>>>> This patch fixes that. OK to apply?
>>>
>>> Can you add some tests for this, please?
>>
>> How about this?
>
> Awesome, thanks! OK with minor nits.
Thanks for the review. Pushed with all the minor nits fixed.
99e8a4f9f8832da0f37c6f35b11629b01897800d
>> commit acd6597d63b2501588318466cd308701d09a58f3
>> Author: Sergio Durigan Junior <sergiodj@redhat.com>
>> Date: Wed Feb 15 15:08:19 2017 -0500
>
>> Hi,
>
> ...remove this above...
>
>> This patch fixes that. OK to apply?
>
> ...and this "OK" from the commit log and...
>
>> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
>> index 2853508..b87cbfc 100644
>> --- a/gdb/testsuite/gdb.base/maint.exp
>> +++ b/gdb/testsuite/gdb.base/maint.exp
>> @@ -561,6 +561,14 @@ gdb_expect {
>>
>> #set timeout $oldtimeout
>>
>> +# Testing that the commands work without an argument. For this test,
>
> Write "Test that" here.
>
>> +# we don't need an inferior loaded/running.
>> +# See PR gdb/21164.
>> +gdb_exit
>> +gdb_start
>> +gdb_test_no_output "maint print symbols"
>> +gdb_test_no_output "maint print msymbols"
>> +gdb_test_no_output "maint print psymbols"
>
> Thanks,
> Pedro Alves
@@ -1926,7 +1926,7 @@ maintenance_print_psymbols (char *args, int from_tty)
argv = gdb_buildargv (args);
cleanups = make_cleanup_freeargv (argv);
- for (i = 0; argv[i] != NULL; ++i)
+ for (i = 0; argv != NULL && argv[i] != NULL; ++i)
{
if (strcmp (argv[i], "-pc") == 0)
{
@@ -1967,7 +1967,7 @@ maintenance_print_psymbols (char *args, int from_tty)
stdio_file arg_outfile;
- if (argv[outfile_idx] != NULL)
+ if (argv != NULL && argv[outfile_idx] != NULL)
{
char *outfile_name;
@@ -418,7 +418,7 @@ maintenance_print_symbols (char *args, int from_tty)
argv = gdb_buildargv (args);
cleanups = make_cleanup_freeargv (argv);
- for (i = 0; argv[i] != NULL; ++i)
+ for (i = 0; argv != NULL && argv[i] != NULL; ++i)
{
if (strcmp (argv[i], "-pc") == 0)
{
@@ -459,7 +459,7 @@ maintenance_print_symbols (char *args, int from_tty)
stdio_file arg_outfile;
- if (argv[outfile_idx] != NULL)
+ if (argv != NULL && argv[outfile_idx] != NULL)
{
char *outfile_name;
@@ -721,7 +721,7 @@ maintenance_print_msymbols (char *args, int from_tty)
argv = gdb_buildargv (args);
cleanups = make_cleanup_freeargv (argv);
- for (i = 0; argv[i] != NULL; ++i)
+ for (i = 0; argv != NULL && argv[i] != NULL; ++i)
{
if (strcmp (argv[i], "-objfile") == 0)
{
@@ -747,7 +747,7 @@ maintenance_print_msymbols (char *args, int from_tty)
stdio_file arg_outfile;
- if (argv[outfile_idx] != NULL)
+ if (argv != NULL && argv[outfile_idx] != NULL)
{
char *outfile_name;
@@ -561,6 +561,14 @@ gdb_expect {
#set timeout $oldtimeout
+# Testing that the commands work without an argument. For this test,
+# we don't need an inferior loaded/running.
+# See PR gdb/21164.
+gdb_exit
+gdb_start
+gdb_test_no_output "maint print symbols"
+gdb_test_no_output "maint print msymbols"
+gdb_test_no_output "maint print psymbols"
gdb_exit
return 0