mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-02-23 11:04:32 +00:00
resize_section_table cleanup
* exec.c (exec_close_1): Call clear_section_table instead of resize_section_table. (clear_section_table): New function. (resize_section_table): Make static. Rename arg num_added to adjustment. * exec.h (clear_section_table): Declare. (resize_section_table): Delete. * progspace.c (release_program_space): Call clear_section_table instead of resize_section_table.
This commit is contained in:
parent
33ac0ca144
commit
a5b1fd2780
@ -1,3 +1,15 @@
|
|||||||
|
2014-06-03 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* exec.c (exec_close_1): Call clear_section_table instead of
|
||||||
|
resize_section_table.
|
||||||
|
(clear_section_table): New function.
|
||||||
|
(resize_section_table): Make static. Rename arg num_added to
|
||||||
|
adjustment.
|
||||||
|
* exec.h (clear_section_table): Declare.
|
||||||
|
(resize_section_table): Delete.
|
||||||
|
* progspace.c (release_program_space): Call clear_section_table
|
||||||
|
instead of resize_section_table.
|
||||||
|
|
||||||
2014-06-03 Siva Chandra Reddy <sivachandra@google.com>
|
2014-06-03 Siva Chandra Reddy <sivachandra@google.com>
|
||||||
|
|
||||||
* NEWS (Python Scripting): Add entry about the new xmethods
|
* NEWS (Python Scripting): Add entry about the new xmethods
|
||||||
|
32
gdb/exec.c
32
gdb/exec.c
@ -125,12 +125,7 @@ exec_close_1 (struct target_ops *self)
|
|||||||
ALL_PSPACES (ss)
|
ALL_PSPACES (ss)
|
||||||
{
|
{
|
||||||
set_current_program_space (ss);
|
set_current_program_space (ss);
|
||||||
|
clear_section_table (current_target_sections);
|
||||||
/* Delete all target sections. */
|
|
||||||
resize_section_table
|
|
||||||
(current_target_sections,
|
|
||||||
-resize_section_table (current_target_sections, 0));
|
|
||||||
|
|
||||||
exec_close ();
|
exec_close ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,15 +361,29 @@ add_to_section_table (bfd *abfd, struct bfd_section *asect,
|
|||||||
(*table_pp)++;
|
(*table_pp)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
/* See exec.h. */
|
||||||
resize_section_table (struct target_section_table *table, int num_added)
|
|
||||||
|
void
|
||||||
|
clear_section_table (struct target_section_table *table)
|
||||||
|
{
|
||||||
|
xfree (table->sections);
|
||||||
|
table->sections = table->sections_end = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Resize section table TABLE by ADJUSTMENT.
|
||||||
|
ADJUSTMENT may be negative, in which case the caller must have already
|
||||||
|
removed the sections being deleted.
|
||||||
|
Returns the old size. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
resize_section_table (struct target_section_table *table, int adjustment)
|
||||||
{
|
{
|
||||||
int old_count;
|
int old_count;
|
||||||
int new_count;
|
int new_count;
|
||||||
|
|
||||||
old_count = table->sections_end - table->sections;
|
old_count = table->sections_end - table->sections;
|
||||||
|
|
||||||
new_count = num_added + old_count;
|
new_count = adjustment + old_count;
|
||||||
|
|
||||||
if (new_count)
|
if (new_count)
|
||||||
{
|
{
|
||||||
@ -383,10 +392,7 @@ resize_section_table (struct target_section_table *table, int num_added)
|
|||||||
table->sections_end = table->sections + new_count;
|
table->sections_end = table->sections + new_count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
clear_section_table (table);
|
||||||
xfree (table->sections);
|
|
||||||
table->sections = table->sections_end = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return old_count;
|
return old_count;
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,9 @@ extern struct target_ops exec_ops;
|
|||||||
extern int build_section_table (struct bfd *, struct target_section **,
|
extern int build_section_table (struct bfd *, struct target_section **,
|
||||||
struct target_section **);
|
struct target_section **);
|
||||||
|
|
||||||
/* Resize the section table held by TABLE, by NUM_ADDED. Returns the
|
/* Remove all entries from TABLE. */
|
||||||
old size. */
|
|
||||||
|
|
||||||
extern int resize_section_table (struct target_section_table *, int);
|
extern void clear_section_table (struct target_section_table *table);
|
||||||
|
|
||||||
/* Read from mappable read-only sections of BFD executable files.
|
/* Read from mappable read-only sections of BFD executable files.
|
||||||
Return TARGET_XFER_OK, if read is successful. Return
|
Return TARGET_XFER_OK, if read is successful. Return
|
||||||
|
@ -160,8 +160,7 @@ release_program_space (struct program_space *pspace)
|
|||||||
free_all_objfiles ();
|
free_all_objfiles ();
|
||||||
if (!gdbarch_has_shared_address_space (target_gdbarch ()))
|
if (!gdbarch_has_shared_address_space (target_gdbarch ()))
|
||||||
free_address_space (pspace->aspace);
|
free_address_space (pspace->aspace);
|
||||||
resize_section_table (&pspace->target_sections,
|
clear_section_table (&pspace->target_sections);
|
||||||
-resize_section_table (&pspace->target_sections, 0));
|
|
||||||
clear_program_space_solib_cache (pspace);
|
clear_program_space_solib_cache (pspace);
|
||||||
/* Discard any data modules have associated with the PSPACE. */
|
/* Discard any data modules have associated with the PSPACE. */
|
||||||
program_space_free_data (pspace);
|
program_space_free_data (pspace);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user