GNU Binutils with patches for OS216
リビジョン | fc0a0c004a22e83600f3ecfe343fd6683fb70a7b (tree) |
---|---|
日時 | 2018-03-13 23:31:59 |
作者 | Yao Qi <yao.qi@lina...> |
コミッター | Yao Qi |
Throw exception in amd64 unwinders
This patch changes amd64 unwinders not to throw exceptions.
gdb:
2017-07-31 Yao Qi <yao.qi@linaro.org>
* amd64-tdep.c (amd64_frame_cache) <base_p>: Remove.
(amd64_init_frame_cache): Update.
(amd64_frame_cache_1): Update.
(amd64_frame_unwind_stop_reason): Don't check cache->base_p.
(amd64_frame_this_id): Likewise.
(amd64_sigtramp_frame_cache): Don't catch exception.
(amd64_sigtramp_frame_unwind_stop_reason): Don't check
cache->base_p.
(amd64_sigtramp_frame_this_id): Likewise.
(amd64_epilogue_frame_cache): Don't catch exception.
(amd64_epilogue_frame_unwind_stop_reason): Don't check
cache->base_p.
(amd64_epilogue_frame_this_id): Likewise.
@@ -1905,7 +1905,6 @@ struct amd64_frame_cache | ||
1905 | 1905 | { |
1906 | 1906 | /* Base address. */ |
1907 | 1907 | CORE_ADDR base; |
1908 | - int base_p; | |
1909 | 1908 | CORE_ADDR sp_offset; |
1910 | 1909 | CORE_ADDR pc; |
1911 | 1910 |
@@ -1927,7 +1926,6 @@ amd64_init_frame_cache (struct amd64_frame_cache *cache) | ||
1927 | 1926 | |
1928 | 1927 | /* Base address. */ |
1929 | 1928 | cache->base = 0; |
1930 | - cache->base_p = 0; | |
1931 | 1929 | cache->sp_offset = -8; |
1932 | 1930 | cache->pc = 0; |
1933 | 1931 |
@@ -2560,8 +2558,6 @@ amd64_frame_cache_1 (struct frame_info *this_frame, | ||
2560 | 2558 | for (i = 0; i < AMD64_NUM_SAVED_REGS; i++) |
2561 | 2559 | if (cache->saved_regs[i] != -1) |
2562 | 2560 | cache->saved_regs[i] += cache->base; |
2563 | - | |
2564 | - cache->base_p = 1; | |
2565 | 2561 | } |
2566 | 2562 | |
2567 | 2563 | static struct amd64_frame_cache * |
@@ -2575,16 +2571,7 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2575 | 2571 | cache = amd64_alloc_frame_cache (); |
2576 | 2572 | *this_cache = cache; |
2577 | 2573 | |
2578 | - TRY | |
2579 | - { | |
2580 | - amd64_frame_cache_1 (this_frame, cache); | |
2581 | - } | |
2582 | - CATCH (ex, RETURN_MASK_ERROR) | |
2583 | - { | |
2584 | - if (ex.error != NOT_AVAILABLE_ERROR) | |
2585 | - throw_exception (ex); | |
2586 | - } | |
2587 | - END_CATCH | |
2574 | + amd64_frame_cache_1 (this_frame, cache); | |
2588 | 2575 | |
2589 | 2576 | return cache; |
2590 | 2577 | } |
@@ -2596,9 +2583,6 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame, | ||
2596 | 2583 | struct amd64_frame_cache *cache = |
2597 | 2584 | amd64_frame_cache (this_frame, this_cache); |
2598 | 2585 | |
2599 | - if (!cache->base_p) | |
2600 | - return UNWIND_UNAVAILABLE; | |
2601 | - | |
2602 | 2586 | /* This marks the outermost frame. */ |
2603 | 2587 | if (cache->base == 0) |
2604 | 2588 | return UNWIND_OUTERMOST; |
@@ -2613,9 +2597,7 @@ amd64_frame_this_id (struct frame_info *this_frame, void **this_cache, | ||
2613 | 2597 | struct amd64_frame_cache *cache = |
2614 | 2598 | amd64_frame_cache (this_frame, this_cache); |
2615 | 2599 | |
2616 | - if (!cache->base_p) | |
2617 | - (*this_id) = frame_id_build_unavailable_stack (cache->pc); | |
2618 | - else if (cache->base == 0) | |
2600 | + if (cache->base == 0) | |
2619 | 2601 | { |
2620 | 2602 | /* This marks the outermost frame. */ |
2621 | 2603 | return; |
@@ -2693,26 +2675,15 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2693 | 2675 | |
2694 | 2676 | cache = amd64_alloc_frame_cache (); |
2695 | 2677 | |
2696 | - TRY | |
2697 | - { | |
2698 | - get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); | |
2699 | - cache->base = extract_unsigned_integer (buf, 8, byte_order) - 8; | |
2700 | - | |
2701 | - addr = tdep->sigcontext_addr (this_frame); | |
2702 | - gdb_assert (tdep->sc_reg_offset); | |
2703 | - gdb_assert (tdep->sc_num_regs <= AMD64_NUM_SAVED_REGS); | |
2704 | - for (i = 0; i < tdep->sc_num_regs; i++) | |
2705 | - if (tdep->sc_reg_offset[i] != -1) | |
2706 | - cache->saved_regs[i] = addr + tdep->sc_reg_offset[i]; | |
2678 | + get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); | |
2679 | + cache->base = extract_unsigned_integer (buf, 8, byte_order) - 8; | |
2707 | 2680 | |
2708 | - cache->base_p = 1; | |
2709 | - } | |
2710 | - CATCH (ex, RETURN_MASK_ERROR) | |
2711 | - { | |
2712 | - if (ex.error != NOT_AVAILABLE_ERROR) | |
2713 | - throw_exception (ex); | |
2714 | - } | |
2715 | - END_CATCH | |
2681 | + addr = tdep->sigcontext_addr (this_frame); | |
2682 | + gdb_assert (tdep->sc_reg_offset); | |
2683 | + gdb_assert (tdep->sc_num_regs <= AMD64_NUM_SAVED_REGS); | |
2684 | + for (i = 0; i < tdep->sc_num_regs; i++) | |
2685 | + if (tdep->sc_reg_offset[i] != -1) | |
2686 | + cache->saved_regs[i] = addr + tdep->sc_reg_offset[i]; | |
2716 | 2687 | |
2717 | 2688 | *this_cache = cache; |
2718 | 2689 | return cache; |
@@ -2725,9 +2696,6 @@ amd64_sigtramp_frame_unwind_stop_reason (struct frame_info *this_frame, | ||
2725 | 2696 | struct amd64_frame_cache *cache = |
2726 | 2697 | amd64_sigtramp_frame_cache (this_frame, this_cache); |
2727 | 2698 | |
2728 | - if (!cache->base_p) | |
2729 | - return UNWIND_UNAVAILABLE; | |
2730 | - | |
2731 | 2699 | return UNWIND_NO_REASON; |
2732 | 2700 | } |
2733 | 2701 |
@@ -2738,9 +2706,7 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame, | ||
2738 | 2706 | struct amd64_frame_cache *cache = |
2739 | 2707 | amd64_sigtramp_frame_cache (this_frame, this_cache); |
2740 | 2708 | |
2741 | - if (!cache->base_p) | |
2742 | - (*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame)); | |
2743 | - else if (cache->base == 0) | |
2709 | + if (cache->base == 0) | |
2744 | 2710 | { |
2745 | 2711 | /* This marks the outermost frame. */ |
2746 | 2712 | return; |
@@ -2870,30 +2836,19 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2870 | 2836 | cache = amd64_alloc_frame_cache (); |
2871 | 2837 | *this_cache = cache; |
2872 | 2838 | |
2873 | - TRY | |
2874 | - { | |
2875 | - /* Cache base will be %esp plus cache->sp_offset (-8). */ | |
2876 | - get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); | |
2877 | - cache->base = extract_unsigned_integer (buf, 8, | |
2878 | - byte_order) + cache->sp_offset; | |
2839 | + /* Cache base will be %esp plus cache->sp_offset (-8). */ | |
2840 | + get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); | |
2841 | + cache->base = extract_unsigned_integer (buf, 8, | |
2842 | + byte_order) + cache->sp_offset; | |
2879 | 2843 | |
2880 | - /* Cache pc will be the frame func. */ | |
2881 | - cache->pc = get_frame_pc (this_frame); | |
2844 | + /* Cache pc will be the frame func. */ | |
2845 | + cache->pc = get_frame_pc (this_frame); | |
2882 | 2846 | |
2883 | - /* The saved %esp will be at cache->base plus 16. */ | |
2884 | - cache->saved_sp = cache->base + 16; | |
2847 | + /* The saved %esp will be at cache->base plus 16. */ | |
2848 | + cache->saved_sp = cache->base + 16; | |
2885 | 2849 | |
2886 | - /* The saved %eip will be at cache->base plus 8. */ | |
2887 | - cache->saved_regs[AMD64_RIP_REGNUM] = cache->base + 8; | |
2888 | - | |
2889 | - cache->base_p = 1; | |
2890 | - } | |
2891 | - CATCH (ex, RETURN_MASK_ERROR) | |
2892 | - { | |
2893 | - if (ex.error != NOT_AVAILABLE_ERROR) | |
2894 | - throw_exception (ex); | |
2895 | - } | |
2896 | - END_CATCH | |
2850 | + /* The saved %eip will be at cache->base plus 8. */ | |
2851 | + cache->saved_regs[AMD64_RIP_REGNUM] = cache->base + 8; | |
2897 | 2852 | |
2898 | 2853 | return cache; |
2899 | 2854 | } |
@@ -2905,9 +2860,6 @@ amd64_epilogue_frame_unwind_stop_reason (struct frame_info *this_frame, | ||
2905 | 2860 | struct amd64_frame_cache *cache |
2906 | 2861 | = amd64_epilogue_frame_cache (this_frame, this_cache); |
2907 | 2862 | |
2908 | - if (!cache->base_p) | |
2909 | - return UNWIND_UNAVAILABLE; | |
2910 | - | |
2911 | 2863 | return UNWIND_NO_REASON; |
2912 | 2864 | } |
2913 | 2865 |
@@ -2919,10 +2871,7 @@ amd64_epilogue_frame_this_id (struct frame_info *this_frame, | ||
2919 | 2871 | struct amd64_frame_cache *cache = amd64_epilogue_frame_cache (this_frame, |
2920 | 2872 | this_cache); |
2921 | 2873 | |
2922 | - if (!cache->base_p) | |
2923 | - (*this_id) = frame_id_build_unavailable_stack (cache->pc); | |
2924 | - else | |
2925 | - (*this_id) = frame_id_build (cache->base + 8, cache->pc); | |
2874 | + (*this_id) = frame_id_build (cache->base + 8, cache->pc); | |
2926 | 2875 | } |
2927 | 2876 | |
2928 | 2877 | static const struct frame_unwind amd64_epilogue_frame_unwind = |