aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-09-26 11:49:38 +0200
committerBjörn Gustavsson <[email protected]>2012-09-26 11:49:38 +0200
commit88b22baff3dbe0bf672fe1c96131ff707c888bcf (patch)
tree7a57307953bdf72eca17df09d33da6d63dcbcf2b
parent7a594dd7b4616176e774ed7e78267805d237d0a8 (diff)
downloadotp-88b22baff3dbe0bf672fe1c96131ff707c888bcf.tar.gz
otp-88b22baff3dbe0bf672fe1c96131ff707c888bcf.tar.bz2
otp-88b22baff3dbe0bf672fe1c96131ff707c888bcf.zip
Fix missing information in crash dump for native-compiled modules
In the erl_crash.dump file, native-compiled modules did not have any information about attributes and compilation. The problem is that the code:make_stub_module/3 BIF (which is internally used when native code is loaded) did not copy the size field the attribute and compilation info chunks. Those size fields are only used when writing crash dumps.
-rw-r--r--erts/emulator/beam/beam_load.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index d3f55a2ba4..25ae480dc7 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -5527,7 +5527,8 @@ stub_copy_info(LoaderState* stp,
int chunk, /* Chunk: ATTR_CHUNK or COMPILE_CHUNK */
byte* info, /* Where to store info. */
BeamInstr* ptr_word, /* Where to store pointer into info. */
- BeamInstr* size_word) /* Where to store size of info. */
+ BeamInstr* size_word, /* Where to store size into info. */
+ BeamInstr* size_on_heap_word) /* Where to store size on heap. */
{
Sint decoded_size;
Uint size = stp->chunks[chunk].size;
@@ -5538,7 +5539,8 @@ stub_copy_info(LoaderState* stp,
if (decoded_size < 0) {
return 0;
}
- *size_word = decoded_size;
+ *size_word = (BeamInstr) size;
+ *size_on_heap_word = decoded_size;
}
return info + size;
}
@@ -5960,12 +5962,16 @@ erts_make_stub_module(Process* p, Eterm Mod, Eterm Beam, Eterm Info)
info = (byte *) fp;
info = stub_copy_info(stp, ATTR_CHUNK, info,
- code+MI_ATTR_PTR, code+MI_ATTR_SIZE_ON_HEAP);
+ code+MI_ATTR_PTR,
+ code+MI_ATTR_SIZE,
+ code+MI_ATTR_SIZE_ON_HEAP);
if (info == NULL) {
goto error;
}
info = stub_copy_info(stp, COMPILE_CHUNK, info,
- code+MI_COMPILE_PTR, code+MI_COMPILE_SIZE_ON_HEAP);
+ code+MI_COMPILE_PTR,
+ code+MI_COMPILE_SIZE,
+ code+MI_COMPILE_SIZE_ON_HEAP);
if (info == NULL) {
goto error;
}