Class-ify lm_info_darwin
authorSimon Marchi <simon.marchi@ericsson.com>
Fri, 28 Apr 2017 21:16:18 +0000 (17:16 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 28 Apr 2017 21:16:18 +0000 (17:16 -0400)
This patch makes lm_info_darwin a "real" class.  It initializes the
field and replaces XCNEW/xfree with new/delete.

gdb/ChangeLog:

* solib-darwin.c (struct lm_info_darwin): Initialize field.
(darwin_current_sos): Allocate lm_info_darwin with new, remove
cleanup.
(darwin_free_so): Free lm_info_darwin with delete.

gdb/ChangeLog
gdb/solib-darwin.c

index eb0571b8dd27b574b0d99160e0614619d5e3db73..49f8f0db5ba986c4fb634f7d50cffcbe08f9e3e4 100644 (file)
@@ -1,3 +1,10 @@
+2017-04-28  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * solib-darwin.c (struct lm_info_darwin): Initialize field.
+       (darwin_current_sos): Allocate lm_info_darwin with new, remove
+       cleanup.
+       (darwin_free_so): Free lm_info_darwin with delete.
+
 2017-04-28  Simon Marchi  <simon.marchi@ericsson.com>
 
        * solib-svr4.h (struct lm_info_svr4): Initialize fields.
index 03211cfb92a6a61baabb9ecab02dbd1985a95b39..365192949af19abb8983104b8a6ee8624eb080f4 100644 (file)
@@ -156,7 +156,7 @@ darwin_load_image_infos (struct darwin_info *info)
 struct lm_info_darwin : public lm_info_base
 {
   /* The target location of lm.  */
-  CORE_ADDR lm_addr;
+  CORE_ADDR lm_addr = 0;
 };
 
 /* Lookup the value for a specific symbol.  */
@@ -296,7 +296,7 @@ darwin_current_sos (void)
       newobj = XCNEW (struct so_list);
       old_chain = make_cleanup (xfree, newobj);
 
-      lm_info_darwin *li = XCNEW (lm_info_darwin);
+      lm_info_darwin *li = new lm_info_darwin;
       newobj->lm_info = li;
 
       strncpy (newobj->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1);
@@ -578,7 +578,9 @@ darwin_clear_solib (void)
 static void
 darwin_free_so (struct so_list *so)
 {
-  xfree (so->lm_info);
+  lm_info_darwin *li = (lm_info_darwin *) so->lm_info;
+
+  delete li;
 }
 
 /* The section table is built from bfd sections using bfd VMAs.