GNU Binutils with patches for OS216
Revision | a11bf1279d0663741015f64238b3394081d463fb (tree) |
---|---|
Time | 2018-03-13 23:31:59 |
Author | Yao Qi <yao.qi@lina...> |
Commiter | Yao Qi |
Throw exception in i386 unwinders
This patch changes i386 unwinders not to throw exceptions.
gdb:
2017-07-31 Yao Qi <yao.qi@linaro.org>
* i386-tdep.c (i386_frame_cache) <base_p>: Remove.
(i386_alloc_frame_cache): Update.
(i386_frame_cache_1): Likewise.
(i386_frame_cache): Don't catch exceptions.
(i386_frame_this_id): Don't check cache->base_p.
(i386_frame_unwind_stop_reason): Likewise.
(i386_epilogue_frame_cache): Don't catch exceptions.
(i386_epilogue_frame_unwind_stop_reason): Don't check
cache->base_p.
(i386_epilogue_frame_this_id): Likewise.
(i386_sigtramp_frame_cache): Don't catch exceptions.
(i386_sigtramp_frame_unwind_stop_reason): Don't check
cache->base_p.
(i386_sigtramp_frame_this_id): Likewise.
@@ -1069,7 +1069,6 @@ struct i386_frame_cache | ||
1069 | 1069 | { |
1070 | 1070 | /* Base address. */ |
1071 | 1071 | CORE_ADDR base; |
1072 | - int base_p; | |
1073 | 1072 | LONGEST sp_offset; |
1074 | 1073 | CORE_ADDR pc; |
1075 | 1074 |
@@ -1094,7 +1093,6 @@ i386_alloc_frame_cache (void) | ||
1094 | 1093 | cache = FRAME_OBSTACK_ZALLOC (struct i386_frame_cache); |
1095 | 1094 | |
1096 | 1095 | /* Base address. */ |
1097 | - cache->base_p = 0; | |
1098 | 1096 | cache->base = 0; |
1099 | 1097 | cache->sp_offset = -4; |
1100 | 1098 | cache->pc = 0; |
@@ -1992,10 +1990,7 @@ i386_frame_cache_1 (struct frame_info *this_frame, | ||
1992 | 1990 | get_frame_register (this_frame, I386_EBP_REGNUM, buf); |
1993 | 1991 | cache->base = extract_unsigned_integer (buf, 4, byte_order); |
1994 | 1992 | if (cache->base == 0) |
1995 | - { | |
1996 | - cache->base_p = 1; | |
1997 | - return; | |
1998 | - } | |
1993 | + return; | |
1999 | 1994 | |
2000 | 1995 | /* For normal frames, %eip is stored at 4(%ebp). */ |
2001 | 1996 | cache->saved_regs[I386_EIP_REGNUM] = 4; |
@@ -2066,8 +2061,6 @@ i386_frame_cache_1 (struct frame_info *this_frame, | ||
2066 | 2061 | for (i = 0; i < I386_NUM_SAVED_REGS; i++) |
2067 | 2062 | if (cache->saved_regs[i] != -1) |
2068 | 2063 | cache->saved_regs[i] += cache->base; |
2069 | - | |
2070 | - cache->base_p = 1; | |
2071 | 2064 | } |
2072 | 2065 | |
2073 | 2066 | static struct i386_frame_cache * |
@@ -2081,16 +2074,7 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2081 | 2074 | cache = i386_alloc_frame_cache (); |
2082 | 2075 | *this_cache = cache; |
2083 | 2076 | |
2084 | - TRY | |
2085 | - { | |
2086 | - i386_frame_cache_1 (this_frame, cache); | |
2087 | - } | |
2088 | - CATCH (ex, RETURN_MASK_ERROR) | |
2089 | - { | |
2090 | - if (ex.error != NOT_AVAILABLE_ERROR) | |
2091 | - throw_exception (ex); | |
2092 | - } | |
2093 | - END_CATCH | |
2077 | + i386_frame_cache_1 (this_frame, cache); | |
2094 | 2078 | |
2095 | 2079 | return cache; |
2096 | 2080 | } |
@@ -2101,9 +2085,7 @@ i386_frame_this_id (struct frame_info *this_frame, void **this_cache, | ||
2101 | 2085 | { |
2102 | 2086 | struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache); |
2103 | 2087 | |
2104 | - if (!cache->base_p) | |
2105 | - (*this_id) = frame_id_build_unavailable_stack (cache->pc); | |
2106 | - else if (cache->base == 0) | |
2088 | + if (cache->base == 0) | |
2107 | 2089 | { |
2108 | 2090 | /* This marks the outermost frame. */ |
2109 | 2091 | } |
@@ -2120,9 +2102,6 @@ i386_frame_unwind_stop_reason (struct frame_info *this_frame, | ||
2120 | 2102 | { |
2121 | 2103 | struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache); |
2122 | 2104 | |
2123 | - if (!cache->base_p) | |
2124 | - return UNWIND_UNAVAILABLE; | |
2125 | - | |
2126 | 2105 | /* This marks the outermost frame. */ |
2127 | 2106 | if (cache->base == 0) |
2128 | 2107 | return UNWIND_OUTERMOST; |
@@ -2251,26 +2230,15 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2251 | 2230 | cache = i386_alloc_frame_cache (); |
2252 | 2231 | *this_cache = cache; |
2253 | 2232 | |
2254 | - TRY | |
2255 | - { | |
2256 | - cache->pc = get_frame_func (this_frame); | |
2233 | + cache->pc = get_frame_func (this_frame); | |
2257 | 2234 | |
2258 | - /* At this point the stack looks as if we just entered the | |
2259 | - function, with the return address at the top of the | |
2260 | - stack. */ | |
2261 | - sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM); | |
2262 | - cache->base = sp + cache->sp_offset; | |
2263 | - cache->saved_sp = cache->base + 8; | |
2264 | - cache->saved_regs[I386_EIP_REGNUM] = cache->base + 4; | |
2265 | - | |
2266 | - cache->base_p = 1; | |
2267 | - } | |
2268 | - CATCH (ex, RETURN_MASK_ERROR) | |
2269 | - { | |
2270 | - if (ex.error != NOT_AVAILABLE_ERROR) | |
2271 | - throw_exception (ex); | |
2272 | - } | |
2273 | - END_CATCH | |
2235 | + /* At this point the stack looks as if we just entered the | |
2236 | + function, with the return address at the top of the | |
2237 | + stack. */ | |
2238 | + sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM); | |
2239 | + cache->base = sp + cache->sp_offset; | |
2240 | + cache->saved_sp = cache->base + 8; | |
2241 | + cache->saved_regs[I386_EIP_REGNUM] = cache->base + 4; | |
2274 | 2242 | |
2275 | 2243 | return cache; |
2276 | 2244 | } |
@@ -2282,9 +2250,6 @@ i386_epilogue_frame_unwind_stop_reason (struct frame_info *this_frame, | ||
2282 | 2250 | struct i386_frame_cache *cache = |
2283 | 2251 | i386_epilogue_frame_cache (this_frame, this_cache); |
2284 | 2252 | |
2285 | - if (!cache->base_p) | |
2286 | - return UNWIND_UNAVAILABLE; | |
2287 | - | |
2288 | 2253 | return UNWIND_NO_REASON; |
2289 | 2254 | } |
2290 | 2255 |
@@ -2296,10 +2261,7 @@ i386_epilogue_frame_this_id (struct frame_info *this_frame, | ||
2296 | 2261 | struct i386_frame_cache *cache = |
2297 | 2262 | i386_epilogue_frame_cache (this_frame, this_cache); |
2298 | 2263 | |
2299 | - if (!cache->base_p) | |
2300 | - (*this_id) = frame_id_build_unavailable_stack (cache->pc); | |
2301 | - else | |
2302 | - (*this_id) = frame_id_build (cache->base + 8, cache->pc); | |
2264 | + (*this_id) = frame_id_build (cache->base + 8, cache->pc); | |
2303 | 2265 | } |
2304 | 2266 | |
2305 | 2267 | static struct value * |
@@ -2437,36 +2399,25 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2437 | 2399 | |
2438 | 2400 | cache = i386_alloc_frame_cache (); |
2439 | 2401 | |
2440 | - TRY | |
2441 | - { | |
2442 | - get_frame_register (this_frame, I386_ESP_REGNUM, buf); | |
2443 | - cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4; | |
2402 | + get_frame_register (this_frame, I386_ESP_REGNUM, buf); | |
2403 | + cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4; | |
2444 | 2404 | |
2445 | - addr = tdep->sigcontext_addr (this_frame); | |
2446 | - if (tdep->sc_reg_offset) | |
2447 | - { | |
2448 | - int i; | |
2405 | + addr = tdep->sigcontext_addr (this_frame); | |
2406 | + if (tdep->sc_reg_offset) | |
2407 | + { | |
2408 | + int i; | |
2449 | 2409 | |
2450 | - gdb_assert (tdep->sc_num_regs <= I386_NUM_SAVED_REGS); | |
2410 | + gdb_assert (tdep->sc_num_regs <= I386_NUM_SAVED_REGS); | |
2451 | 2411 | |
2452 | - for (i = 0; i < tdep->sc_num_regs; i++) | |
2453 | - if (tdep->sc_reg_offset[i] != -1) | |
2454 | - cache->saved_regs[i] = addr + tdep->sc_reg_offset[i]; | |
2455 | - } | |
2456 | - else | |
2457 | - { | |
2458 | - cache->saved_regs[I386_EIP_REGNUM] = addr + tdep->sc_pc_offset; | |
2459 | - cache->saved_regs[I386_ESP_REGNUM] = addr + tdep->sc_sp_offset; | |
2460 | - } | |
2461 | - | |
2462 | - cache->base_p = 1; | |
2412 | + for (i = 0; i < tdep->sc_num_regs; i++) | |
2413 | + if (tdep->sc_reg_offset[i] != -1) | |
2414 | + cache->saved_regs[i] = addr + tdep->sc_reg_offset[i]; | |
2463 | 2415 | } |
2464 | - CATCH (ex, RETURN_MASK_ERROR) | |
2416 | + else | |
2465 | 2417 | { |
2466 | - if (ex.error != NOT_AVAILABLE_ERROR) | |
2467 | - throw_exception (ex); | |
2418 | + cache->saved_regs[I386_EIP_REGNUM] = addr + tdep->sc_pc_offset; | |
2419 | + cache->saved_regs[I386_ESP_REGNUM] = addr + tdep->sc_sp_offset; | |
2468 | 2420 | } |
2469 | - END_CATCH | |
2470 | 2421 | |
2471 | 2422 | *this_cache = cache; |
2472 | 2423 | return cache; |
@@ -2479,9 +2430,6 @@ i386_sigtramp_frame_unwind_stop_reason (struct frame_info *this_frame, | ||
2479 | 2430 | struct i386_frame_cache *cache = |
2480 | 2431 | i386_sigtramp_frame_cache (this_frame, this_cache); |
2481 | 2432 | |
2482 | - if (!cache->base_p) | |
2483 | - return UNWIND_UNAVAILABLE; | |
2484 | - | |
2485 | 2433 | return UNWIND_NO_REASON; |
2486 | 2434 | } |
2487 | 2435 |
@@ -2492,13 +2440,8 @@ i386_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, | ||
2492 | 2440 | struct i386_frame_cache *cache = |
2493 | 2441 | i386_sigtramp_frame_cache (this_frame, this_cache); |
2494 | 2442 | |
2495 | - if (!cache->base_p) | |
2496 | - (*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame)); | |
2497 | - else | |
2498 | - { | |
2499 | - /* See the end of i386_push_dummy_call. */ | |
2500 | - (*this_id) = frame_id_build (cache->base + 8, get_frame_pc (this_frame)); | |
2501 | - } | |
2443 | + /* See the end of i386_push_dummy_call. */ | |
2444 | + (*this_id) = frame_id_build (cache->base + 8, get_frame_pc (this_frame)); | |
2502 | 2445 | } |
2503 | 2446 | |
2504 | 2447 | static struct value * |