mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
Fix bug reported and analyzed by Olivier Crete:
* symfile.c (copy_section_addr_info): New function. (symbol_file_add_with_addrs_or_offsets): Use it to save the original set of address arguments, instead of handwritten code that uses one length to allocate and a different length to initialize. Use make_cleanup_free_section_addr_info. * symfile.h (copy_section_addr_info): New declaration. * utils.c: #include "symfile.h". (do_free_section_addr_info, make_cleanup_free_section_addr_info): New functions. * defs.h (make_cleanup_free_section_addr_info): New declaration. * Makefile.in (utils.o): Update dependencies.
This commit is contained in:
14
gdb/utils.c
14
gdb/utils.c
@@ -51,6 +51,7 @@
|
||||
#include "charset.h"
|
||||
#include "annotate.h"
|
||||
#include "filenames.h"
|
||||
#include "symfile.h"
|
||||
|
||||
#include "inferior.h" /* for signed_pointer_to_address */
|
||||
|
||||
@@ -260,6 +261,19 @@ make_cleanup_ui_file_delete (struct ui_file *arg)
|
||||
return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg);
|
||||
}
|
||||
|
||||
static void
|
||||
do_free_section_addr_info (void *arg)
|
||||
{
|
||||
free_section_addr_info (arg);
|
||||
}
|
||||
|
||||
struct cleanup *
|
||||
make_cleanup_free_section_addr_info (struct section_addr_info *addrs)
|
||||
{
|
||||
return make_my_cleanup (&cleanup_chain, do_free_section_addr_info, addrs);
|
||||
}
|
||||
|
||||
|
||||
struct cleanup *
|
||||
make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function,
|
||||
void *arg)
|
||||
|
||||
Reference in New Issue
Block a user