From: Michal Ludvig <mludvig@suse.cz>
To: Andrew Cagney <ac131313@redhat.com>
Cc: Daniel Jacobowitz <drow@mvista.com>,
GDB Patches <gdb-patches@sources.redhat.com>,
Elena Zannoni <ezannoni@redhat.com>
Subject: Re: PING: [RFA] Runtime Dwarf2 CFI engine cleanup
Date: Thu, 27 Feb 2003 10:15:00 -0000 [thread overview]
Message-ID: <3E5DE525.6040703@suse.cz> (raw)
In-Reply-To: <3E5DC8F6.9010301@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 2729 bytes --]
Michal Ludvig wrote:
> Daniel Jacobowitz wrote:
>
>> In any case I am withdrawing my attempt to be helpful, since obviously
>> I'm being pushy again instead of helpful. Michal can go back to
>> waiting for someone else's response since my "help" has obviously
>> injured the entire process.
>
> Thank you very much, anyway! You at least attempted to solve this issue.
> Other "responsible" maintainers didn't bother to respond until you
> approved my patch. Then Andrew felt he should step in, revert your
> approval and say NO (why there doesn't come a *constructive* critique
> along with your no, Andrew?). And Elena - apparently the only one who
> could say yes - disappeared... Sigh.
>
> I'm asking once again:
> - Can I *at* *least* commit the dwarf2cfi.c part? Without the infcmd.c
> hook? I know it duplicates the solib cleaner logic, but is that a
> showstopper?
> - Ad run_command() hook - would something like this be acceptable?
>
> Index: config/i386/tm-x86-64linux.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/i386/tm-x86-64linux.h,v
> retrieving revision 1.1
> diff -u -p -r1.1 tm-x86-64linux.h
> --- config/i386/tm-x86-64linux.h 1 Jul 2002 22:09:52 -0000 1.1
> +++ config/i386/tm-x86-64linux.h 27 Feb 2003 08:02:50 -0000
> @@ -33,4 +33,6 @@
> #define SVR4_SHARED_LIBS
> #include "solib.h" /* Support for shared libraries. */
>
> +#define DWARF2CFI_USED
> +
> #endif /* #ifndef TM_X86_64LINUX_H */
> Index: infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.54.6.2
> diff -u -p -r1.54.6.2 infcmd.c
> --- infcmd.c 25 Sep 2002 20:43:21 -0000 1.54.6.2
> +++ infcmd.c 27 Feb 2003 08:02:50 -0000
> @@ -390,6 +390,10 @@ Start it from the beginning? "))
>
> clear_breakpoint_hit_counts ();
>
> +#if defined(DWARF2CFI_USED)
> + cleanup_cfi ();
> +#endif
> +
> /* Purge old solib objfiles. */
> objfile_purge_solibs ();
>
> Every target that will use the CFI engine will just add one define to
> their tm.h. No need to link dwarf2cfi.o to all targets.
I've extended this approach a little bit. Now it's enough to define
USED_DWARF2CFI=1 in config/arch/target.mh file and everything will be
configured automatically, ie. dwarf2cfi.o will be added to the list of
files to compile and -DUSED_DWARF2CFI=1 will be added to CFLAGS.
So only those targets that explicitly say "Yes, I want CFI engine" will
have it and the run_command cleanup hook will go in for them as well.
Is this a way to go?
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
[-- Attachment #2: rerun-mfdef-1.diff --]
[-- Type: text/plain, Size: 4506 bytes --]
2003-02-27 Michal Ludvig <mludvig@suse.cz>
* config/i386/x86-64linux.mt (TDEPFILES): Remove dwarf2cfi.o
(USED_DWARF2CFI): New define.
* Makefile.in: Handle USED_DWARF2CFI define.
* infcmd.c (run_command): Add cleanup_cfi() if USED_DWARF2CFI
is defined.
* dwarf2cfi.c (struct cie_unit): New fields keep, refs.
(cleanup_cfi): New function.
Index: config/i386/x86-64linux.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/x86-64linux.mt,v
retrieving revision 1.5
diff -u -p -r1.5 x86-64linux.mt
--- config/i386/x86-64linux.mt 1 Jul 2002 22:09:52 -0000 1.5
+++ config/i386/x86-64linux.mt 27 Feb 2003 10:01:03 -0000
@@ -1,7 +1,9 @@
# Target: AMD x86-64 running GNU/Linux
-TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o dwarf2cfi.o \
+TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o \
solib.o solib-svr4.o solib-legacy.o
GDB_MULTI_ARCH=GDB_MULTI_ARCH_TM
TM_FILE=tm-x86-64linux.h
+
+USED_DWARF2CFI=1
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.257.2.5
diff -u -p -r1.257.2.5 Makefile.in
--- Makefile.in 25 Nov 2002 22:05:38 -0000 1.257.2.5
+++ Makefile.in 27 Feb 2003 10:01:03 -0000
@@ -414,6 +414,12 @@ ANNOTATE_OBS = annotate.o
@target_makefile_frag@
# End of host and target-dependent makefile fragments
+# Make a list of linked files depending on target's defines.
+ifeq ($(USED_DWARF2CFI), 1)
+ TDEPFILES+=dwarf2cfi.o
+ CFLAGS+=-DUSED_DWARF2CFI
+endif
+
# Possibly ignore the simulator. If the simulator is being ignored,
# these expand into SIM= and SIM_OBJ=, overriding the entries from
# target_makefile_frag
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.54.6.2
diff -u -p -r1.54.6.2 infcmd.c
--- infcmd.c 25 Sep 2002 20:43:21 -0000 1.54.6.2
+++ infcmd.c 27 Feb 2003 10:01:03 -0000
@@ -390,6 +390,10 @@ Start it from the beginning? "))
clear_breakpoint_hit_counts ();
+#if defined(USED_DWARF2CFI)
+ cleanup_cfi ();
+#endif
+
/* Purge old solib objfiles. */
objfile_purge_solibs ();
Index: dwarf2cfi.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
retrieving revision 1.16.6.1
diff -u -p -r1.16.6.1 dwarf2cfi.c
--- dwarf2cfi.c 3 Feb 2003 14:40:09 -0000 1.16.6.1
+++ dwarf2cfi.c 27 Feb 2003 10:01:04 -0000
@@ -54,6 +54,12 @@ struct cie_unit
/* Next in chain. */
struct cie_unit *next;
+
+ /* Keep or destroy this CIE on new run? */
+ int keep;
+
+ /* How many FDEs refer to this CIE? */
+ int refs;
};
/* Frame Description Entry. */
@@ -319,6 +260,90 @@ frame_state_alloc (void)
return fs;
}
+void
+cleanup_cfi (void *name)
+{
+ struct objfile *ofp;
+ struct cie_unit *cie, *cie_prev;
+ int fde_index = 0, fde_free = 0;
+
+ cie = cie_chunks;
+ while (cie)
+ {
+ cie->refs = 0;
+ cie->keep = 0;
+ cie = cie->next;
+ }
+
+ /* Mark all unwanted CIEs. */
+ ALL_OBJFILES (ofp)
+ {
+ if (!(ofp->flags & OBJF_USERLOADED) && (ofp->flags & OBJF_SHARED))
+ {
+ if (info_verbose)
+ printf_filtered ("\tRemoving %s...\n", ofp->name);
+ }
+ else
+ {
+ if (info_verbose)
+ printf_filtered ("\tKeeping %s...\n", ofp->name);
+
+ cie = cie_chunks;
+ while (cie)
+ {
+ if (cie->objfile == ofp)
+ cie->keep = 1;
+ cie = cie->next;
+ }
+ }
+ }
+
+ /* Remove all FDEs pointing to unwanted CIEs. */
+ for (fde_index = 0, fde_free = 0;
+ fde_index < fde_chunks.elems; fde_index++, fde_free++)
+ {
+ if (!fde_chunks.array[fde_index]->cie_ptr->keep)
+ {
+ fde_free--;
+ continue;
+ }
+ else if (fde_free < fde_index)
+ fde_chunks.array[fde_free] = fde_chunks.array[fde_index];
+ fde_chunks.array[fde_free]->cie_ptr->refs++;
+ }
+ fde_chunks.elems = fde_free;
+
+ /* Remove all unwanted CIEs. */
+ cie = cie_chunks;
+ cie_prev = NULL;
+ while (cie)
+ {
+ struct cie_unit *cie_tmp;
+
+ if (!cie->keep || !cie->refs)
+ {
+ cie_tmp = cie;
+ if (cie_prev == NULL)
+ {
+ cie_chunks = cie->next;
+ cie = cie_chunks;
+ }
+ else
+ {
+ cie_prev->next = cie->next;
+ cie = cie->next;
+ }
+ /* cie_prev must remain unchanged. */
+ xfree (cie_tmp);
+ }
+ else
+ {
+ cie_prev = cie;
+ cie = cie->next;
+ }
+ }
+}
+
static void
unwind_tmp_obstack_init (void)
{
next prev parent reply other threads:[~2003-02-27 10:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-06 12:55 Michal Ludvig
2003-02-03 16:23 ` Elena Zannoni
2003-02-10 12:30 ` Michal Ludvig
2003-02-26 15:35 ` PING: " Michal Ludvig
2003-02-26 15:47 ` Daniel Jacobowitz
2003-02-26 18:20 ` Andrew Cagney
2003-02-26 18:36 ` Daniel Jacobowitz
2003-02-26 19:32 ` Andrew Cagney
2003-02-26 19:38 ` Daniel Jacobowitz
2003-02-27 8:14 ` Michal Ludvig
2003-02-27 10:15 ` Michal Ludvig [this message]
2003-02-27 14:17 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E5DE525.6040703@suse.cz \
--to=mludvig@suse.cz \
--cc=ac131313@redhat.com \
--cc=drow@mvista.com \
--cc=ezannoni@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox