Hi

Does anyone have time to take a look at this test case..

# Example
g++ -m64 -o test test.s
~$ ./test
terminate called after throwing an instance of 'int'
Abort


There's some problem with the unwind tables, but I can't spot it.. Something is different between sol and linux that's causing this..

Thanks

./C


Original code
------------------------------
cat test.cpp

int main() {
   try {
       throw (int)10;
   }
   catch(int i) {
       return i;
   }
   return 0;
}
        .file   1       "/root/test.cpp"
        .text
        .align  2

        .section .except_table_supp, "a",@progbits

        .section .except_table, "a",@progbits
        .section .text
        .p2align 1,,

        # Program Unit: main
        .globl  main
        .protected      main
        .type   main, @function
main:   # 0x0
        # .frame        %rbp, 16, %rbp
        # reserved_spill_temp_0 = -8
        # gra_spill_temp_1 = -16
        .loc    1       2       0
 #   1  
 #   2  int main() {
.LBB1_main:
 #<freq>
 #<freq> BB:1 frequency = 1.00000 (heuristic)
 #<freq>
.LEH_pushbp_main:
        pushq %rbp                      # [0]  
.LEH_movespbp_main:
        movq %rsp,%rbp                  # [0]  
.LEH_adjustsp_main:
        addq $-16,%rsp                  # [0]  
        addq    $-8,%rsp
        fnstcw  (%rsp)
        andw    $0xfcff,(%rsp)
        orw     $768,(%rsp)
        fldcw   (%rsp)
        addq    $8,%rsp
        .loc    1       4       0
 #   3      try {
 #   4          throw (int)10;
        movq $4,%rdi                    # [0]  
        .globl  __cxa_allocate_exception
        call __cxa_allocate_exception   # [0]  __cxa_allocate_exception
.LBB3_main:
 #<freq>
 #<freq> BB:3 frequency = 1.00000 (heuristic)
 #<freq>
        movq %rax,%rdi                  # [0]  
        movl $10,%eax                   # [0]  
        movl %eax,0(%rdi)               # [1]  id:17
.L_0_3074:
 #<freq>
 #<freq> BB:4 frequency = 1.00000 (heuristic)
 #<freq>
        .globl  _ZTIi
        movq $(_ZTIi),%rsi              # [0]  _ZTIi
        xorq %rdx,%rdx                  # [0]  
        .globl  __cxa_throw
        call __cxa_throw                # [0]  __cxa_throw
.L_0_3330:
 #<freq>
 #<freq> BB:5 frequency = 1.00000 (heuristic)
 #<freq>
        xorq %rax,%rax                  # [0]  
        .loc    1       9       0
 #   5      }
 #   6      catch(int i) {
 #   7          return i;
 #   8      }
 #   9      return 0;
        leave                           # [0]  
        ret                             # [0]  
.L_0_3586:
 #<freq>
 #<freq> BB:8 frequency = 0.05969 (heuristic)
 #<freq>
        xorl %eax,%eax                  # [0]  
        .loc    1       4       0
        .globl  _Unwind_Resume
        call _Unwind_Resume             # [0]  _Unwind_Resume
.L_0_3842:
 #<freq>
 #<freq> BB:9 frequency = 0.00000 (heuristic)
 #<freq>
        .loc    1       7       0
        # .aproc        Handler.0.770
        .type   Handler.0.770, @function
Handler.0.770:  # 0x40
.Lt_0_770:
 #<freq>
 #<freq> BB:13 frequency = 0.10000 (heuristic)
 #<freq> BB:13 => BB:10 probability = 0.40310
 #<freq> BB:13 => BB:8 probability = 0.59690
 #<freq>
        .loc    1       4       0
        cmpq $1,%rdx                    # [0]  
        .loc    1       7       0
        movq %rax,%rdi                  # [1]  
        .loc    1       4       0
        jne .L_0_3586                   # [1]  
.Lt_0_258:
 #<freq>
 #<freq> BB:10 frequency = 0.04031 (heuristic)
 #<freq>
        .loc    1       6       0
        .weak   __cxa_begin_catch
        call __cxa_begin_catch          # [0]  __cxa_begin_catch
.LBB11_main:
 #<freq>
 #<freq> BB:11 frequency = 0.04031 (heuristic)
 #<freq>
        movl 0(%rax),%eax               # [0]  id:18
        movq %rax,-16(%rbp)             # [3]  gra_spill_temp_1
        .loc    1       7       0
        .weak   __cxa_end_catch
        call __cxa_end_catch            # [3]  __cxa_end_catch
.LBB12_main:
 #<freq>
 #<freq> BB:12 frequency = 0.04031 (heuristic)
 #<freq>
        movq -16(%rbp),%rax             # [0]  gra_spill_temp_1
        leave                           # [0]  
        ret                             # [0]  
.LDWend_main:
        .size main, .LDWend_main-main

        .section .except_table
        .align  0
        .type   .range_table.main, @object
.range_table.main:      # 0x0
        # offset 0
        .byte   255
        # offset 1
        .byte   0
        .uleb128        .LSDATTYPEB1-.LSDATTYPED1
.LSDATTYPED1:
        # offset 6
        .byte   1
        .uleb128        .LSDACSE1-.LSDACSB1
.LSDACSB1:
        .uleb128        .L_0_3074-main
        .uleb128        .L_0_3330-.L_0_3074
        .uleb128        .Lt_0_770-main
        # offset 19
        .uleb128        1
        .uleb128        .L_0_3586-main
        .uleb128        .L_0_3842-.L_0_3586
        # offset 29
        .uleb128        0
        # offset 33
        .uleb128        0
.LSDACSE1:
        # offset 37
        .sleb128        1
        # offset 41
        .sleb128        0
        # offset 45
        .sleb128        0
        # offset 49
        .sleb128        0
        .quad   _ZTIi +0
.LSDATTYPEB1:
        # end of initialization for .range_table.main
        .section .text
        .align  4
        .section .except_table_supp
        .align  4
        .section .except_table
        .align  8

        .section .eh_frame, "a",@progbits
.LEHCIE:
        .4byte  .LEHCIE_end - .LEHCIE_begin
.LEHCIE_begin:
        .4byte 0x0
        .byte   0x01, 0x7a, 0x50, 0x4c, 0x00, 0x01, 0x78, 0x10
        .byte   0x0a, 0x00
        .quad   __gxx_personality_v0
        .byte   0x00, 0x0c, 0x07, 0x08, 0x90, 0x01
        .align 8
.LEHCIE_end:
        .4byte  .LFDE1_end - .LFDE1_begin
.LFDE1_begin:
        .4byte  .LFDE1_begin - .LEHCIE
        .quad   .LBB1_main
        .quad   .LDWend_main - .LBB1_main
        .byte   0x08
        .quad   .range_table.main
        .byte   0x04
        .4byte  .LEH_movespbp_main - .LBB1_main
        .byte   0x0e, 0x10, 0x86, 0x02, 0x04
        .4byte  .LEH_adjustsp_main - .LEH_movespbp_main
        .byte   0x0d, 0x06
        .align 8
.LFDE1_end:

        .section .debug_line, ""
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.3 (csl-sol210-3_4-20050802)"
_______________________________________________
tools-compilers mailing list
[email protected]

Reply via email to