aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_ranges.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-20 14:23:26 +0200
committerBjörn Gustavsson <[email protected]>2017-10-20 14:23:26 +0200
commit4b8255e9217c293f84a1e96b3ae8034d089e815b (patch)
treed65914ea3e8c939a5a5a1d97a1a8f9c3b07f0cdb /erts/emulator/beam/beam_ranges.c
parent3ea750a53874d61ef7d4d806656ca63c7759a8a4 (diff)
parent806c2de5ca3806ad8110531c99749063e5603ac0 (diff)
downloadotp-4b8255e9217c293f84a1e96b3ae8034d089e815b.tar.gz
otp-4b8255e9217c293f84a1e96b3ae8034d089e815b.tar.bz2
otp-4b8255e9217c293f84a1e96b3ae8034d089e815b.zip
Merge branch 'maint'
* maint: Bump version of crash dumps to 0.4 Verify that binaries of different sizes are dumped correctly Don't dump literal areas that are not referenced at all Dump literals separately to avoid incomplete heap data Implement dumping of maps in crash dumps Buffer writing of crash dumps Conflicts: erts/emulator/beam/erl_alloc.types
Diffstat (limited to 'erts/emulator/beam/beam_ranges.c')
-rw-r--r--erts/emulator/beam/beam_ranges.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_ranges.c b/erts/emulator/beam/beam_ranges.c
index 6e373a3480..01bda7f3c1 100644
--- a/erts/emulator/beam/beam_ranges.c
+++ b/erts/emulator/beam/beam_ranges.c
@@ -32,6 +32,15 @@ typedef struct {
erts_atomic_t end; /* (BeamInstr*) Points one word beyond last function in module. */
} Range;
+/*
+ * Used for crash dumping of literals. The size of erts_dump_lit_areas is
+ * always twice the number of active ranges (to allow for literals in both
+ * current and old code).
+ */
+
+ErtsLiteralArea** erts_dump_lit_areas;
+Uint erts_dump_num_lit_areas;
+
/* Range 'end' needs to be atomic as we purge module
by setting end=start in active code_ix */
#define RANGE_END(R) ((BeamInstr*)erts_atomic_read_nob(&(R)->end))
@@ -97,6 +106,11 @@ erts_init_ranges(void)
r[i].allocated = 0;
erts_atomic_init_nob(&r[i].mid, 0);
}
+
+ erts_dump_num_lit_areas = 8;
+ erts_dump_lit_areas = (ErtsLiteralArea **)
+ erts_alloc(ERTS_ALC_T_CRASH_DUMP,
+ erts_dump_num_lit_areas * sizeof(ErtsLiteralArea*));
}
void
@@ -164,6 +178,14 @@ erts_end_staging_ranges(int commit)
erts_atomic_set_nob(&r[dst].mid,
(erts_aint_t) (r[dst].modules +
r[dst].n / 2));
+
+ if (r[dst].allocated * 2 > erts_dump_num_lit_areas) {
+ erts_dump_num_lit_areas *= 2;
+ erts_dump_lit_areas = (ErtsLiteralArea **)
+ erts_realloc(ERTS_ALC_T_CRASH_DUMP,
+ (void *) erts_dump_lit_areas,
+ erts_dump_num_lit_areas * sizeof(ErtsLiteralArea*));
+ }
}
}