| 1 | /* Target-machine dependent code for the NINDY monitor running on the Intel 960 |
| 2 | Copyright (C) 1991 Free Software Foundation, Inc. |
| 3 | Contributed by Intel Corporation. |
| 4 | |
| 5 | This file is part of GDB. |
| 6 | |
| 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 |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 20 | Boston, MA 02111-1307, USA. */ |
| 21 | |
| 22 | /* Miscellaneous NINDY-dependent routines. |
| 23 | Some replace macros normally defined in "tm.h". */ |
| 24 | |
| 25 | #include "defs.h" |
| 26 | #include "symtab.h" |
| 27 | #include "frame.h" |
| 28 | #include "gdbcore.h" |
| 29 | |
| 30 | /* 'start_frame' is a variable in the NINDY runtime startup routine |
| 31 | that contains the frame pointer of the 'start' routine (the routine |
| 32 | that calls 'main'). By reading its contents out of remote memory, |
| 33 | we can tell where the frame chain ends: backtraces should halt before |
| 34 | they display this frame. */ |
| 35 | |
| 36 | int |
| 37 | nindy_frame_chain_valid (chain, curframe) |
| 38 | CORE_ADDR chain; |
| 39 | struct frame_info *curframe; |
| 40 | { |
| 41 | struct symbol *sym; |
| 42 | struct minimal_symbol *msymbol; |
| 43 | |
| 44 | /* crtnindy.o is an assembler module that is assumed to be linked |
| 45 | * first in an i80960 executable. It contains the true entry point; |
| 46 | * it performs startup up initialization and then calls 'main'. |
| 47 | * |
| 48 | * 'sf' is the name of a variable in crtnindy.o that is set |
| 49 | * during startup to the address of the first frame. |
| 50 | * |
| 51 | * 'a' is the address of that variable in 80960 memory. |
| 52 | */ |
| 53 | static char sf[] = "start_frame"; |
| 54 | CORE_ADDR a; |
| 55 | |
| 56 | |
| 57 | chain &= ~0x3f; /* Zero low 6 bits because previous frame pointers |
| 58 | contain return status info in them. */ |
| 59 | if (chain == 0) |
| 60 | { |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | sym = lookup_symbol (sf, 0, VAR_NAMESPACE, (int *) NULL, |
| 65 | (struct symtab **) NULL); |
| 66 | if (sym != 0) |
| 67 | { |
| 68 | a = SYMBOL_VALUE (sym); |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | msymbol = lookup_minimal_symbol (sf, NULL, NULL); |
| 73 | if (msymbol == NULL) |
| 74 | return 0; |
| 75 | a = SYMBOL_VALUE_ADDRESS (msymbol); |
| 76 | } |
| 77 | |
| 78 | return (chain != read_memory_integer (a, 4)); |
| 79 | } |