Hello colleagues,

i think i've mentioned before: I'm not really a master on ccalls and the 
pointer/struct/Type architecture, so it might be obvious to someone else 
what's wrong here.
I'm doing a library adaptation (on libxcb.so), one of the major X11 
libraries to put literally everything on screen. Clang.jl helps me in some 
places, in some others, i manually convert c-structs and constants to julia 
constructions.

A got recently (input to debugging) very strange behavior, as executing the 
code in REPL steps works (at least doesn't fail), but as function sigfaults.


lobi@orange4:~/juliarepo$ ../julia04/julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+5208 (2015-06-04 23:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit e9fa25b* (19 days old master)
|__/                   |  x86_64-linux-gnu

julia> using XCB

julia> c = XCB.connect()
XCB.xcb_connection_t(Ptr{Void} @0x0000000002400af0)

julia> s0 = XCB.get_setup(c)
XCB.xcb_setup_t(0xf0,0xd8,0x0246,0x0000,0x0000,0x0246d8f0,0x00000000,
0x0246d8f0,0x00000000,0xd8c0,0x0246,0x00,0x00,0x00,0x00,0xc8,0x7c,0xc9,0x3a,
XCB.Array_4_Uint8(0xfc,0x7f,0x00,0x00))

julia> s = XCB.setup_roots_iterator(s0)
XCB.xcb_screen_iterator_t(Ptr{XCB.xcb_screen_t} @0x000000000247b968,0,57464)

julia> sc = unsafe_load(s.data)
XCB.xcb_screen_t(0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x02480030,0x00,0x00,0x00,0x00)

julia> id = XCB.generate_id(c)
0x02600000


whereas:

lobi@orange4:~/juliarepo$ ../julia04/julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+5208 (2015-06-04 23:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit e9fa25b* (19 days old master)
|__/                   |  x86_64-linux-gnu

julia> using XCB

julia> XCB.test0()

signal (11): Segmentation fault
test0 at /home/lobi/.julia/v0.4/XCB/src/XCB.jl:123
jlcall_test0_21005 at  (unknown line)
jl_apply_generic at /home/lobi/julia04/usr/bin/../lib/libjulia.so (unknown 
line)
unknown function (ip: -955646749)
unknown function (ip: -955649750)
unknown function (ip: -955571213)
jl_toplevel_eval_in at /home/lobi/julia04/usr/bin/../lib/libjulia.so (unknown 
line)
eval_user_input at REPL.jl:62
jlcall_eval_user_input_20884 at  (unknown line)
jl_apply_generic at /home/lobi/julia04/usr/bin/../lib/libjulia.so (unknown 
line)
anonymous at task.jl:91
unknown function (ip: -955622464)
unknown function (ip: 0)
Segmentation fault (core dumped)


with

function test0()
    
    c = connect()
  display(c)
  s0 = get_setup(c)
  display(s0)
    s = setup_roots_iterator(s0)
  display(s)
    sc = unsafe_load(s.data)
  display(sc)
    id = generate_id(c)
  #create_window(c,
  #  XCB_COPY_FROM_PARENT,id,sc.root,
  #  0,0,150,150,10,XCB_WINDOW_CLASS_INPUT_OUTPUT,sc.root_visual,0,C_NULL)
  c,s0,s,sc,id
  
end

Any idea?

Reply via email to