@@ -221,11 +221,8 @@ impl ExceptionAction {
221
221
/// Returns whether this action has a destuctor reference or not.
222
222
pub fn has_dtor_ref ( & self ) -> bool {
223
223
match self . action_type {
224
- ExAction :: EndOfList => {
225
- println ! ( "Warning: null action passed" ) ;
226
- false
227
- }
228
- ExAction :: Branch
224
+ ExAction :: EndOfList
225
+ | ExAction :: Branch
229
226
| ExAction :: CatchBlock
230
227
| ExAction :: ActiveCatchBlock
231
228
| ExAction :: Terminate
@@ -626,37 +623,37 @@ impl ExceptionTableData {
626
623
match exaction_data {
627
624
ExActionData :: EndOfList => { }
628
625
ExActionData :: Branch { target_offset } => {
629
- line += format ! ( "Action: {target_offset:06X}" ) . as_str ( ) ;
626
+ line += format ! ( "Action: {target_offset:06X}\n " ) . as_str ( ) ;
630
627
}
631
628
ExActionData :: DestroyLocal { local_offset, .. } => {
632
- line += format ! ( "Local: {local_offset:#X}({local_reg_string})" ) . as_str ( ) ;
629
+ line += format ! ( "Local: {local_offset:#X}({local_reg_string})\n " ) . as_str ( ) ;
633
630
}
634
631
ExActionData :: DestroyLocalCond {
635
632
condition,
636
633
local_offset,
637
634
..
638
635
} => {
639
- line += format ! ( "Local: {local_offset:#X}({local_reg_string})" ) . as_str ( ) ;
636
+ line += format ! ( "Local: {local_offset:#X}({local_reg_string})\n " ) . as_str ( ) ;
640
637
641
638
//The action param is used to determine the type of reference for the condition (0: local offset, 1: register)
642
639
if action. action_param == 0 {
643
640
//Local offset
644
- line += format ! ( "\n Cond : {condition:#X}({local_reg_string})" ) . as_str ( ) ;
641
+ line += format ! ( "Cond : {condition:#X}({local_reg_string})\n " ) . as_str ( ) ;
645
642
} else {
646
643
//Register
647
644
//In this case, the local offset param is actually the register number
648
- line += format ! ( "\n Cond : r{condition}" ) . as_str ( ) ;
645
+ line += format ! ( "Cond : r{condition}\n " ) . as_str ( ) ;
649
646
}
650
647
}
651
648
ExActionData :: DestroyLocalPointer { local_pointer, .. } => {
652
649
let mode = action. action_param >> 7 ;
653
650
if mode == 0 {
654
651
//Local offset
655
652
line +=
656
- format ! ( "Pointer: {local_pointer:#X}({local_reg_string})" ) . as_str ( ) ;
653
+ format ! ( "Pointer: {local_pointer:#X}({local_reg_string})\n " ) . as_str ( ) ;
657
654
} else {
658
655
//Register
659
- line += format ! ( "Pointer: r{local_pointer}" ) . as_str ( ) ;
656
+ line += format ! ( "Pointer: r{local_pointer}\n " ) . as_str ( ) ;
660
657
}
661
658
}
662
659
ExActionData :: DestroyLocalArray {
@@ -665,7 +662,7 @@ impl ExceptionTableData {
665
662
element_size,
666
663
..
667
664
} => {
668
- line += format ! ( "Array: {local_array:#X}({local_reg_string})\n Elements: {elements}\n Size: {element_size}" ) . as_str ( ) ;
665
+ line += format ! ( "Array: {local_array:#X}({local_reg_string})\n Elements: {elements}\n Size: {element_size}\n " ) . as_str ( ) ;
669
666
}
670
667
ExActionData :: DestroyBase {
671
668
object_pointer,
@@ -674,10 +671,10 @@ impl ExceptionTableData {
674
671
} => {
675
672
let mode = action. action_param >> 7 ;
676
673
if mode == 0 {
677
- line += format ! ( "Member: {object_pointer:#X}({local_reg_string})+{member_offset:#X}" ) . as_str ( ) ;
674
+ line += format ! ( "Member: {object_pointer:#X}({local_reg_string})+{member_offset:#X}\n " ) . as_str ( ) ;
678
675
} else {
679
676
line +=
680
- format ! ( "Member: {member_offset:#X}(r{object_pointer})" ) . as_str ( ) ;
677
+ format ! ( "Member: {member_offset:#X}(r{object_pointer})\n " ) . as_str ( ) ;
681
678
}
682
679
}
683
680
ExActionData :: DestroyMember {
@@ -687,10 +684,10 @@ impl ExceptionTableData {
687
684
} => {
688
685
let mode = action. action_param >> 7 ;
689
686
if mode == 0 {
690
- line += format ! ( "Member: {object_pointer:#X}({local_reg_string})+{member_offset:#X}" ) . as_str ( ) ;
687
+ line += format ! ( "Member: {object_pointer:#X}({local_reg_string})+{member_offset:#X}\n " ) . as_str ( ) ;
691
688
} else {
692
689
line +=
693
- format ! ( "Member: {member_offset:#X}(r{object_pointer})" ) . as_str ( ) ;
690
+ format ! ( "Member: {member_offset:#X}(r{object_pointer})\n " ) . as_str ( ) ;
694
691
}
695
692
}
696
693
ExActionData :: DestroyMemberCond {
@@ -701,19 +698,19 @@ impl ExceptionTableData {
701
698
} => {
702
699
let mode = ( action. action_param >> 6 ) & 1 ;
703
700
if mode == 0 {
704
- line += format ! ( "Member: {object_pointer:#X}({local_reg_string})+{member_offset:#X}" ) . as_str ( ) ;
701
+ line += format ! ( "Member: {object_pointer:#X}({local_reg_string})+{member_offset:#X}\n " ) . as_str ( ) ;
705
702
} else {
706
703
//Register
707
704
line +=
708
- format ! ( "Member: {member_offset:#X}(r{object_pointer})" ) . as_str ( ) ;
705
+ format ! ( "Member: {member_offset:#X}(r{object_pointer})\n " ) . as_str ( ) ;
709
706
}
710
707
let condition_mode = action. action_param >> 7 ;
711
708
if condition_mode == 0 {
712
709
//Local offset
713
- line += format ! ( "\n Cond : {condition:#X}({local_reg_string})" ) . as_str ( ) ;
710
+ line += format ! ( "Cond : {condition:#X}({local_reg_string})\n " ) . as_str ( ) ;
714
711
} else {
715
712
//Register
716
- line += format ! ( "\n Cond : r{condition}" ) . as_str ( ) ;
713
+ line += format ! ( "Cond : r{condition}\n " ) . as_str ( ) ;
717
714
}
718
715
}
719
716
ExActionData :: DestroyMemberArray {
@@ -727,25 +724,25 @@ impl ExceptionTableData {
727
724
if mode == 0 {
728
725
//Local offset
729
726
line += format ! (
730
- "Member: {object_pointer:#X}({local_reg_string})+0x{member_offset}"
727
+ "Member: {object_pointer:#X}({local_reg_string})+0x{member_offset}\n "
731
728
)
732
729
. as_str ( ) ;
733
730
} else {
734
731
//Register
735
732
line +=
736
- format ! ( "Member: {member_offset:#X}(r{object_pointer})" ) . as_str ( ) ;
733
+ format ! ( "Member: {member_offset:#X}(r{object_pointer})\n " ) . as_str ( ) ;
737
734
}
738
- line += format ! ( "\n Elements : {elements}\n Size: {element_size}" ) . as_str ( ) ;
735
+ line += format ! ( "Elements : {elements}\n Size: {element_size}\n " ) . as_str ( ) ;
739
736
}
740
737
ExActionData :: DeletePointer { object_pointer, .. } => {
741
738
let mode = action. action_param >> 7 ;
742
739
if mode == 0 {
743
740
//Local offset
744
- line += format ! ( "Pointer: {object_pointer:#X}({local_reg_string})" )
741
+ line += format ! ( "Pointer: {object_pointer:#X}({local_reg_string})\n " )
745
742
. as_str ( ) ;
746
743
} else {
747
744
//Register
748
- line += format ! ( "Pointer: r{object_pointer})" ) . as_str ( ) ;
745
+ line += format ! ( "Pointer: r{object_pointer})\n " ) . as_str ( ) ;
749
746
}
750
747
}
751
748
ExActionData :: DeletePointerCond {
@@ -756,19 +753,19 @@ impl ExceptionTableData {
756
753
let mode = ( action. action_param >> 6 ) & 1 ;
757
754
if mode == 0 {
758
755
//Local offset
759
- line += format ! ( "Pointer: {object_pointer:#X}({local_reg_string})" )
756
+ line += format ! ( "Pointer: {object_pointer:#X}({local_reg_string})\n " )
760
757
. as_str ( ) ;
761
758
} else {
762
759
//Register
763
- line += format ! ( "Pointer: r{object_pointer})" ) . as_str ( ) ;
760
+ line += format ! ( "Pointer: r{object_pointer})\n " ) . as_str ( ) ;
764
761
}
765
762
let condition_mode = action. action_param >> 7 ;
766
763
if condition_mode == 0 {
767
764
//Local offset
768
- line += format ! ( "\n Cond : {condition:#X}({local_reg_string})" ) . as_str ( ) ;
765
+ line += format ! ( "Cond : {condition:#X}({local_reg_string})\n " ) . as_str ( ) ;
769
766
} else {
770
767
//Register
771
- line += format ! ( "\n Cond : r{condition}" ) . as_str ( ) ;
768
+ line += format ! ( "Cond : r{condition}\n " ) . as_str ( ) ;
772
769
}
773
770
}
774
771
ExActionData :: CatchBlock {
@@ -777,10 +774,10 @@ impl ExceptionTableData {
777
774
cinfo_ref,
778
775
..
779
776
} => {
780
- line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})\n PC: {catch_pc_offset:08X}\n catch_type_addr: {catch_type:08X}" ) . as_str ( ) ;
777
+ line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})\n PC: {catch_pc_offset:08X}\n catch_type_addr: {catch_type:08X}\n " ) . as_str ( ) ;
781
778
}
782
779
ExActionData :: ActiveCatchBlock { cinfo_ref } => {
783
- line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})" ) . as_str ( ) ;
780
+ line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})\n " ) . as_str ( ) ;
784
781
}
785
782
ExActionData :: Terminate => { }
786
783
ExActionData :: Specification {
@@ -789,15 +786,15 @@ impl ExceptionTableData {
789
786
cinfo_ref,
790
787
..
791
788
} => {
792
- line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})\n PC: {pc_offset:08X}\n Types: {specs}" ) . as_str ( ) ;
789
+ line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})\n PC: {pc_offset:08X}\n Types: {specs}\n " ) . as_str ( ) ;
793
790
}
794
791
ExActionData :: CatchBlock32 {
795
792
catch_type,
796
793
catch_pc_offset,
797
794
cinfo_ref,
798
795
..
799
796
} => {
800
- line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})\n PC: {catch_pc_offset:08X}\n catch_type_addr: {catch_type:08X}" ) . as_str ( ) ;
797
+ line += format ! ( "Local: {cinfo_ref:#X}({local_reg_string})\n PC: {catch_pc_offset:08X}\n catch_type_addr: {catch_type:08X}\n " ) . as_str ( ) ;
801
798
}
802
799
}
803
800
@@ -808,14 +805,13 @@ impl ExceptionTableData {
808
805
return None ;
809
806
}
810
807
let func_name = func_names[ func_index] . as_str ( ) ;
811
- line += format ! ( "\n Dtor : \" {func_name}\" " ) . as_str ( ) ;
808
+ line += format ! ( "Dtor : \" {func_name}\" \n " ) . as_str ( ) ;
812
809
func_index += 1 ;
813
810
}
814
811
815
812
if action. has_end_bit {
816
- line += "."
817
- } ; //Add a dot to the end if the has end bit flag is set
818
- line += "\n " ;
813
+ line += "Has end bit\n "
814
+ } ;
819
815
sb += line. as_str ( ) ; //Print the line
820
816
}
821
817
}
0 commit comments