JuliaLang/julia — pull request #6490 by ihnorton (2014-04-10 15:12:50+00:00)
Title: RFC: Dump EmittedFunctionDetails to sysimage

This implements the serialization part of #5354. I will try to implement deserialization to the current `FuncInfo` / `EmittedFunctionDetails` (seems slightly awkward). Any suggestions appreciated.

Example:

```
g = cglobal(:jl_linedebug_info)
function pc(p::Ptr{Void}, count)
println("FuncInfo count: ", unsafe_load(reinterpret(Ptr{Int64},g)) )
ptrdiff = sizeof(Csize_t)
pos = p + ptrdiff
for i = 0:count-1
fname = bytestring(reinterpret(Ptr{Uint8},pos))
pos += length(fname)+1
lengthAdr = unsafe_load(reinterpret(Ptr{Int64},pos))
pos += ptrdiff
numel = unsafe_load(reinterpret(Ptr{Int64}, pos) )
pos += ptrdiff
println("Func: ", fname, " pos: ", pos)
println(" lengthAdr: ", lengthAdr, " numel: ", numel)
for j in 0:numel-1
println(" offset: ", unsafe_load(reinterpret(Ptr{Int64},pos)), " line: ", unsafe_load(reinterpret(Ptr{Int64},pos+ptrdiff)) )
pos += 2*ptrdiff
end
end
end

pc(g,10)
```

output:
```
Func: julia__delete!16341 pos: Ptr{Void} @0x00007ffff47d4d63
lengthAdr: 477 numel: 10
offset: 42 line: 624
offset: 75 line: 624
offset: 114 line: 625
offset: 207 line: 626
offset: 300 line: 627
offset: 304 line: 628
offset: 308 line: 629
offset: 360 line: 624
offset: 405 line: 625
offset: 435 line: 626
Func: julia_delete!16340 pos: Ptr{Void} @0x00007ffff47d4e26
lengthAdr: 195 numel: 6
offset: 32 line: 633
offset: 69 line: 633
offset: 92 line: 633
offset: 99 line: 633
offset: 130 line: 634
offset: 145 line: 635
```