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: [RFA 2/2] C++-ify break-catch-throw


--- 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


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