]>
Commit | Line | Data |
---|---|---|
dd3b648e RP |
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 | |
99a7de40 JG |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
dd3b648e RP |
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 | |
99a7de40 JG |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
dd3b648e RP |
20 | |
21 | /* Miscellaneous NINDY-dependent routines. | |
22 | Some replace macros normally defined in "tm.h". */ | |
23 | ||
dd3b648e | 24 | #include "defs.h" |
dd3b648e RP |
25 | #include "symtab.h" |
26 | #include "frame.h" | |
27 | ||
28 | /* 'start_frame' is a variable in the NINDY runtime startup routine | |
29 | that contains the frame pointer of the 'start' routine (the routine | |
30 | that calls 'main'). By reading its contents out of remote memory, | |
31 | we can tell where the frame chain ends: backtraces should halt before | |
32 | they display this frame. */ | |
33 | ||
34 | int | |
35 | nindy_frame_chain_valid (chain, curframe) | |
36 | unsigned int chain; | |
37 | FRAME curframe; | |
38 | { | |
39 | struct symbol *sym; | |
1ab3bf1b | 40 | struct minimal_symbol *msymbol; |
dd3b648e RP |
41 | |
42 | /* crtnindy.o is an assembler module that is assumed to be linked | |
43 | * first in an i80960 executable. It contains the true entry point; | |
44 | * it performs startup up initialization and then calls 'main'. | |
45 | * | |
46 | * 'sf' is the name of a variable in crtnindy.o that is set | |
47 | * during startup to the address of the first frame. | |
48 | * | |
49 | * 'a' is the address of that variable in 80960 memory. | |
50 | */ | |
51 | static char sf[] = "start_frame"; | |
52 | CORE_ADDR a; | |
53 | ||
54 | ||
55 | chain &= ~0x3f; /* Zero low 6 bits because previous frame pointers | |
56 | contain return status info in them. */ | |
57 | if ( chain == 0 ){ | |
58 | return 0; | |
59 | } | |
60 | ||
61 | sym = lookup_symbol(sf, 0, VAR_NAMESPACE, (int *)NULL, | |
62 | (struct symtab **)NULL); | |
63 | if ( sym != 0 ){ | |
d41187ef | 64 | a = SYMBOL_VALUE (sym); |
dd3b648e | 65 | } else { |
1ab3bf1b JG |
66 | msymbol = lookup_minimal_symbol (sf, (struct objfile *) NULL); |
67 | if (msymbol == NULL) | |
a65bb55d | 68 | return 0; |
81028ab0 | 69 | a = SYMBOL_VALUE_ADDRESS (msymbol); |
dd3b648e RP |
70 | } |
71 | ||
72 | return ( chain != read_memory_integer(a,4) ); | |
73 | } |