This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 3/3] Change ada_catchpoint::excep_string to be a std::string
On 2018-05-19 12:06 PM, Tom Tromey wrote:
> This changes ada_catchpoint::excep_string to be a std::string and then
> fixes up all t he users.
>
> This found a memory leak in catch_ada_exception_command_split, where
> "cond" was copied but never freed.
>
> I changed the type of the "cond_string" argument to
> catch_ada_exception_command_split to follow the rule that out
> parameters should be pointers and not references.
It wasn't a rule yet (AFAIK), but it is now.
https://sourceware.org/ml/gdb-patches/2018-05/msg00450.html
The patch LGTM, with some nits.
>
> This patch enables the removal of some cleanups and also the function
> ada_get_next_arg.
You can remove the ada_catchpoint destructor I think.
> @@ -13333,13 +13286,11 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex, char *excep_string,
>
> EX_KIND is the kind of exception catchpoint to be created.
>
> - If EXCEPT_STRING is NULL, this catchpoint is expected to trigger
> + If EXCEPT_STRING is empty, this catchpoint is expected to trigger
> for all exceptions. Otherwise, EXCEPT_STRING indicates the name
> - of the exception to which this catchpoint applies. When not NULL,
> - the string must be allocated on the heap, and its deallocation
> - is no longer the responsibility of the caller.
> + of the exception to which this catchpoint applies.
>
> - COND_STRING, if not NULL, is the catchpoint condition. This string
> + COND_STRING, if not empty, is the catchpoint condition. This string
> must be allocated on the heap, and its deallocation is no longer
> the responsibility of the caller.
The last part of this paragraph is probably no longer valid.
Simon