This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Class-ify lm_info_darwin
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 28 Apr 2017 21:19:11 -0000
- Subject: [binutils-gdb] Class-ify lm_info_darwin
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9ccbfd7bc1b7228d67f2d4ca878224d493918264
commit 9ccbfd7bc1b7228d67f2d4ca878224d493918264
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Fri Apr 28 17:16:18 2017 -0400
Class-ify lm_info_darwin
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.
Diff:
---
gdb/ChangeLog | 7 +++++++
gdb/solib-darwin.c | 8 +++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eb0571b..49f8f0d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
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.
<l_addr_p>: Change type to bool.
* solib-svr4.c (lm_info_read): Allocate lm_info_svr4 with new.
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 03211cf..3651929 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -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.