Comments (8)
Do you need to share them (reference them simultaneously from multiple Unit
s), or is it enough to be able to reuse the Abbreviations
from a previous Unit
that you've finished processing?
from gimli.
We are currently keeping all the Unit
s in memory because there might be cross-references I think.
This means that we canβt easily reuse the Abbreviations
from a previous Unit
. I wonder if we could lift that restriction at some point, but thus far we construct all the Unit
s lazily and keep them around.
from gimli.
See also getsentry/symbolic#683 for my workaround upstream. I essentially copied all of Unit::new
which is unfortunate.
Having a second constructor that takes Abbreviations
would make that workaround a bit less ugly. Then I can mem::swap
stuff around as I please to avoid the re-parsing.
from gimli.
This is really an interesting case and very much depends on the underlying DWARF data.
For my pathological case, there is only a single Abbreviations
table with ~1500 entries in debug_abbrev
that is shared by all CUs.
But other files (for example electron.debug) are rather duplicated and seem to have one abbreviation table per CU.
I think the second case already wastes bytes in the raw DWARF by not deduplicating these tables, but on the other hand is only parsing as much as needed in gimli (well, except for the abbrevs that are duplicated across CUs).
The first case however highlights a shortcoming in gimli as it is wasting a lot of cpu and memory to parse the complete Abbreviations
table for each CU, even though it could get away with only parsing a single one.
from gimli.
This is definitely a shortcoming in gimli, which I was aware of in the past and forgot about. It wasn't a problem before we added Dwarf
and Unit
.
mem::swap
sounds too error prone. You would need to swap every time before and after calling something that uses it.
Ideally there would be a reference to an abbreviations cache somewhere, perhaps in Dwarf
. I'm not sure how hard it will be to design the ownership for that though.
from gimli.
before and after calling something that uses it.
My current workaround is very brittle anyway in the sense that I very carefully avoided calling anything that uses it. Which means things can break easily in the future if people are not careful :-(
And yes, having an Abbreviations
cache in Dwarf
sounds like a good solution to me. But as you mentioned, ownership might be a pain there and either require some more lifetime parameters, or just going with Arc
.
from gimli.
@mstange suggested that it might be dsymutil that merges/deduplicates all the Abbreviations
, and indeed, the macOS dSYM for https://github.com/electron/electron/releases/tag/v20.1.4 only has a single Abbreviations
table with ~1100 entries. But it only has ~18k CUs which limits the combinatorial explosion.
My hack in getsentry/symbolic#683 to deduplicate the parsing speeds symcache_debug
up from ~26 -> ~18 seconds, and peak RSS from ~6.7 G -> ~2.6G, which are very good results.
from gimli.
Here's a dSYM with 1902 shared abbreviations and 9927 CUs, which can be used to test potential fixes: https://storage.googleapis.com/profiler-get-symbols-fixtures/XUL-E2C3444B769A3A1887EDA7C34A07A56C0.dSYM.tar.bz2
from gimli.
Related Issues (20)
- Integration with oss-fuzz fuzzing service HOT 3
- Any reason FrameDescriptionEntry::write is not public? HOT 8
- Read, modify, write? HOT 6
- Exclude fixtures when publishing the crate HOT 8
- Move examples to a separate crate
- Upgrade to indexmap 2? HOT 2
- Iterate over children of a DebuggingInformationEntry ? HOT 3
- UnknownCallFrameInstruction(DwCfa(45)) HOT 5
- Error "Found an abbreviation code that has already been used" HOT 6
- DW_AT_frame_base wrong calculation HOT 7
- `debug_assert!` problem for wasm-bindgen HOT 2
- The storage in `UnwindContext.stack` was changed to a `Vec` HOT 3
- Gimli cannot parse multiple units in aarch64 HOT 8
- Question: fuse units from Wasm files HOT 9
- UnwindContext allocation cannot be reused across multiple unwinds with changing data lifetimes HOT 1
- Can't parse this DWP file: InvalidIndexSlotCount
- Write example HOT 17
- Guidance on handling of relocations HOT 3
- Improve display of errors HOT 1
- docs: `CfaRule::Expression` no longer carries a `Reader`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gimli.