This is the mail archive of the gdb-patches@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]

Re: [PATCH v4] Make '{add-,}symbol-file' not care about the position of command line arguments


On Friday, December 01 2017, Pedro Alves wrote:

> On 11/30/2017 07:59 PM, Sergio Durigan Junior wrote:
>> Changes from v3:
>> 
>> - 'add-symbol-file -s' now accepts sections whose names start with a
>>   dash.
>> 
>> - Use a better way to test must-ask questions on the testsuite.
>> 
>> 
>> This is a bug that's been detected while doing the readnever work.
>> 
>> If you use 'symbol-file' or 'add-symbol-file', the position of each
>> argument passed to the command matters.  This means that if you do:
>> 
>>   (gdb) symbol-file -readnow /foo/bar
>> 
>> The symbol file specified will (correctly) have all of its symbols
>> read by GDB (because of the -readnow flag).  However, if you do:
>> 
>>   (gdb) symbol-file /foo/bar -readnow
>> 
>> GDB will silently ignore the -readnow flag, because it was specified
>> after the filename.  This is not a good thing to do and may confuse
>> the user.
>> 
>> To address that, I've modified the argument parsing mechanisms of
>> symbol_file_command and add_symbol_file_command to be
>> "position-independent".  I have also added one error call at the end
>> of add_symbol_file_command's argument parsing logic, which now clearly
>> complains if no filename has been specified.  Both commands now
>> support the "--" option to stop argument processing.
>> 
>> This patch provides a testcase for both commands, in order to make
>> sure that the argument order does not matter.  It has been
>> regression-tested on BuildBot.
>> 
>> gdb/ChangeLog:
>> 
>> 2017-11-30  Sergio Durigan Junior  <sergiodj@redhat.com>
>> 
>> 	* symfile.c (symbol_file_command): Call
>> 	'symbol_file_add_main_1' only after processing all command
>> 	line options.
>> 	(add_symbol_file_command): Modify logic to make arguments
>> 	position-independent.
>> 
>> gdb/testsuite/ChangeLog:
>> 
>> 2017-11-30  Sergio Durigan Junior  <sergiodj@redhat.com>
>> 
>> 	* gdb.base/relocate.exp: Add tests to guarantee that arguments
>> 	to 'symbol-file' and 'add-symbol-file' can be
>> 	position-independent.
>
> OK.

Pushed.

e2e321740ce2e36a97be2a410cd56eebaa2304aa

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


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