/* Convex stuff for GDB.
- Copyright (C) 1990, 1991 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1991, 1996 Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "command.h"
#include <sys/thread.h>
#include <sys/proc.h>
#include <sys/file.h>
-#include <sys/stat.h>
+#include "gdb_stat.h"
#include <sys/mman.h>
#include "gdbcmd.h"
+CORE_ADDR
+convex_skip_prologue (pc)
+ CORE_ADDR pc;
+{
+ int op, ix;
+ op = read_memory_integer (pc, 2);
+ if ((op & 0xffc7) == 0x5ac0)
+ pc += 2;
+ else if (op == 0x1580)
+ pc += 4;
+ else if (op == 0x15c0)
+ pc += 6;
+ if ((read_memory_integer (pc, 2) & 0xfff8) == 0x7c40
+ && (read_memory_integer (pc + 2, 2) & 0xfff8) == 0x1240
+ && (read_memory_integer (pc + 8, 2) & 0xfff8) == 0x7c48)
+ pc += 10;
+ if (read_memory_integer (pc, 2) == 0x1240)
+ pc += 6;
+ for (;;)
+ {
+ op = read_memory_integer (pc, 2);
+ ix = (op >> 3) & 7;
+ if (ix != 6)
+ break;
+ if ((op & 0xfcc0) == 0x3000)
+ pc += 4;
+ else if ((op & 0xfcc0) == 0x3040)
+ pc += 6;
+ else if ((op & 0xfcc0) == 0x2800)
+ pc += 4;
+ else if ((op & 0xfcc0) == 0x2840)
+ pc += 6;
+ else
+ break;
+ }
+ return pc;
+}
+
+int
+convex_frameless_function_invocation (fi)
+ struct frame_info *fi;
+{
+ int frameless;
+ extern CORE_ADDR text_start, text_end;
+ CORE_ADDR call_addr = SAVED_PC_AFTER_CALL (FI);
+ frameless = (call_addr >= text_start && call_addr < text_end
+ && read_memory_integer (call_addr - 6, 1) == 0x22);
+ return frameless;
+}
+
+int
+convex_frame_num_args (fi)
+ struct frame_info *fi;
+{
+ int numargs = read_memory_integer (FRAME_ARGS_ADDRESS (fi) - 4, 4);
+ if (numargs < 0 || numargs >= 256)
+ numargs = -1;
+ return numargs;
+}
+
exec_file_command (filename, from_tty)
char *filename;
int from_tty;
validate_files ();
}
else if (from_tty)
- printf_filtered ("No exec file now.\n");
+ printf_filtered ("No executable file now.\n");
/* Tell display code (if any) about the changed file name. */
if (exec_file_display_hook)
If it looks like an address, print it in hex instead. */
decout (stream, type, val)
- FILE *stream;
+ GDB_FILE *stream;
struct type *type;
LONGEST val;
{
&& ((lv & 0xf0000000) == 0x80000000
|| ((lv & 0xf0000000) == 0xf0000000 && lv < STACK_END_ADDR)))
{
- fprintf_filtered (stream, "%#x", lv);
+ print_longest (stream, "x", 0, val);
return;
}
case 10:
- fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%llu" : "%lld", val);
+ print_longest (stream, TYPE_UNSIGNED (type) ? "u" : "d", 0, val);
return;
case 8:
- if (TYPE_LENGTH (type) <= sizeof lv)
- fprintf_filtered (stream, "%#o", lv);
- else
- fprintf_filtered (stream, "%#llo", val);
+ print_longest (stream, "o", 0, val);
return;
case 16:
- if (TYPE_LENGTH (type) <= sizeof lv)
- fprintf_filtered (stream, "%#x", lv);
- else
- fprintf_filtered (stream, "%#llx", val);
+ print_longest (stream, "x", 0, val);
return;
}
}