diff options
author | Björn Gustavsson <[email protected]> | 2017-10-20 14:07:29 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-10-20 14:07:29 +0200 |
commit | 806c2de5ca3806ad8110531c99749063e5603ac0 (patch) | |
tree | e340c1edd12135e1413a2eb890eb2773a17ffe02 /erts/emulator/beam/beam_ranges.c | |
parent | 202d62c473e00fd066a70c85ba1d5c26ef2607a1 (diff) | |
parent | 7f8e605b242913b6f58f008aaa27a2edd1ab94b2 (diff) | |
download | otp-806c2de5ca3806ad8110531c99749063e5603ac0.tar.gz otp-806c2de5ca3806ad8110531c99749063e5603ac0.tar.bz2 otp-806c2de5ca3806ad8110531c99749063e5603ac0.zip |
Merge branch 'bjorn/improve-crash-dumps/OTP-14685' into maint
* bjorn/improve-crash-dumps/OTP-14685:
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
Diffstat (limited to 'erts/emulator/beam/beam_ranges.c')
-rw-r--r-- | erts/emulator/beam/beam_ranges.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_ranges.c b/erts/emulator/beam/beam_ranges.c index 9b0335e83d..fac4289271 100644 --- a/erts/emulator/beam/beam_ranges.c +++ b/erts/emulator/beam/beam_ranges.c @@ -32,6 +32,15 @@ typedef struct { erts_smp_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_smp_atomic_read_nob(&(R)->end)) @@ -97,6 +106,11 @@ erts_init_ranges(void) r[i].allocated = 0; erts_smp_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_smp_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*)); + } } } |