This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Clarify "list" output when specified lines are ambiguous


*** TEST RESULTS FOR COMMIT e439fa140afdaedb28a97acaa2b0432b884d8a91 ***

Author: Pedro Alves <palves@redhat.com>
Branch: master
Commit: e439fa140afdaedb28a97acaa2b0432b884d8a91

Clarify "list" output when specified lines are ambiguous

Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is
ambiguous, i.e., if it expands to multiple locations, you get this
seemingly odd output:

 (gdb) list foo,bar
 file: "file0.c", line number: 26
 file: "file1.c", line number: 29

Since "foo" above expands to multiple locations, the specified range
is indeterminate, and GDB is trying to be helpful by showing you what
was ambiguous.  It looks confusing to me, though.  I think it'd be
much more user friendly if GDB actually told you that, like this:

 (gdb) list foo,bar
 Specified first line 'foo' is ambiguous:
 file: "file0.c", line number: 26
 file: "file1.c", line number: 29

 (gdb) list bar,foo
 Specified last line 'foo' is ambiguous:
 file: "file0.c", line number: 26
 file: "file1.c", line number: 29

Note, I'm using "first" and "last" in the output because that's what
the manual uses:

 ~~~
 list first,last

     Print lines from first to last. [...]
 ~~~

Tested on x86-64 GNU/Linux.

gdb/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	* cli/cli-cmds.c (edit_command): Pass message to
	ambiguous_line_spec.
	(list_command): Pass message to ambiguous_line_spec.  Say
	"first"/"last" instead of "start" and "end" to be consistent with
	the manual.
	(ambiguous_line_spec): Add 'format' and vararg parameters.  Use
	them to print formatted message.

gdb/testsuite/ChangeLog:
2017-09-04  Pedro Alves  <palves@redhat.com>

	* gdb.base/list-ambiguous.exp: New file.
	* gdb.base/list-ambiguous0.c: New file.
	* gdb.base/list-ambiguous1.c: New file.
	* gdb.base/list.exp (test_list_range): Adjust expected output.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]