Re: [PATCH/RFC 02/02 v2] Refactor PRPSINFO handling on GDB

Pedro Alves
2013-01-11T14:49:24Z

On 01/11/2013 03:53 AM, Sergio Durigan Junior wrote:

> Anyway, at first I thought that the extension could be seen as
> refactoring as well, that's why I didn't bother making another patch.

http://en.wikipedia.org/wiki/Code_refactoring

"Code refactoring is a \"disciplined technique for restructuring an existing
body of code, altering its internal structure without changing
its external behavior\", undertaken in order to improve some of the
nonfunctional attributes of the software. "

;-)

>
>>> + /* Generating and copying the program's arguments. `get_inferior_args'
>>> + may throw, but we want to continue the execution anyway. */
>>> + TRY_CATCH (ex, RETURN_MASK_ERROR)
>>> + {
>>> + infargs = get_inferior_args ();
>>> + }
>>> +
>>
>> Hmm? We were not doing that before. What exception is that?
>
> `get_inferior_args' calls `construct_inferior_arguments', which can call
> `error' in an specific scenario (not STARTUP_WITH_SHELL, arguments that
> contain spaces).

This is an example of something that should be split into
its own change, along with its own rationale. This is
independent of any refactoring of PRPSINFO handling.
We're already calling get_inferior_args nowadays, and I don't
ever remember this error being reported as a problem.
The reason must be that STARTUP_WITH_SHELL is always defined
to 1 nowadays. It hasn't been zapped because it'd actually
be nice to make it a user setting. And once that is done,
we'd indeed trip on that error.

In any case, it seems to me that that error/exception/limitation
could/should be lifted by making construct_inferior_arguments
quote the arguments with spaces.

--
Pedro Alves