* [review] Do not allocate psymtabs via psymtab_storage
@ 2019-10-28 2:03 Tom Tromey (Code Review)
2020-01-26 23:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2020-01-26 23:49 ` Sourceware to Gerrit sync (Code Review)
0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-28 2:03 UTC (permalink / raw)
To: gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/376
......................................................................
Do not allocate psymtabs via psymtab_storage
Currently, partial symbol tables are allocated by a method in
psymtab_storage. However, eventually we want to subclass partial
symtabs in the symbol readers, so the calls to "new" will have to
happen there. This patch is a first step, moving the allocation from
psymtab_storage and into allocate_psymtab.
gdb/ChangeLog
2019-10-27 Tom Tromey <tom@tromey.com>
* psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
allocate_psymtab. Update documentation.
* psymtab.c (psymtab_storage::install_psymtab): Rename from
allocate_psymtab. Do not use new.
(allocate_psymtab): Use new. Update.
Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8
---
M gdb/ChangeLog
M gdb/psymtab.c
M gdb/psymtab.h
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c2831e7..6cfcad9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2019-10-27 Tom Tromey <tom@tromey.com>
+ * psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
+ allocate_psymtab. Update documentation.
+ * psymtab.c (psymtab_storage::install_psymtab): Rename from
+ allocate_psymtab. Do not use new.
+ (allocate_psymtab): Use new. Update.
+
+2019-10-27 Tom Tromey <tom@tromey.com>
+
* xcoffread.c (xcoff_psymtab_to_symtab_1): Update.
* psymtab.c (psym_print_stats): Update.
* psympriv.h (struct partial_symtab) <readin,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 750d350..8351c6a 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -75,15 +75,11 @@
/* See psymtab.h. */
-struct partial_symtab *
-psymtab_storage::allocate_psymtab ()
+void
+psymtab_storage::install_psymtab (partial_symtab *pst)
{
- struct partial_symtab *psymtab = new struct partial_symtab;
-
- psymtab->next = psymtabs;
- psymtabs = psymtab;
-
- return psymtab;
+ pst->next = psymtabs;
+ psymtabs = pst;
}
\f
@@ -1655,8 +1651,8 @@
struct partial_symtab *
allocate_psymtab (const char *filename, struct objfile *objfile)
{
- struct partial_symtab *psymtab
- = objfile->partial_symtabs->allocate_psymtab ();
+ struct partial_symtab *psymtab = new partial_symtab;
+ objfile->partial_symtabs->install_psymtab (psymtab);
psymtab->filename
= ((const char *) objfile->per_bfd->filename_cache.insert
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index d748695..80a5fc5 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -83,11 +83,10 @@
return OBSTACK_CALLOC (obstack (), number, struct partial_symtab *);
}
- /* Allocate a new psymtab on the psymtab obstack. The new psymtab
- will be linked in to the "psymtabs" list, but otherwise all other
- fields will be zero. */
+ /* Install a psymtab on the psymtab list. This transfers ownership
+ of PST to this object. */
- struct partial_symtab *allocate_psymtab ();
+ void install_psymtab (partial_symtab *pst);
typedef next_adapter<struct partial_symtab> partial_symtab_range;
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8
Gerrit-Change-Number: 376
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pushed] Do not allocate psymtabs via psymtab_storage
2019-10-28 2:03 [review] Do not allocate psymtabs via psymtab_storage Tom Tromey (Code Review)
@ 2020-01-26 23:41 ` Sourceware to Gerrit sync (Code Review)
2020-01-26 23:49 ` Sourceware to Gerrit sync (Code Review)
1 sibling, 0 replies; 3+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2020-01-26 23:41 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
The original change was created by Tom Tromey.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/376
......................................................................
Do not allocate psymtabs via psymtab_storage
Currently, partial symbol tables are allocated by a method in
psymtab_storage. However, eventually we want to subclass partial
symtabs in the symbol readers, so the calls to "new" will have to
happen there. This patch is a first step, moving the allocation from
psymtab_storage and into allocate_psymtab.
gdb/ChangeLog
2020-01-26 Tom Tromey <tom@tromey.com>
* psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
allocate_psymtab. Update documentation.
* psymtab.c (psymtab_storage::install_psymtab): Rename from
allocate_psymtab. Do not use new.
(allocate_psymtab): Use new. Update.
Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8
---
M gdb/ChangeLog
M gdb/psymtab.c
M gdb/psymtab.h
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 345a81c..475ebbb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2020-01-26 Tom Tromey <tom@tromey.com>
+ * psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
+ allocate_psymtab. Update documentation.
+ * psymtab.c (psymtab_storage::install_psymtab): Rename from
+ allocate_psymtab. Do not use new.
+ (allocate_psymtab): Use new. Update.
+
+2020-01-26 Tom Tromey <tom@tromey.com>
+
* xcoffread.c (xcoff_psymtab_to_symtab_1): Update.
* psymtab.c (psym_print_stats): Update.
* psympriv.h (struct partial_symtab) <readin,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 037ed19..975737c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -75,15 +75,11 @@
/* See psymtab.h. */
-struct partial_symtab *
-psymtab_storage::allocate_psymtab ()
+void
+psymtab_storage::install_psymtab (partial_symtab *pst)
{
- struct partial_symtab *psymtab = new struct partial_symtab;
-
- psymtab->next = psymtabs;
- psymtabs = psymtab;
-
- return psymtab;
+ pst->next = psymtabs;
+ psymtabs = pst;
}
\f
@@ -1653,8 +1649,8 @@
struct partial_symtab *
allocate_psymtab (const char *filename, struct objfile *objfile)
{
- struct partial_symtab *psymtab
- = objfile->partial_symtabs->allocate_psymtab ();
+ struct partial_symtab *psymtab = new partial_symtab;
+ objfile->partial_symtabs->install_psymtab (psymtab);
psymtab->filename
= ((const char *) objfile->per_bfd->filename_cache.insert
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index c0f0a97..d665474 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -83,11 +83,10 @@
return OBSTACK_CALLOC (obstack (), number, struct partial_symtab *);
}
- /* Allocate a new psymtab on the psymtab obstack. The new psymtab
- will be linked in to the "psymtabs" list, but otherwise all other
- fields will be zero. */
+ /* Install a psymtab on the psymtab list. This transfers ownership
+ of PST to this object. */
- struct partial_symtab *allocate_psymtab ();
+ void install_psymtab (partial_symtab *pst);
typedef next_adapter<struct partial_symtab> partial_symtab_range;
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8
Gerrit-Change-Number: 376
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pushed] Do not allocate psymtabs via psymtab_storage
2019-10-28 2:03 [review] Do not allocate psymtabs via psymtab_storage Tom Tromey (Code Review)
2020-01-26 23:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2020-01-26 23:49 ` Sourceware to Gerrit sync (Code Review)
1 sibling, 0 replies; 3+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2020-01-26 23:49 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/376
......................................................................
Do not allocate psymtabs via psymtab_storage
Currently, partial symbol tables are allocated by a method in
psymtab_storage. However, eventually we want to subclass partial
symtabs in the symbol readers, so the calls to "new" will have to
happen there. This patch is a first step, moving the allocation from
psymtab_storage and into allocate_psymtab.
gdb/ChangeLog
2020-01-26 Tom Tromey <tom@tromey.com>
* psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
allocate_psymtab. Update documentation.
* psymtab.c (psymtab_storage::install_psymtab): Rename from
allocate_psymtab. Do not use new.
(allocate_psymtab): Use new. Update.
Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8
---
M gdb/ChangeLog
M gdb/psymtab.c
M gdb/psymtab.h
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 345a81c..475ebbb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2020-01-26 Tom Tromey <tom@tromey.com>
+ * psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
+ allocate_psymtab. Update documentation.
+ * psymtab.c (psymtab_storage::install_psymtab): Rename from
+ allocate_psymtab. Do not use new.
+ (allocate_psymtab): Use new. Update.
+
+2020-01-26 Tom Tromey <tom@tromey.com>
+
* xcoffread.c (xcoff_psymtab_to_symtab_1): Update.
* psymtab.c (psym_print_stats): Update.
* psympriv.h (struct partial_symtab) <readin,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 037ed19..975737c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -75,15 +75,11 @@
/* See psymtab.h. */
-struct partial_symtab *
-psymtab_storage::allocate_psymtab ()
+void
+psymtab_storage::install_psymtab (partial_symtab *pst)
{
- struct partial_symtab *psymtab = new struct partial_symtab;
-
- psymtab->next = psymtabs;
- psymtabs = psymtab;
-
- return psymtab;
+ pst->next = psymtabs;
+ psymtabs = pst;
}
\f
@@ -1653,8 +1649,8 @@
struct partial_symtab *
allocate_psymtab (const char *filename, struct objfile *objfile)
{
- struct partial_symtab *psymtab
- = objfile->partial_symtabs->allocate_psymtab ();
+ struct partial_symtab *psymtab = new partial_symtab;
+ objfile->partial_symtabs->install_psymtab (psymtab);
psymtab->filename
= ((const char *) objfile->per_bfd->filename_cache.insert
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index c0f0a97..d665474 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -83,11 +83,10 @@
return OBSTACK_CALLOC (obstack (), number, struct partial_symtab *);
}
- /* Allocate a new psymtab on the psymtab obstack. The new psymtab
- will be linked in to the "psymtabs" list, but otherwise all other
- fields will be zero. */
+ /* Install a psymtab on the psymtab list. This transfers ownership
+ of PST to this object. */
- struct partial_symtab *allocate_psymtab ();
+ void install_psymtab (partial_symtab *pst);
typedef next_adapter<struct partial_symtab> partial_symtab_range;
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8
Gerrit-Change-Number: 376
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-26 23:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 2:03 [review] Do not allocate psymtabs via psymtab_storage Tom Tromey (Code Review)
2020-01-26 23:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2020-01-26 23:49 ` Sourceware to Gerrit sync (Code Review)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).