OLD | NEW |
1 /* Virtual tail call frames unwinder for GDB. | 1 /* Virtual tail call frames unwinder for GDB. |
2 | 2 |
3 Copyright (C) 2010-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2010-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 229 } |
230 | 230 |
231 /* Find PC to be unwound from THIS_FRAME. THIS_FRAME must be a part of | 231 /* Find PC to be unwound from THIS_FRAME. THIS_FRAME must be a part of |
232 CACHE. */ | 232 CACHE. */ |
233 | 233 |
234 static CORE_ADDR | 234 static CORE_ADDR |
235 pretend_pc (struct frame_info *this_frame, struct tailcall_cache *cache) | 235 pretend_pc (struct frame_info *this_frame, struct tailcall_cache *cache) |
236 { | 236 { |
237 int next_levels = existing_next_levels (this_frame, cache); | 237 int next_levels = existing_next_levels (this_frame, cache); |
238 struct call_site_chain *chain = cache->chain; | 238 struct call_site_chain *chain = cache->chain; |
239 int caller_no; | |
240 | 239 |
241 gdb_assert (chain != NULL); | 240 gdb_assert (chain != NULL); |
242 | 241 |
243 next_levels++; | 242 next_levels++; |
244 gdb_assert (next_levels >= 0); | 243 gdb_assert (next_levels >= 0); |
245 | 244 |
246 if (next_levels < chain->callees) | 245 if (next_levels < chain->callees) |
247 return chain->call_site[chain->length - next_levels - 1]->pc; | 246 return chain->call_site[chain->length - next_levels - 1]->pc; |
248 next_levels -= chain->callees; | 247 next_levels -= chain->callees; |
249 | 248 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 call frames frame base to get the SP value there - to simulate return | 359 call frames frame base to get the SP value there - to simulate return |
361 address pushed on the stack. */ | 360 address pushed on the stack. */ |
362 | 361 |
363 void | 362 void |
364 dwarf2_tailcall_sniffer_first (struct frame_info *this_frame, | 363 dwarf2_tailcall_sniffer_first (struct frame_info *this_frame, |
365 void **tailcall_cachep, | 364 void **tailcall_cachep, |
366 const LONGEST *entry_cfa_sp_offsetp) | 365 const LONGEST *entry_cfa_sp_offsetp) |
367 { | 366 { |
368 CORE_ADDR prev_pc = 0, prev_sp = 0; /* GCC warning. */ | 367 CORE_ADDR prev_pc = 0, prev_sp = 0; /* GCC warning. */ |
369 int prev_sp_p = 0; | 368 int prev_sp_p = 0; |
370 CORE_ADDR this_pc, pc; | 369 CORE_ADDR this_pc; |
371 struct gdbarch *prev_gdbarch; | 370 struct gdbarch *prev_gdbarch; |
372 struct call_site_chain *chain = NULL; | 371 struct call_site_chain *chain = NULL; |
373 struct frame_info *fi; | |
374 struct tailcall_cache *cache; | 372 struct tailcall_cache *cache; |
375 volatile struct gdb_exception except; | 373 volatile struct gdb_exception except; |
376 | 374 |
377 gdb_assert (*tailcall_cachep == NULL); | 375 gdb_assert (*tailcall_cachep == NULL); |
378 | 376 |
379 this_pc = get_frame_pc (this_frame); | 377 this_pc = get_frame_pc (this_frame); |
380 | 378 |
381 /* Catch any unwinding errors. */ | 379 /* Catch any unwinding errors. */ |
382 TRY_CATCH (except, RETURN_MASK_ERROR) | 380 TRY_CATCH (except, RETURN_MASK_ERROR) |
383 { | 381 { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 466 |
469 /* Provide a prototype to silence -Wmissing-prototypes. */ | 467 /* Provide a prototype to silence -Wmissing-prototypes. */ |
470 extern initialize_file_ftype _initialize_tailcall_frame; | 468 extern initialize_file_ftype _initialize_tailcall_frame; |
471 | 469 |
472 void | 470 void |
473 _initialize_tailcall_frame (void) | 471 _initialize_tailcall_frame (void) |
474 { | 472 { |
475 cache_htab = htab_create_alloc (50, cache_hash, cache_eq, NULL, xcalloc, | 473 cache_htab = htab_create_alloc (50, cache_hash, cache_eq, NULL, xcalloc, |
476 xfree); | 474 xfree); |
477 } | 475 } |
OLD | NEW |