| 1 | /* Get info from stack frames; |
| 2 | convert between frames, blocks, functions and pc values. |
| 3 | Copyright 1986, 1987, 1988, 1989, 1991, 1994, 1995, 1996, 1997 |
| 4 | Free Software Foundation, Inc. |
| 5 | |
| 6 | This file is part of GDB. |
| 7 | |
| 8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program; if not, write to the Free Software |
| 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 21 | |
| 22 | #include "defs.h" |
| 23 | #include "symtab.h" |
| 24 | #include "bfd.h" |
| 25 | #include "symfile.h" |
| 26 | #include "objfiles.h" |
| 27 | #include "frame.h" |
| 28 | #include "gdbcore.h" |
| 29 | #include "value.h" /* for read_register */ |
| 30 | #include "target.h" /* for target_has_stack */ |
| 31 | #include "inferior.h" /* for read_pc */ |
| 32 | #include "annotate.h" |
| 33 | |
| 34 | /* Is ADDR inside the startup file? Note that if your machine |
| 35 | has a way to detect the bottom of the stack, there is no need |
| 36 | to call this function from FRAME_CHAIN_VALID; the reason for |
| 37 | doing so is that some machines have no way of detecting bottom |
| 38 | of stack. |
| 39 | |
| 40 | A PC of zero is always considered to be the bottom of the stack. */ |
| 41 | |
| 42 | int |
| 43 | inside_entry_file (addr) |
| 44 | CORE_ADDR addr; |
| 45 | { |
| 46 | if (addr == 0) |
| 47 | return 1; |
| 48 | if (symfile_objfile == 0) |
| 49 | return 0; |
| 50 | #if CALL_DUMMY_LOCATION == AT_ENTRY_POINT |
| 51 | /* Do not stop backtracing if the pc is in the call dummy |
| 52 | at the entry point. */ |
| 53 | /* FIXME: Won't always work with zeros for the last two arguments */ |
| 54 | if (PC_IN_CALL_DUMMY (addr, 0, 0)) |
| 55 | return 0; |
| 56 | #endif |
| 57 | return (addr >= symfile_objfile -> ei.entry_file_lowpc && |
| 58 | addr < symfile_objfile -> ei.entry_file_highpc); |
| 59 | } |
| 60 | |
| 61 | /* Test a specified PC value to see if it is in the range of addresses |
| 62 | that correspond to the main() function. See comments above for why |
| 63 | we might want to do this. |
| 64 | |
| 65 | Typically called from FRAME_CHAIN_VALID. |
| 66 | |
| 67 | A PC of zero is always considered to be the bottom of the stack. */ |
| 68 | |
| 69 | int |
| 70 | inside_main_func (pc) |
| 71 | CORE_ADDR pc; |
| 72 | { |
| 73 | if (pc == 0) |
| 74 | return 1; |
| 75 | if (symfile_objfile == 0) |
| 76 | return 0; |
| 77 | |
| 78 | /* If the addr range is not set up at symbol reading time, set it up now. |
| 79 | This is for FRAME_CHAIN_VALID_ALTERNATE. I do this for coff, because |
| 80 | it is unable to set it up and symbol reading time. */ |
| 81 | |
| 82 | if (symfile_objfile -> ei.main_func_lowpc == INVALID_ENTRY_LOWPC && |
| 83 | symfile_objfile -> ei.main_func_highpc == INVALID_ENTRY_HIGHPC) |
| 84 | { |
| 85 | struct symbol *mainsym; |
| 86 | |
| 87 | mainsym = lookup_symbol ("main", NULL, VAR_NAMESPACE, NULL, NULL); |
| 88 | if (mainsym && SYMBOL_CLASS(mainsym) == LOC_BLOCK) |
| 89 | { |
| 90 | symfile_objfile->ei.main_func_lowpc = BLOCK_START (SYMBOL_BLOCK_VALUE (mainsym)); |
| 91 | symfile_objfile->ei.main_func_highpc = BLOCK_END (SYMBOL_BLOCK_VALUE (mainsym)); |
| 92 | } |
| 93 | } |
| 94 | return (symfile_objfile -> ei.main_func_lowpc <= pc && |
| 95 | symfile_objfile -> ei.main_func_highpc > pc); |
| 96 | } |
| 97 | |
| 98 | /* Test a specified PC value to see if it is in the range of addresses |
| 99 | that correspond to the process entry point function. See comments |
| 100 | in objfiles.h for why we might want to do this. |
| 101 | |
| 102 | Typically called from FRAME_CHAIN_VALID. |
| 103 | |
| 104 | A PC of zero is always considered to be the bottom of the stack. */ |
| 105 | |
| 106 | int |
| 107 | inside_entry_func (pc) |
| 108 | CORE_ADDR pc; |
| 109 | { |
| 110 | if (pc == 0) |
| 111 | return 1; |
| 112 | if (symfile_objfile == 0) |
| 113 | return 0; |
| 114 | #if CALL_DUMMY_LOCATION == AT_ENTRY_POINT |
| 115 | /* Do not stop backtracing if the pc is in the call dummy |
| 116 | at the entry point. */ |
| 117 | /* FIXME: Won't always work with zeros for the last two arguments */ |
| 118 | if (PC_IN_CALL_DUMMY (pc, 0, 0)) |
| 119 | return 0; |
| 120 | #endif |
| 121 | return (symfile_objfile -> ei.entry_func_lowpc <= pc && |
| 122 | symfile_objfile -> ei.entry_func_highpc > pc); |
| 123 | } |
| 124 | |
| 125 | /* Info about the innermost stack frame (contents of FP register) */ |
| 126 | |
| 127 | static struct frame_info *current_frame; |
| 128 | |
| 129 | /* Cache for frame addresses already read by gdb. Valid only while |
| 130 | inferior is stopped. Control variables for the frame cache should |
| 131 | be local to this module. */ |
| 132 | |
| 133 | struct obstack frame_cache_obstack; |
| 134 | |
| 135 | /* Return the innermost (currently executing) stack frame. */ |
| 136 | |
| 137 | struct frame_info * |
| 138 | get_current_frame () |
| 139 | { |
| 140 | if (current_frame == NULL) |
| 141 | { |
| 142 | if (target_has_stack) |
| 143 | current_frame = create_new_frame (read_fp (), read_pc ()); |
| 144 | else |
| 145 | error ("No stack."); |
| 146 | } |
| 147 | return current_frame; |
| 148 | } |
| 149 | |
| 150 | void |
| 151 | set_current_frame (frame) |
| 152 | struct frame_info *frame; |
| 153 | { |
| 154 | current_frame = frame; |
| 155 | } |
| 156 | |
| 157 | /* Create an arbitrary (i.e. address specified by user) or innermost frame. |
| 158 | Always returns a non-NULL value. */ |
| 159 | |
| 160 | struct frame_info * |
| 161 | create_new_frame (addr, pc) |
| 162 | CORE_ADDR addr; |
| 163 | CORE_ADDR pc; |
| 164 | { |
| 165 | struct frame_info *fi; |
| 166 | char *name; |
| 167 | |
| 168 | fi = (struct frame_info *) |
| 169 | obstack_alloc (&frame_cache_obstack, |
| 170 | sizeof (struct frame_info)); |
| 171 | |
| 172 | /* Arbitrary frame */ |
| 173 | fi->next = NULL; |
| 174 | fi->prev = NULL; |
| 175 | fi->frame = addr; |
| 176 | fi->pc = pc; |
| 177 | find_pc_partial_function (pc, &name, (CORE_ADDR *)NULL,(CORE_ADDR *)NULL); |
| 178 | fi->signal_handler_caller = IN_SIGTRAMP (fi->pc, name); |
| 179 | |
| 180 | #ifdef INIT_EXTRA_FRAME_INFO |
| 181 | INIT_EXTRA_FRAME_INFO (0, fi); |
| 182 | #endif |
| 183 | |
| 184 | return fi; |
| 185 | } |
| 186 | |
| 187 | /* Return the frame that called FI. |
| 188 | If FI is the original frame (it has no caller), return 0. */ |
| 189 | |
| 190 | struct frame_info * |
| 191 | get_prev_frame (frame) |
| 192 | struct frame_info *frame; |
| 193 | { |
| 194 | return get_prev_frame_info (frame); |
| 195 | } |
| 196 | |
| 197 | /* Return the frame that FRAME calls (NULL if FRAME is the innermost |
| 198 | frame). */ |
| 199 | |
| 200 | struct frame_info * |
| 201 | get_next_frame (frame) |
| 202 | struct frame_info *frame; |
| 203 | { |
| 204 | return frame->next; |
| 205 | } |
| 206 | |
| 207 | /* Flush the entire frame cache. */ |
| 208 | |
| 209 | void |
| 210 | flush_cached_frames () |
| 211 | { |
| 212 | /* Since we can't really be sure what the first object allocated was */ |
| 213 | obstack_free (&frame_cache_obstack, 0); |
| 214 | obstack_init (&frame_cache_obstack); |
| 215 | |
| 216 | current_frame = NULL; /* Invalidate cache */ |
| 217 | select_frame (NULL, -1); |
| 218 | annotate_frames_invalid (); |
| 219 | } |
| 220 | |
| 221 | /* Flush the frame cache, and start a new one if necessary. */ |
| 222 | |
| 223 | void |
| 224 | reinit_frame_cache () |
| 225 | { |
| 226 | flush_cached_frames (); |
| 227 | |
| 228 | /* FIXME: The inferior_pid test is wrong if there is a corefile. */ |
| 229 | if (inferior_pid != 0) |
| 230 | { |
| 231 | select_frame (get_current_frame (), 0); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | /* If a machine allows frameless functions, it should define a macro |
| 236 | FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) in param.h. FI is the struct |
| 237 | frame_info for the frame, and FRAMELESS should be set to nonzero |
| 238 | if it represents a frameless function invocation. */ |
| 239 | |
| 240 | /* Return nonzero if the function for this frame lacks a prologue. Many |
| 241 | machines can define FRAMELESS_FUNCTION_INVOCATION to just call this |
| 242 | function. */ |
| 243 | |
| 244 | int |
| 245 | frameless_look_for_prologue (frame) |
| 246 | struct frame_info *frame; |
| 247 | { |
| 248 | CORE_ADDR func_start, after_prologue; |
| 249 | func_start = get_pc_function_start (frame->pc); |
| 250 | if (func_start) |
| 251 | { |
| 252 | func_start += FUNCTION_START_OFFSET; |
| 253 | after_prologue = func_start; |
| 254 | #ifdef SKIP_PROLOGUE_FRAMELESS_P |
| 255 | /* This is faster, since only care whether there *is* a prologue, |
| 256 | not how long it is. */ |
| 257 | SKIP_PROLOGUE_FRAMELESS_P (after_prologue); |
| 258 | #else |
| 259 | SKIP_PROLOGUE (after_prologue); |
| 260 | #endif |
| 261 | return after_prologue == func_start; |
| 262 | } |
| 263 | else if (frame->pc == 0) |
| 264 | /* A frame with a zero PC is usually created by dereferencing a NULL |
| 265 | function pointer, normally causing an immediate core dump of the |
| 266 | inferior. Mark function as frameless, as the inferior has no chance |
| 267 | of setting up a stack frame. */ |
| 268 | return 1; |
| 269 | else |
| 270 | /* If we can't find the start of the function, we don't really |
| 271 | know whether the function is frameless, but we should be able |
| 272 | to get a reasonable (i.e. best we can do under the |
| 273 | circumstances) backtrace by saying that it isn't. */ |
| 274 | return 0; |
| 275 | } |
| 276 | |
| 277 | /* Default a few macros that people seldom redefine. */ |
| 278 | |
| 279 | #if !defined (INIT_FRAME_PC) |
| 280 | #define INIT_FRAME_PC(fromleaf, prev) \ |
| 281 | prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ |
| 282 | prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); |
| 283 | #endif |
| 284 | |
| 285 | #ifndef FRAME_CHAIN_COMBINE |
| 286 | #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) |
| 287 | #endif |
| 288 | |
| 289 | /* Return a structure containing various interesting information |
| 290 | about the frame that called NEXT_FRAME. Returns NULL |
| 291 | if there is no such frame. */ |
| 292 | |
| 293 | struct frame_info * |
| 294 | get_prev_frame_info (next_frame) |
| 295 | struct frame_info *next_frame; |
| 296 | { |
| 297 | CORE_ADDR address = 0; |
| 298 | struct frame_info *prev; |
| 299 | int fromleaf = 0; |
| 300 | char *name; |
| 301 | |
| 302 | /* If the requested entry is in the cache, return it. |
| 303 | Otherwise, figure out what the address should be for the entry |
| 304 | we're about to add to the cache. */ |
| 305 | |
| 306 | if (!next_frame) |
| 307 | { |
| 308 | #if 0 |
| 309 | /* This screws value_of_variable, which just wants a nice clean |
| 310 | NULL return from block_innermost_frame if there are no frames. |
| 311 | I don't think I've ever seen this message happen otherwise. |
| 312 | And returning NULL here is a perfectly legitimate thing to do. */ |
| 313 | if (!current_frame) |
| 314 | { |
| 315 | error ("You haven't set up a process's stack to examine."); |
| 316 | } |
| 317 | #endif |
| 318 | |
| 319 | return current_frame; |
| 320 | } |
| 321 | |
| 322 | /* If we have the prev one, return it */ |
| 323 | if (next_frame->prev) |
| 324 | return next_frame->prev; |
| 325 | |
| 326 | /* On some machines it is possible to call a function without |
| 327 | setting up a stack frame for it. On these machines, we |
| 328 | define this macro to take two args; a frameinfo pointer |
| 329 | identifying a frame and a variable to set or clear if it is |
| 330 | or isn't leafless. */ |
| 331 | #ifdef FRAMELESS_FUNCTION_INVOCATION |
| 332 | /* Still don't want to worry about this except on the innermost |
| 333 | frame. This macro will set FROMLEAF if NEXT_FRAME is a |
| 334 | frameless function invocation. */ |
| 335 | if (!(next_frame->next)) |
| 336 | { |
| 337 | FRAMELESS_FUNCTION_INVOCATION (next_frame, fromleaf); |
| 338 | if (fromleaf) |
| 339 | address = FRAME_FP (next_frame); |
| 340 | } |
| 341 | #endif |
| 342 | |
| 343 | if (!fromleaf) |
| 344 | { |
| 345 | /* Two macros defined in tm.h specify the machine-dependent |
| 346 | actions to be performed here. |
| 347 | First, get the frame's chain-pointer. |
| 348 | If that is zero, the frame is the outermost frame or a leaf |
| 349 | called by the outermost frame. This means that if start |
| 350 | calls main without a frame, we'll return 0 (which is fine |
| 351 | anyway). |
| 352 | |
| 353 | Nope; there's a problem. This also returns when the current |
| 354 | routine is a leaf of main. This is unacceptable. We move |
| 355 | this to after the ffi test; I'd rather have backtraces from |
| 356 | start go curfluy than have an abort called from main not show |
| 357 | main. */ |
| 358 | address = FRAME_CHAIN (next_frame); |
| 359 | if (!FRAME_CHAIN_VALID (address, next_frame)) |
| 360 | return 0; |
| 361 | address = FRAME_CHAIN_COMBINE (address, next_frame); |
| 362 | } |
| 363 | if (address == 0) |
| 364 | return 0; |
| 365 | |
| 366 | prev = (struct frame_info *) |
| 367 | obstack_alloc (&frame_cache_obstack, |
| 368 | sizeof (struct frame_info)); |
| 369 | |
| 370 | if (next_frame) |
| 371 | next_frame->prev = prev; |
| 372 | prev->next = next_frame; |
| 373 | prev->prev = (struct frame_info *) 0; |
| 374 | prev->frame = address; |
| 375 | prev->signal_handler_caller = 0; |
| 376 | |
| 377 | /* This change should not be needed, FIXME! We should |
| 378 | determine whether any targets *need* INIT_FRAME_PC to happen |
| 379 | after INIT_EXTRA_FRAME_INFO and come up with a simple way to |
| 380 | express what goes on here. |
| 381 | |
| 382 | INIT_EXTRA_FRAME_INFO is called from two places: create_new_frame |
| 383 | (where the PC is already set up) and here (where it isn't). |
| 384 | INIT_FRAME_PC is only called from here, always after |
| 385 | INIT_EXTRA_FRAME_INFO. |
| 386 | |
| 387 | The catch is the MIPS, where INIT_EXTRA_FRAME_INFO requires the PC |
| 388 | value (which hasn't been set yet). Some other machines appear to |
| 389 | require INIT_EXTRA_FRAME_INFO before they can do INIT_FRAME_PC. Phoo. |
| 390 | |
| 391 | We shouldn't need INIT_FRAME_PC_FIRST to add more complication to |
| 392 | an already overcomplicated part of GDB. gnu@cygnus.com, 15Sep92. |
| 393 | |
| 394 | Assuming that some machines need INIT_FRAME_PC after |
| 395 | INIT_EXTRA_FRAME_INFO, one possible scheme: |
| 396 | |
| 397 | SETUP_INNERMOST_FRAME() |
| 398 | Default version is just create_new_frame (read_fp ()), |
| 399 | read_pc ()). Machines with extra frame info would do that (or the |
| 400 | local equivalent) and then set the extra fields. |
| 401 | SETUP_ARBITRARY_FRAME(argc, argv) |
| 402 | Only change here is that create_new_frame would no longer init extra |
| 403 | frame info; SETUP_ARBITRARY_FRAME would have to do that. |
| 404 | INIT_PREV_FRAME(fromleaf, prev) |
| 405 | Replace INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC. This should |
| 406 | also return a flag saying whether to keep the new frame, or |
| 407 | whether to discard it, because on some machines (e.g. mips) it |
| 408 | is really awkward to have FRAME_CHAIN_VALID called *before* |
| 409 | INIT_EXTRA_FRAME_INFO (there is no good way to get information |
| 410 | deduced in FRAME_CHAIN_VALID into the extra fields of the new frame). |
| 411 | std_frame_pc(fromleaf, prev) |
| 412 | This is the default setting for INIT_PREV_FRAME. It just does what |
| 413 | the default INIT_FRAME_PC does. Some machines will call it from |
| 414 | INIT_PREV_FRAME (either at the beginning, the end, or in the middle). |
| 415 | Some machines won't use it. |
| 416 | kingdon@cygnus.com, 13Apr93, 31Jan94, 14Dec94. */ |
| 417 | |
| 418 | #ifdef INIT_FRAME_PC_FIRST |
| 419 | INIT_FRAME_PC_FIRST (fromleaf, prev); |
| 420 | #endif |
| 421 | |
| 422 | #ifdef INIT_EXTRA_FRAME_INFO |
| 423 | INIT_EXTRA_FRAME_INFO(fromleaf, prev); |
| 424 | #endif |
| 425 | |
| 426 | /* This entry is in the frame queue now, which is good since |
| 427 | FRAME_SAVED_PC may use that queue to figure out its value |
| 428 | (see tm-sparc.h). We want the pc saved in the inferior frame. */ |
| 429 | INIT_FRAME_PC(fromleaf, prev); |
| 430 | |
| 431 | /* If ->frame and ->pc are unchanged, we are in the process of getting |
| 432 | ourselves into an infinite backtrace. Some architectures check this |
| 433 | in FRAME_CHAIN or thereabouts, but it seems like there is no reason |
| 434 | this can't be an architecture-independent check. */ |
| 435 | if (next_frame != NULL) |
| 436 | { |
| 437 | if (prev->frame == next_frame->frame |
| 438 | && prev->pc == next_frame->pc) |
| 439 | { |
| 440 | next_frame->prev = NULL; |
| 441 | obstack_free (&frame_cache_obstack, prev); |
| 442 | return NULL; |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | find_pc_partial_function (prev->pc, &name, |
| 447 | (CORE_ADDR *)NULL,(CORE_ADDR *)NULL); |
| 448 | if (IN_SIGTRAMP (prev->pc, name)) |
| 449 | prev->signal_handler_caller = 1; |
| 450 | |
| 451 | return prev; |
| 452 | } |
| 453 | |
| 454 | CORE_ADDR |
| 455 | get_frame_pc (frame) |
| 456 | struct frame_info *frame; |
| 457 | { |
| 458 | return frame->pc; |
| 459 | } |
| 460 | |
| 461 | #if defined (FRAME_FIND_SAVED_REGS) |
| 462 | /* Find the addresses in which registers are saved in FRAME. */ |
| 463 | |
| 464 | void |
| 465 | get_frame_saved_regs (frame, saved_regs_addr) |
| 466 | struct frame_info *frame; |
| 467 | struct frame_saved_regs *saved_regs_addr; |
| 468 | { |
| 469 | FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr); |
| 470 | } |
| 471 | #endif |
| 472 | |
| 473 | /* Return the innermost lexical block in execution |
| 474 | in a specified stack frame. The frame address is assumed valid. */ |
| 475 | |
| 476 | struct block * |
| 477 | get_frame_block (frame) |
| 478 | struct frame_info *frame; |
| 479 | { |
| 480 | CORE_ADDR pc; |
| 481 | |
| 482 | pc = frame->pc; |
| 483 | if (frame->next != 0 && frame->next->signal_handler_caller == 0) |
| 484 | /* We are not in the innermost frame and we were not interrupted |
| 485 | by a signal. We need to subtract one to get the correct block, |
| 486 | in case the call instruction was the last instruction of the block. |
| 487 | If there are any machines on which the saved pc does not point to |
| 488 | after the call insn, we probably want to make frame->pc point after |
| 489 | the call insn anyway. */ |
| 490 | --pc; |
| 491 | return block_for_pc (pc); |
| 492 | } |
| 493 | |
| 494 | struct block * |
| 495 | get_current_block () |
| 496 | { |
| 497 | return block_for_pc (read_pc ()); |
| 498 | } |
| 499 | |
| 500 | CORE_ADDR |
| 501 | get_pc_function_start (pc) |
| 502 | CORE_ADDR pc; |
| 503 | { |
| 504 | register struct block *bl; |
| 505 | register struct symbol *symbol; |
| 506 | register struct minimal_symbol *msymbol; |
| 507 | CORE_ADDR fstart; |
| 508 | |
| 509 | if ((bl = block_for_pc (pc)) != NULL && |
| 510 | (symbol = block_function (bl)) != NULL) |
| 511 | { |
| 512 | bl = SYMBOL_BLOCK_VALUE (symbol); |
| 513 | fstart = BLOCK_START (bl); |
| 514 | } |
| 515 | else if ((msymbol = lookup_minimal_symbol_by_pc (pc)) != NULL) |
| 516 | { |
| 517 | fstart = SYMBOL_VALUE_ADDRESS (msymbol); |
| 518 | } |
| 519 | else |
| 520 | { |
| 521 | fstart = 0; |
| 522 | } |
| 523 | return (fstart); |
| 524 | } |
| 525 | |
| 526 | /* Return the symbol for the function executing in frame FRAME. */ |
| 527 | |
| 528 | struct symbol * |
| 529 | get_frame_function (frame) |
| 530 | struct frame_info *frame; |
| 531 | { |
| 532 | register struct block *bl = get_frame_block (frame); |
| 533 | if (bl == 0) |
| 534 | return 0; |
| 535 | return block_function (bl); |
| 536 | } |
| 537 | \f |
| 538 | /* Return the blockvector immediately containing the innermost lexical block |
| 539 | containing the specified pc value, or 0 if there is none. |
| 540 | PINDEX is a pointer to the index value of the block. If PINDEX |
| 541 | is NULL, we don't pass this information back to the caller. */ |
| 542 | |
| 543 | struct blockvector * |
| 544 | blockvector_for_pc (pc, pindex) |
| 545 | register CORE_ADDR pc; |
| 546 | int *pindex; |
| 547 | { |
| 548 | register struct block *b; |
| 549 | register int bot, top, half; |
| 550 | register struct symtab *s; |
| 551 | struct blockvector *bl; |
| 552 | |
| 553 | /* First search all symtabs for one whose file contains our pc */ |
| 554 | s = find_pc_symtab (pc); |
| 555 | if (s == 0) |
| 556 | return 0; |
| 557 | |
| 558 | bl = BLOCKVECTOR (s); |
| 559 | b = BLOCKVECTOR_BLOCK (bl, 0); |
| 560 | |
| 561 | /* Then search that symtab for the smallest block that wins. */ |
| 562 | /* Use binary search to find the last block that starts before PC. */ |
| 563 | |
| 564 | bot = 0; |
| 565 | top = BLOCKVECTOR_NBLOCKS (bl); |
| 566 | |
| 567 | while (top - bot > 1) |
| 568 | { |
| 569 | half = (top - bot + 1) >> 1; |
| 570 | b = BLOCKVECTOR_BLOCK (bl, bot + half); |
| 571 | if (BLOCK_START (b) <= pc) |
| 572 | bot += half; |
| 573 | else |
| 574 | top = bot + half; |
| 575 | } |
| 576 | |
| 577 | /* Now search backward for a block that ends after PC. */ |
| 578 | |
| 579 | while (bot >= 0) |
| 580 | { |
| 581 | b = BLOCKVECTOR_BLOCK (bl, bot); |
| 582 | if (BLOCK_END (b) > pc) |
| 583 | { |
| 584 | if (pindex) |
| 585 | *pindex = bot; |
| 586 | return bl; |
| 587 | } |
| 588 | bot--; |
| 589 | } |
| 590 | |
| 591 | return 0; |
| 592 | } |
| 593 | |
| 594 | /* Return the innermost lexical block containing the specified pc value, |
| 595 | or 0 if there is none. */ |
| 596 | |
| 597 | struct block * |
| 598 | block_for_pc (pc) |
| 599 | register CORE_ADDR pc; |
| 600 | { |
| 601 | register struct blockvector *bl; |
| 602 | int index; |
| 603 | |
| 604 | bl = blockvector_for_pc (pc, &index); |
| 605 | if (bl) |
| 606 | return BLOCKVECTOR_BLOCK (bl, index); |
| 607 | return 0; |
| 608 | } |
| 609 | |
| 610 | /* Return the function containing pc value PC. |
| 611 | Returns 0 if function is not known. */ |
| 612 | |
| 613 | struct symbol * |
| 614 | find_pc_function (pc) |
| 615 | CORE_ADDR pc; |
| 616 | { |
| 617 | register struct block *b = block_for_pc (pc); |
| 618 | if (b == 0) |
| 619 | return 0; |
| 620 | return block_function (b); |
| 621 | } |
| 622 | |
| 623 | /* These variables are used to cache the most recent result |
| 624 | * of find_pc_partial_function. */ |
| 625 | |
| 626 | static CORE_ADDR cache_pc_function_low = 0; |
| 627 | static CORE_ADDR cache_pc_function_high = 0; |
| 628 | static char *cache_pc_function_name = 0; |
| 629 | |
| 630 | /* Clear cache, e.g. when symbol table is discarded. */ |
| 631 | |
| 632 | void |
| 633 | clear_pc_function_cache() |
| 634 | { |
| 635 | cache_pc_function_low = 0; |
| 636 | cache_pc_function_high = 0; |
| 637 | cache_pc_function_name = (char *)0; |
| 638 | } |
| 639 | |
| 640 | /* Finds the "function" (text symbol) that is smaller than PC but |
| 641 | greatest of all of the potential text symbols. Sets *NAME and/or |
| 642 | *ADDRESS conditionally if that pointer is non-null. If ENDADDR is |
| 643 | non-null, then set *ENDADDR to be the end of the function |
| 644 | (exclusive), but passing ENDADDR as non-null means that the |
| 645 | function might cause symbols to be read. This function either |
| 646 | succeeds or fails (not halfway succeeds). If it succeeds, it sets |
| 647 | *NAME, *ADDRESS, and *ENDADDR to real information and returns 1. |
| 648 | If it fails, it sets *NAME, *ADDRESS, and *ENDADDR to zero |
| 649 | and returns 0. */ |
| 650 | |
| 651 | int |
| 652 | find_pc_partial_function (pc, name, address, endaddr) |
| 653 | CORE_ADDR pc; |
| 654 | char **name; |
| 655 | CORE_ADDR *address; |
| 656 | CORE_ADDR *endaddr; |
| 657 | { |
| 658 | struct partial_symtab *pst; |
| 659 | struct symbol *f; |
| 660 | struct minimal_symbol *msymbol; |
| 661 | struct partial_symbol *psb; |
| 662 | struct obj_section *sec; |
| 663 | |
| 664 | if (pc >= cache_pc_function_low && pc < cache_pc_function_high) |
| 665 | goto return_cached_value; |
| 666 | |
| 667 | /* If sigtramp is in the u area, it counts as a function (especially |
| 668 | important for step_1). */ |
| 669 | #if defined SIGTRAMP_START |
| 670 | if (IN_SIGTRAMP (pc, (char *)NULL)) |
| 671 | { |
| 672 | cache_pc_function_low = SIGTRAMP_START (pc); |
| 673 | cache_pc_function_high = SIGTRAMP_END (pc); |
| 674 | cache_pc_function_name = "<sigtramp>"; |
| 675 | |
| 676 | goto return_cached_value; |
| 677 | } |
| 678 | #endif |
| 679 | |
| 680 | msymbol = lookup_minimal_symbol_by_pc (pc); |
| 681 | pst = find_pc_psymtab (pc); |
| 682 | if (pst) |
| 683 | { |
| 684 | /* Need to read the symbols to get a good value for the end address. */ |
| 685 | if (endaddr != NULL && !pst->readin) |
| 686 | { |
| 687 | /* Need to get the terminal in case symbol-reading produces |
| 688 | output. */ |
| 689 | target_terminal_ours_for_output (); |
| 690 | PSYMTAB_TO_SYMTAB (pst); |
| 691 | } |
| 692 | |
| 693 | if (pst->readin) |
| 694 | { |
| 695 | /* Checking whether the msymbol has a larger value is for the |
| 696 | "pathological" case mentioned in print_frame_info. */ |
| 697 | f = find_pc_function (pc); |
| 698 | if (f != NULL |
| 699 | && (msymbol == NULL |
| 700 | || (BLOCK_START (SYMBOL_BLOCK_VALUE (f)) |
| 701 | >= SYMBOL_VALUE_ADDRESS (msymbol)))) |
| 702 | { |
| 703 | cache_pc_function_low = BLOCK_START (SYMBOL_BLOCK_VALUE (f)); |
| 704 | cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f)); |
| 705 | cache_pc_function_name = SYMBOL_NAME (f); |
| 706 | goto return_cached_value; |
| 707 | } |
| 708 | } |
| 709 | else |
| 710 | { |
| 711 | /* Now that static symbols go in the minimal symbol table, perhaps |
| 712 | we could just ignore the partial symbols. But at least for now |
| 713 | we use the partial or minimal symbol, whichever is larger. */ |
| 714 | psb = find_pc_psymbol (pst, pc); |
| 715 | |
| 716 | if (psb |
| 717 | && (msymbol == NULL || |
| 718 | (SYMBOL_VALUE_ADDRESS (psb) |
| 719 | >= SYMBOL_VALUE_ADDRESS (msymbol)))) |
| 720 | { |
| 721 | /* This case isn't being cached currently. */ |
| 722 | if (address) |
| 723 | *address = SYMBOL_VALUE_ADDRESS (psb); |
| 724 | if (name) |
| 725 | *name = SYMBOL_NAME (psb); |
| 726 | /* endaddr non-NULL can't happen here. */ |
| 727 | return 1; |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | /* Not in the normal symbol tables, see if the pc is in a known section. |
| 733 | If it's not, then give up. This ensures that anything beyond the end |
| 734 | of the text seg doesn't appear to be part of the last function in the |
| 735 | text segment. */ |
| 736 | |
| 737 | sec = find_pc_section (pc); |
| 738 | |
| 739 | if (!sec) |
| 740 | msymbol = NULL; |
| 741 | |
| 742 | /* Must be in the minimal symbol table. */ |
| 743 | if (msymbol == NULL) |
| 744 | { |
| 745 | /* No available symbol. */ |
| 746 | if (name != NULL) |
| 747 | *name = 0; |
| 748 | if (address != NULL) |
| 749 | *address = 0; |
| 750 | if (endaddr != NULL) |
| 751 | *endaddr = 0; |
| 752 | return 0; |
| 753 | } |
| 754 | |
| 755 | cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol); |
| 756 | cache_pc_function_name = SYMBOL_NAME (msymbol); |
| 757 | |
| 758 | /* Use the lesser of the next minimal symbol, or the end of the section, as |
| 759 | the end of the function. */ |
| 760 | |
| 761 | if (SYMBOL_NAME (msymbol + 1) != NULL |
| 762 | && SYMBOL_VALUE_ADDRESS (msymbol + 1) < sec->endaddr) |
| 763 | cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + 1); |
| 764 | else |
| 765 | /* We got the start address from the last msymbol in the objfile. |
| 766 | So the end address is the end of the section. */ |
| 767 | cache_pc_function_high = sec->endaddr; |
| 768 | |
| 769 | return_cached_value: |
| 770 | if (address) |
| 771 | *address = cache_pc_function_low; |
| 772 | if (name) |
| 773 | *name = cache_pc_function_name; |
| 774 | if (endaddr) |
| 775 | *endaddr = cache_pc_function_high; |
| 776 | return 1; |
| 777 | } |
| 778 | |
| 779 | /* Return the innermost stack frame executing inside of BLOCK, |
| 780 | or NULL if there is no such frame. If BLOCK is NULL, just return NULL. */ |
| 781 | |
| 782 | struct frame_info * |
| 783 | block_innermost_frame (block) |
| 784 | struct block *block; |
| 785 | { |
| 786 | struct frame_info *frame; |
| 787 | register CORE_ADDR start; |
| 788 | register CORE_ADDR end; |
| 789 | |
| 790 | if (block == NULL) |
| 791 | return NULL; |
| 792 | |
| 793 | start = BLOCK_START (block); |
| 794 | end = BLOCK_END (block); |
| 795 | |
| 796 | frame = NULL; |
| 797 | while (1) |
| 798 | { |
| 799 | frame = get_prev_frame (frame); |
| 800 | if (frame == NULL) |
| 801 | return NULL; |
| 802 | if (frame->pc >= start && frame->pc < end) |
| 803 | return frame; |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | /* Return the full FRAME which corresponds to the given CORE_ADDR |
| 808 | or NULL if no FRAME on the chain corresponds to CORE_ADDR. */ |
| 809 | |
| 810 | struct frame_info * |
| 811 | find_frame_addr_in_frame_chain (frame_addr) |
| 812 | CORE_ADDR frame_addr; |
| 813 | { |
| 814 | struct frame_info *frame = NULL; |
| 815 | |
| 816 | if (frame_addr == (CORE_ADDR)0) |
| 817 | return NULL; |
| 818 | |
| 819 | while (1) |
| 820 | { |
| 821 | frame = get_prev_frame (frame); |
| 822 | if (frame == NULL) |
| 823 | return NULL; |
| 824 | if (FRAME_FP (frame) == frame_addr) |
| 825 | return frame; |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | #ifdef SIGCONTEXT_PC_OFFSET |
| 830 | /* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp. */ |
| 831 | |
| 832 | CORE_ADDR |
| 833 | sigtramp_saved_pc (frame) |
| 834 | struct frame_info *frame; |
| 835 | { |
| 836 | CORE_ADDR sigcontext_addr; |
| 837 | char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT]; |
| 838 | int ptrbytes = TARGET_PTR_BIT / TARGET_CHAR_BIT; |
| 839 | int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT; |
| 840 | |
| 841 | /* Get sigcontext address, it is the third parameter on the stack. */ |
| 842 | if (frame->next) |
| 843 | sigcontext_addr = read_memory_integer (FRAME_ARGS_ADDRESS (frame->next) |
| 844 | + FRAME_ARGS_SKIP |
| 845 | + sigcontext_offs, |
| 846 | ptrbytes); |
| 847 | else |
| 848 | sigcontext_addr = read_memory_integer (read_register (SP_REGNUM) |
| 849 | + sigcontext_offs, |
| 850 | ptrbytes); |
| 851 | |
| 852 | /* Don't cause a memory_error when accessing sigcontext in case the stack |
| 853 | layout has changed or the stack is corrupt. */ |
| 854 | target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes); |
| 855 | return extract_unsigned_integer (buf, ptrbytes); |
| 856 | } |
| 857 | #endif /* SIGCONTEXT_PC_OFFSET */ |
| 858 | |
| 859 | #ifdef USE_GENERIC_DUMMY_FRAMES |
| 860 | |
| 861 | /* |
| 862 | * GENERIC DUMMY FRAMES |
| 863 | * |
| 864 | * The following code serves to maintain the dummy stack frames for |
| 865 | * inferior function calls (ie. when gdb calls into the inferior via |
| 866 | * call_function_by_hand). This code saves the machine state before |
| 867 | * the call in host memory, so we must maintain an independant stack |
| 868 | * and keep it consistant etc. I am attempting to make this code |
| 869 | * generic enough to be used by many targets. |
| 870 | * |
| 871 | * The cheapest and most generic way to do CALL_DUMMY on a new target |
| 872 | * is probably to define CALL_DUMMY to be empty, CALL_DUMMY_LENGTH to zero, |
| 873 | * and CALL_DUMMY_LOCATION to AT_ENTRY. Then you must remember to define |
| 874 | * PUSH_RETURN_ADDRESS, because no call instruction will be being |
| 875 | * executed by the target. |
| 876 | */ |
| 877 | |
| 878 | static struct dummy_frame *dummy_frame_stack = NULL; |
| 879 | |
| 880 | /* Function: find_dummy_frame(pc, fp, sp) |
| 881 | Search the stack of dummy frames for one matching the given PC, FP and SP. |
| 882 | This is the work-horse for pc_in_call_dummy and read_register_dummy */ |
| 883 | |
| 884 | char * |
| 885 | generic_find_dummy_frame (pc, fp) |
| 886 | CORE_ADDR pc; |
| 887 | CORE_ADDR fp; |
| 888 | { |
| 889 | struct dummy_frame * dummyframe; |
| 890 | |
| 891 | if (pc != entry_point_address ()) |
| 892 | return 0; |
| 893 | |
| 894 | for (dummyframe = dummy_frame_stack; dummyframe != NULL; |
| 895 | dummyframe = dummyframe->next) |
| 896 | if (fp == dummyframe->fp || fp == dummyframe->sp) |
| 897 | /* The frame in question lies between the saved fp and sp, inclusive */ |
| 898 | return dummyframe->regs; |
| 899 | |
| 900 | return 0; |
| 901 | } |
| 902 | |
| 903 | /* Function: pc_in_call_dummy (pc, fp) |
| 904 | Return true if this is a dummy frame created by gdb for an inferior call */ |
| 905 | |
| 906 | int |
| 907 | generic_pc_in_call_dummy (pc, fp) |
| 908 | CORE_ADDR pc; |
| 909 | CORE_ADDR fp; |
| 910 | { |
| 911 | /* if find_dummy_frame succeeds, then PC is in a call dummy */ |
| 912 | return (generic_find_dummy_frame (pc, fp) != 0); |
| 913 | } |
| 914 | |
| 915 | /* Function: read_register_dummy |
| 916 | Find a saved register from before GDB calls a function in the inferior */ |
| 917 | |
| 918 | CORE_ADDR |
| 919 | generic_read_register_dummy (pc, fp, regno) |
| 920 | CORE_ADDR pc; |
| 921 | CORE_ADDR fp; |
| 922 | int regno; |
| 923 | { |
| 924 | char *dummy_regs = generic_find_dummy_frame (pc, fp); |
| 925 | |
| 926 | if (dummy_regs) |
| 927 | return extract_address (&dummy_regs[REGISTER_BYTE (regno)], |
| 928 | REGISTER_RAW_SIZE(regno)); |
| 929 | else |
| 930 | return 0; |
| 931 | } |
| 932 | |
| 933 | /* Save all the registers on the dummy frame stack. Most ports save the |
| 934 | registers on the target stack. This results in lots of unnecessary memory |
| 935 | references, which are slow when debugging via a serial line. Instead, we |
| 936 | save all the registers internally, and never write them to the stack. The |
| 937 | registers get restored when the called function returns to the entry point, |
| 938 | where a breakpoint is laying in wait. */ |
| 939 | |
| 940 | void |
| 941 | generic_push_dummy_frame () |
| 942 | { |
| 943 | struct dummy_frame *dummy_frame; |
| 944 | CORE_ADDR fp = (get_current_frame ())->frame; |
| 945 | |
| 946 | /* check to see if there are stale dummy frames, |
| 947 | perhaps left over from when a longjump took us out of a |
| 948 | function that was called by the debugger */ |
| 949 | |
| 950 | dummy_frame = dummy_frame_stack; |
| 951 | while (dummy_frame) |
| 952 | if (dummy_frame->fp INNER_THAN fp) /* stale -- destroy! */ |
| 953 | { |
| 954 | dummy_frame_stack = dummy_frame->next; |
| 955 | free (dummy_frame); |
| 956 | dummy_frame = dummy_frame_stack; |
| 957 | } |
| 958 | else |
| 959 | dummy_frame = dummy_frame->next; |
| 960 | |
| 961 | dummy_frame = xmalloc (sizeof (struct dummy_frame)); |
| 962 | dummy_frame->pc = read_register (PC_REGNUM); |
| 963 | dummy_frame->sp = read_register (SP_REGNUM); |
| 964 | dummy_frame->fp = fp; |
| 965 | read_register_bytes (0, dummy_frame->regs, REGISTER_BYTES); |
| 966 | dummy_frame->next = dummy_frame_stack; |
| 967 | dummy_frame_stack = dummy_frame; |
| 968 | } |
| 969 | |
| 970 | /* Function: pop_dummy_frame |
| 971 | Restore the machine state from a saved dummy stack frame. */ |
| 972 | |
| 973 | void |
| 974 | generic_pop_dummy_frame () |
| 975 | { |
| 976 | struct dummy_frame *dummy_frame = dummy_frame_stack; |
| 977 | |
| 978 | /* FIXME: what if the first frame isn't the right one, eg.. |
| 979 | because one call-by-hand function has done a longjmp into another one? */ |
| 980 | |
| 981 | if (!dummy_frame) |
| 982 | error ("Can't pop dummy frame!"); |
| 983 | dummy_frame_stack = dummy_frame->next; |
| 984 | write_register_bytes (0, dummy_frame->regs, REGISTER_BYTES); |
| 985 | free (dummy_frame); |
| 986 | } |
| 987 | |
| 988 | /* Function: frame_chain_valid |
| 989 | Returns true for a user frame or a call_function_by_hand dummy frame, |
| 990 | and false for the CRT0 start-up frame. Purpose is to terminate backtrace */ |
| 991 | |
| 992 | int |
| 993 | generic_frame_chain_valid (fp, fi) |
| 994 | CORE_ADDR fp; |
| 995 | struct frame_info *fi; |
| 996 | { |
| 997 | if (PC_IN_CALL_DUMMY(FRAME_SAVED_PC(fi), fp, fp)) |
| 998 | return 1; /* don't prune CALL_DUMMY frames */ |
| 999 | else /* fall back to default algorithm (see frame.h) */ |
| 1000 | return (fp != 0 |
| 1001 | && fi->frame INNER_THAN fp |
| 1002 | && !inside_entry_file (FRAME_SAVED_PC(fi))); |
| 1003 | } |
| 1004 | |
| 1005 | /* Function: get_saved_register |
| 1006 | Find register number REGNUM relative to FRAME and put its (raw, |
| 1007 | target format) contents in *RAW_BUFFER. |
| 1008 | |
| 1009 | Set *OPTIMIZED if the variable was optimized out (and thus can't be |
| 1010 | fetched). Note that this is never set to anything other than zero |
| 1011 | in this implementation. |
| 1012 | |
| 1013 | Set *LVAL to lval_memory, lval_register, or not_lval, depending on |
| 1014 | whether the value was fetched from memory, from a register, or in a |
| 1015 | strange and non-modifiable way (e.g. a frame pointer which was |
| 1016 | calculated rather than fetched). We will use not_lval for values |
| 1017 | fetched from generic dummy frames. |
| 1018 | |
| 1019 | Set *ADDRP to the address, either in memory on as a REGISTER_BYTE |
| 1020 | offset into the registers array. If the value is stored in a dummy |
| 1021 | frame, set *ADDRP to zero. |
| 1022 | |
| 1023 | To use this implementation, define a function called |
| 1024 | "get_saved_register" in your target code, which simply passes all |
| 1025 | of its arguments to this function. |
| 1026 | |
| 1027 | The argument RAW_BUFFER must point to aligned memory. */ |
| 1028 | |
| 1029 | void |
| 1030 | generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) |
| 1031 | char *raw_buffer; |
| 1032 | int *optimized; |
| 1033 | CORE_ADDR *addrp; |
| 1034 | struct frame_info *frame; |
| 1035 | int regnum; |
| 1036 | enum lval_type *lval; |
| 1037 | { |
| 1038 | CORE_ADDR addr; |
| 1039 | struct frame_saved_regs fsr; |
| 1040 | |
| 1041 | if (!target_has_registers) |
| 1042 | error ("No registers."); |
| 1043 | |
| 1044 | /* Normal systems don't optimize out things with register numbers. */ |
| 1045 | if (optimized != NULL) |
| 1046 | *optimized = 0; |
| 1047 | |
| 1048 | if (addrp) /* default assumption: not found in memory */ |
| 1049 | *addrp = 0; |
| 1050 | |
| 1051 | /* Note: since the current frame's registers could only have been |
| 1052 | saved by frames INTERIOR TO the current frame, we skip examining |
| 1053 | the current frame itself: otherwise, we would be getting the |
| 1054 | previous frame's registers which were saved by the current frame. */ |
| 1055 | |
| 1056 | while (frame && ((frame = frame->next) != NULL)) |
| 1057 | { |
| 1058 | if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) |
| 1059 | { |
| 1060 | if (lval) /* found it in a CALL_DUMMY frame */ |
| 1061 | *lval = not_lval; |
| 1062 | if (raw_buffer) |
| 1063 | memcpy (raw_buffer, |
| 1064 | generic_find_dummy_frame (frame->pc, frame->frame) + |
| 1065 | REGISTER_BYTE (regnum), |
| 1066 | REGISTER_RAW_SIZE (regnum)); |
| 1067 | return; |
| 1068 | } |
| 1069 | |
| 1070 | FRAME_FIND_SAVED_REGS(frame, fsr); |
| 1071 | if (fsr.regs[regnum] != 0) |
| 1072 | { |
| 1073 | if (lval) /* found it saved on the stack */ |
| 1074 | *lval = lval_memory; |
| 1075 | if (regnum == SP_REGNUM) |
| 1076 | { |
| 1077 | if (raw_buffer) /* SP register treated specially */ |
| 1078 | store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), |
| 1079 | fsr.regs[regnum]); |
| 1080 | } |
| 1081 | else |
| 1082 | { |
| 1083 | if (addrp) /* any other register */ |
| 1084 | *addrp = fsr.regs[regnum]; |
| 1085 | if (raw_buffer) |
| 1086 | read_memory (fsr.regs[regnum], raw_buffer, |
| 1087 | REGISTER_RAW_SIZE (regnum)); |
| 1088 | } |
| 1089 | return; |
| 1090 | } |
| 1091 | } |
| 1092 | |
| 1093 | /* If we get thru the loop to this point, it means the register was |
| 1094 | not saved in any frame. Return the actual live-register value. */ |
| 1095 | |
| 1096 | if (lval) /* found it in a live register */ |
| 1097 | *lval = lval_register; |
| 1098 | if (addrp) |
| 1099 | *addrp = REGISTER_BYTE (regnum); |
| 1100 | if (raw_buffer) |
| 1101 | read_register_gen (regnum, raw_buffer); |
| 1102 | } |
| 1103 | #endif /* USE_GENERIC_DUMMY_FRAMES */ |
| 1104 | |
| 1105 | void |
| 1106 | _initialize_blockframe () |
| 1107 | { |
| 1108 | obstack_init (&frame_cache_obstack); |
| 1109 | } |