comp.lang.ada
 help / color / mirror / Atom feed
* Stumped: Seg Fault with System.Secondary_Stack.SS_Mark()
@ 2012-09-06 19:34 awdorrin
  2012-09-06 19:57 ` Ludovic Brenta
  0 siblings, 1 reply; 14+ messages in thread
From: awdorrin @ 2012-09-06 19:34 UTC (permalink / raw)


I am getting some random seg faults from my program:

system.secondary_stack.ss_mark () at s-secsta.adb:467

and I'm at a loss for what is going on. I'm guessing that GNAT thinks the stack is bad when the call is made.

The backtrace of my code is:

#0  system.secondary_stack.ss_mark () at s-secsta.adb:467
#1  0x081ec693 in r_de.get_de_int (de_num=79500, to_unit=none)
    at /home/aldorr/lasis/code/rtsim/rde_b.ada:2288
#2  0x081244b8 in g_sv.svs_get_value (svs_num=79500) at ../code/common/gsv_b.ada:172
#3  0x082e867b in sc_mfr.execute () at ../code/sensor/comm/scmfr_b.ada:4627
#4  0x080ff25f in execute_senctl () at ../code/rtctl/esnctl_b.ada:589
#5  0x08050fe2 in e_sequencer (e_cycle_count=56707) at e_seq.c:511
#6  0x080efb92 in e_mainline.exec_subfunctions () at ../code/rtctl/e_mainline_b.ada:453
#7  0x080f044e in e_mainline.exec_main_line_normal () at ../code/rtctl/e_mainline_b.ada:697
#8  0x080ee726 in e_mainline () at ../code/rtctl/e_mainline_b.ada:771
#9  0x080536ba in rtctl_rts () at gosim.c:380
#10 0xb7a198a6 in task_wrapper (task=0x8aa5310) at ltaskLib.c:669
#11 0xb7fba955 in start_thread (arg=0xb663fb70) at pthread_create.c:300
#12 0xb797c5ee in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Looking at the assembly at Frame 1:

0x81ec677 <r_de__get_de_int>    push   %ebp
0x81ec678 <r_de__get_de_int+1>  mov    %esp,%ebp
0x81ec67a <r_de__get_de_int+3>  push   %esi
0x81ec67b <r_de__get_de_int+4>  push   %ebx
0x81ec67c <r_de__get_de_int+5>  sub    $0xb0,%esp
0x81ec682 <r_de__get_de_int+11> mov    0xc(%ebp),%eax
0x81ec685 <r_de__get_de_int+14> mov    %al,-0x5c(%ebp)
0x81ec688 <r_de__get_de_int+17> lea    -0x68(%ebp),%eax
0x81ec68b <r_de__get_de_int+20> mov    %eax,(%esp)
0x81ec68e <r_de__get_de_int+23> call   0x804e908 <system__secondary_stack__ss_mark@plt> 
0x81ec693 <r_de__get_de_int+28> sub    $0x4,%esp  

Then the assembly at Frame 0:

0xb7e180e0 <system__secondary_stack__ss_mark>           push   %ebp
0xb7e180e1 <system__secondary_stack__ss_mark+1>         mov    %esp,%ebp
0xb7e180e3 <system__secondary_stack__ss_mark+3>         sub    $0x8,%esp
0xb7e180e6 <system__secondary_stack__ss_mark+6>         mov    %ebx,(%esp)
0xb7e180e9 <system__secondary_stack__ss_mark+9>         call   0xb7cb0ca7 <__i686.get_pc_thunk.bx>
0xb7e180ee <system__secondary_stack__ss_mark+14>        add    $0x9748a,%ebx
0xb7e180f4 <system__secondary_stack__ss_mark+20>        mov    %esi,0x4(%esp)
0xb7e180f8 <system__secondary_stack__ss_mark+24>        mov    0x8(%ebp),%esi
0xb7e180fb <system__secondary_stack__ss_mark+27>        mov    -0x298(%ebx),%eax
0xb7e18101 <system__secondary_stack__ss_mark+33>        call   *(%eax)
0xb7e18103 <system__secondary_stack__ss_mark+35>        mov    (%eax),%edx

I can tell that the 'GET_DE_INT' function call hasn't even gotten to the first line of code within the function, but I'm really not sure what is going on. The data structures themselves look fine. So I'm not sure if GNAT thinks I'm blowing the stack, or what.

My assembly knowledge is more than a little rusty... :)

The corresponding Ada code is:
Frame 2:

DE_NUM := R_DE.DE_NUM_TYPE'val(SVS_NUM);
TEMP   := R_DE.GET_DE_INT(DE_NUM);

Then in Frame 1:

function GET_DE_INT
  (DE_NUM: DE_NUM_TYPE;
   TO_UNIT : R_CONVERT.UNIT_TYPE := R_CONVERT.NONE )
  return INT32 is
  DE_VAL_FLT : FLOAT64;
  RC : INT32;
begin
  GET_DE( DE_NUM, DE_DATA(DE_NUM).ADDR, TO_UNIT, DE_VAL_FLT, RC );


At the time of the crash, I don't think the GET_DE_INT function has even gotten as far as validating the parameters (since I see some __gnat_rcheck calls further down in the assembly code)

Anyone have any suggestions on what I can look at?

Thanks!



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-09-14 17:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-06 19:34 Stumped: Seg Fault with System.Secondary_Stack.SS_Mark() awdorrin
2012-09-06 19:57 ` Ludovic Brenta
2012-09-06 20:53   ` awdorrin
2012-09-06 21:18     ` Ludovic Brenta
2012-09-06 22:13       ` awdorrin
2012-09-07 14:38         ` awdorrin
2012-09-07 14:55           ` Ludovic Brenta
2012-09-07 15:35           ` Simon Wright
2012-09-07 16:18             ` awdorrin
2012-09-07 16:31               ` awdorrin
2012-09-07 17:07                 ` Simon Wright
2012-09-07 17:50                   ` awdorrin
2012-09-08 13:23                     ` francois_fabien
2012-09-10 13:50                       ` awdorrin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox