[RFA 2/2] C++-ify break-catch-throw

Simon Marchi simon.marchi@polymtl.ca
Mon Jun 5 08:54:00 GMT 2017


> --- a/gdb/break-catch-throw.c
> +++ b/gdb/break-catch-throw.c
> @@ -82,15 +82,15 @@ struct exception_catchpoint : public breakpoint
> 
>    enum exception_event_kind kind;
> 
> -  /* If non-NULL, an xmalloc'd string holding the source form of the
> -     regular expression to match against.  */
> +  /* If not empty, a string holding the source form of the regular
> +     expression to match against.  */
> 
> -  char *exception_rx;
> +  std::string exception_rx;
> 
> -  /* If non-NULL, an xmalloc'd, compiled regular expression which is
> +  /* If non-NULL, a compiled regular expression which is
>       used to determine which exceptions to stop on.  */
> 
> -  regex_t *pattern;
> +  std::unique_ptr<regex_t> pattern;

 From what I understand, we were freeing the regex with regfree, but we 
weren't freeing the regex_t object, which is allocated separately, is 
that right?  Or what is freed in handle_gnu_v3_exceptions by the 
cleanup, and then referenced later?  Either way your code LGTM.

Simon



More information about the Gdb-patches mailing list