diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-04-28 17:16:12 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-04-28 17:16:12 -0400 |
commit | 434a40239548115cf04a80410e4f570f35c361c1 (patch) | |
tree | 59072d73a0277f988e1528b07c4d0580c8b26ce7 | |
parent | 1670f9c1546818c4ffe02e8f460df1c1c4b1601d (diff) | |
download | gdb-434a40239548115cf04a80410e4f570f35c361c1.zip gdb-434a40239548115cf04a80410e4f570f35c361c1.tar.gz gdb-434a40239548115cf04a80410e4f570f35c361c1.tar.bz2 |
Standardize darwin's lm_info
Darwin's lm_info structure is used a little bit differently than the
other solib implementations. The other implementations first allocate
an so_list object, then instanciate their specific lm_info structure,
and assign it to so_list::lm_info.
The Darwin implementation allocates both at the same time
(darwin_so_list). This patch changes it to be like the others, so that
we'll be able to do some generalizations later.
gdb/ChangeLog:
* solib-darwin.c (struct darwin_so_list): Remove.
(darwin_current_sos): Allocate an so_list object instead of a
darwin_so_list, separately allocate an lm_info object.
(darwin_free_so): Free lm_info.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/solib-darwin.c | 17 |
2 files changed, 11 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a5ecf6e..8f7f552 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2017-04-28 Simon Marchi <simon.marchi@ericsson.com> + + * solib-darwin.c (struct darwin_so_list): Remove. + (darwin_current_sos): Allocate an so_list object instead of a + darwin_so_list, separately allocate an lm_info object. + (darwin_free_so): Free lm_info. + 2017-04-28 John Baldwin <jhb@FreeBSD.org> * mips-tdep.c (print_gp_register_row): Replace printf_filtered diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 0b97556..c507e13 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -159,14 +159,6 @@ struct lm_info CORE_ADDR lm_addr; }; -struct darwin_so_list -{ - /* Common field. */ - struct so_list sl; - /* Darwin specific data. */ - struct lm_info li; -}; - /* Lookup the value for a specific symbol. */ static CORE_ADDR @@ -271,7 +263,6 @@ darwin_current_sos (void) unsigned long hdr_val; char *file_path; int errcode; - struct darwin_so_list *dnew; struct so_list *newobj; struct cleanup *old_chain; @@ -302,11 +293,10 @@ darwin_current_sos (void) break; /* Create and fill the new so_list element. */ - dnew = XCNEW (struct darwin_so_list); - newobj = &dnew->sl; - old_chain = make_cleanup (xfree, dnew); + newobj = XCNEW (struct so_list); + old_chain = make_cleanup (xfree, newobj); - newobj->lm_info = &dnew->li; + newobj->lm_info = XCNEW (struct lm_info); strncpy (newobj->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1); newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; @@ -587,6 +577,7 @@ darwin_clear_solib (void) static void darwin_free_so (struct so_list *so) { + xfree (so->lm_info); } /* The section table is built from bfd sections using bfd VMAs. |