Patchwork [RFA,12/15] Move more allocations to psymtab obstack

login
register
mail settings
Submitter Tom Tromey
Date May 10, 2018, 10:23 p.m.
Message ID <20180510222357.27332-13-tom@tromey.com>
Download mbox | patch
Permalink /patch/27231/
State New
Headers show

Comments

Tom Tromey - May 10, 2018, 10:23 p.m.
This moves a couple more psymtab-related allocations to the psymtab
obstack.

2018-05-10  Tom Tromey  <tom@tromey.com>

	* psymtab.c (add_psymbol_to_bcache): Pass psymtab obstack to
	PSYMBOL_SET_LANGUAGE.
	(allocate_psymtab): Allocate psymtab on the psymtab obstack.
---
 gdb/ChangeLog | 6 ++++++
 gdb/psymtab.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)
Simon Marchi - July 18, 2018, 2:24 p.m.
On 2018-05-10 06:23 PM, Tom Tromey wrote:
> This moves a couple more psymtab-related allocations to the psymtab
> obstack.

LGTM.

Simon

Patch

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index a7bec436e0..d121eace54 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1695,7 +1695,8 @@  add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
 
   SET_PSYMBOL_VALUE_ADDRESS (&psymbol, coreaddr);
   PSYMBOL_SECTION (&psymbol) = section;
-  PSYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack);
+  PSYMBOL_SET_LANGUAGE (&psymbol, language,
+			objfile->partial_symtabs->obstack ());
   PSYMBOL_DOMAIN (&psymbol) = domain;
   PSYMBOL_CLASS (&psymbol) = theclass;
 
@@ -1783,7 +1784,7 @@  allocate_psymtab (const char *filename, struct objfile *objfile)
     }
   else
     psymtab = (struct partial_symtab *)
-      obstack_alloc (&objfile->objfile_obstack,
+      obstack_alloc (objfile->partial_symtabs->obstack (),
 		     sizeof (struct partial_symtab));
 
   memset (psymtab, 0, sizeof (struct partial_symtab));