aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1996-07-15 23:54:39 +0000
committerStu Grossman <grossman@cygnus>1996-07-15 23:54:39 +0000
commit91550191be931f2f981a3ece49260af7a8e40b4c (patch)
tree298de2cf8df2392d663cf5dfa3903920c871454a
parent3cc21bf6026d36d26f8a250e0005727042c663af (diff)
downloadgdb-91550191be931f2f981a3ece49260af7a8e40b4c.zip
gdb-91550191be931f2f981a3ece49260af7a8e40b4c.tar.gz
gdb-91550191be931f2f981a3ece49260af7a8e40b4c.tar.bz2
* defs.h printcmd.c: Create global disassemble_info structure
tm_print_insn_info. * gdbtk.c (gdb_disassemble): Setup di.mach from tm_print_insn_info.mach, and set endian from TARGET_BYTE_ORDER. * i386-tdep.c (set_assembly_language_command): set tm_print_insn_info.mach to the appropriate value for 386 or 8086 disassembly. * printcmd.c (print_insn): Move init of disassembler_info to _initialize_printcmd. Set endian for disassembler here. * sparc-tdep.c: Set tm_print_insn_info.mach as appropriate to select sparc/sparclite. * config/sparc/{tm-sparc.h tm-sparclite.h}: Get rid of TM_PRINT_INSN. Set TM_PRINT_INSN_MACH to bfd_mach_sparc/bfd_mach_sparc_sparclite.
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/config/sparc/tm-sparc.h2
-rw-r--r--gdb/config/sparc/tm-sparclite.h4
-rw-r--r--gdb/defs.h20
-rw-r--r--gdb/gdbtk.c10
-rw-r--r--gdb/printcmd.c91
-rw-r--r--gdb/sparc-tdep.c4
7 files changed, 96 insertions, 52 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 81fc1ab..fce4a89 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,20 @@
+Mon Jul 15 16:44:05 1996 Stu Grossman (grossman@critters.cygnus.com)
+
+ * defs.h printcmd.c: Create global disassemble_info structure
+ tm_print_insn_info.
+ * gdbtk.c (gdb_disassemble): Setup di.mach from
+ tm_print_insn_info.mach, and set endian from TARGET_BYTE_ORDER.
+ * i386-tdep.c (set_assembly_language_command): set
+ tm_print_insn_info.mach to the appropriate value for 386 or 8086
+ disassembly.
+ * printcmd.c (print_insn): Move init of disassembler_info to
+ _initialize_printcmd. Set endian for disassembler here.
+ * sparc-tdep.c: Set tm_print_insn_info.mach as appropriate to
+ select sparc/sparclite.
+ * config/sparc/{tm-sparc.h tm-sparclite.h}: Get rid of
+ TM_PRINT_INSN. Set TM_PRINT_INSN_MACH to
+ bfd_mach_sparc/bfd_mach_sparc_sparclite.
+
Fri Jul 12 19:04:32 1996 Fred Fish <fnf@cygnus.com>
* hpread.c (hpread_lookup_type): Use xmmalloc/xmrealloc rather
diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h
index cec159d..444bb43 100644
--- a/gdb/config/sparc/tm-sparc.h
+++ b/gdb/config/sparc/tm-sparc.h
@@ -644,4 +644,4 @@ extern int deferred_stores;
/* Select the sparc disassembler */
-#define TM_PRINT_INSN print_insn_sparc
+#define TM_PRINT_INSN_MACH bfd_mach_sparc
diff --git a/gdb/config/sparc/tm-sparclite.h b/gdb/config/sparc/tm-sparclite.h
index 85fd584..b7da03a 100644
--- a/gdb/config/sparc/tm-sparclite.h
+++ b/gdb/config/sparc/tm-sparclite.h
@@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Select the sparclite disassembler. Slightly different instruction set from
the V8 sparc. */
-#undef TM_PRINT_INSN
-#define TM_PRINT_INSN print_insn_sparclite
+#undef TM_PRINT_INSN_MACH
+#define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclite
/* Amount PC must be decremented by after a hardware instruction breakpoint.
This is often the number of bytes in BREAKPOINT
diff --git a/gdb/defs.h b/gdb/defs.h
index d11c6b1..cf2b3f4 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -413,7 +413,7 @@ struct command_line
struct command_line **body_list;
};
-extern struct command_line *read_command_lines PARAMS ((void));
+extern struct command_line *read_command_lines PARAMS ((char *, int));
extern void free_command_lines PARAMS ((struct command_line **));
@@ -902,18 +902,14 @@ extern const struct floatformat floatformat_unknown;
#ifdef HAVE_LONG_DOUBLE
typedef long double DOUBLEST;
-extern void floatformat_to_long_double PARAMS ((const struct floatformat *,
- char *, DOUBLEST *));
-extern void floatformat_from_long_double PARAMS ((const struct floatformat *,
- DOUBLEST *, char *));
-#define FLOATFORMAT_TO_DOUBLEST floatformat_to_long_double
-#define FLOATFORMAT_FROM_DOUBLEST floatformat_from_long_double
#else
typedef double DOUBLEST;
-#define FLOATFORMAT_TO_DOUBLEST floatformat_to_double
-#define FLOATFORMAT_FROM_DOUBLEST floatformat_from_double
#endif
+extern void floatformat_to_doublest PARAMS ((const struct floatformat *,
+ char *, DOUBLEST *));
+extern void floatformat_from_doublest PARAMS ((const struct floatformat *,
+ DOUBLEST *, char *));
extern DOUBLEST extract_floating PARAMS ((void *, int));
extern void store_floating PARAMS ((void *, int, DOUBLEST));
@@ -968,6 +964,7 @@ extern void dis_asm_print_address PARAMS ((bfd_vma addr,
disassemble_info *info));
extern int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info*));
+extern disassemble_info tm_print_insn_info;
/* Hooks for alternate command interfaces. */
@@ -983,7 +980,7 @@ extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer,
extern void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s,
int line, int stopline,
int noerror));
-extern int (*query_hook) PARAMS (());
+extern int (*query_hook) PARAMS ((const char *, va_list));
extern void (*flush_hook) PARAMS ((FILE *stream));
extern void (*create_breakpoint_hook) PARAMS ((struct breakpoint *b));
extern void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
@@ -991,6 +988,9 @@ extern void (*modify_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
extern void (*target_output_hook) PARAMS ((char *));
extern void (*interactive_hook) PARAMS ((void));
extern void (*registers_changed_hook) PARAMS ((void));
+extern void (*readline_begin_hook) PARAMS ((char *, ...));
+extern char * (*readline_hook) PARAMS ((char *));
+extern void (*readline_end_hook) PARAMS ((void));
extern int (*target_wait_hook) PARAMS ((int pid,
struct target_waitstatus *status));
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index 22ef00c..dc57672 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -891,13 +891,19 @@ gdb_disassemble (clientData, interp, argc, argv)
if (! di_initialized)
{
- INIT_DISASSEMBLE_INFO (di, gdb_stdout,
- (fprintf_ftype) fprintf_unfiltered);
+ INIT_DISASSEMBLE_INFO_NO_ARCH (di, gdb_stdout,
+ (fprintf_ftype) fprintf_unfiltered);
di.memory_error_func = dis_asm_memory_error;
di.print_address_func = dis_asm_print_address;
di_initialized = 1;
}
+ di.mach = tm_print_insn_info.mach;
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ tm_print_insn_info.endian = BFD_ENDIAN_BIG;
+ else
+ tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
+
if (argc != 3 && argc != 4)
error ("wrong # args");
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 22fbad5..384fb11 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -16,7 +16,7 @@ GNU General Public License for more details.
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 "gdb_string.h"
@@ -113,6 +113,7 @@ static int display_number;
/* Pointer to the target-dependent disassembly function. */
int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info *));
+disassemble_info tm_print_insn_info;
/* Prototypes for local functions. */
@@ -271,7 +272,8 @@ print_formatted (val, format, size)
register int format;
int size;
{
- int len = TYPE_LENGTH (VALUE_TYPE (val));
+ struct type *type = check_typedef (VALUE_TYPE (val));
+ int len = TYPE_LENGTH (type);
if (VALUE_LVAL (val) == lval_memory)
next_address = VALUE_ADDRESS (val) + len;
@@ -296,14 +298,13 @@ print_formatted (val, format, size)
default:
if (format == 0
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_ARRAY
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_STRING
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_STRUCT
- || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_UNION
- || VALUE_REPEATED (val))
+ || TYPE_CODE (type) == TYPE_CODE_ARRAY
+ || TYPE_CODE (type) == TYPE_CODE_STRING
+ || TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION)
value_print (val, gdb_stdout, format, Val_pretty_default);
else
- print_scalar_formatted (VALUE_CONTENTS (val), VALUE_TYPE (val),
+ print_scalar_formatted (VALUE_CONTENTS (val), type,
format, size, gdb_stdout);
}
}
@@ -324,7 +325,7 @@ print_scalar_formatted (valaddr, type, format, size, stream)
GDB_FILE *stream;
{
LONGEST val_long;
- int len = TYPE_LENGTH (type);
+ unsigned int len = TYPE_LENGTH (type);
if (len > sizeof (LONGEST)
&& (format == 't'
@@ -334,18 +335,23 @@ print_scalar_formatted (valaddr, type, format, size, stream)
|| format == 'd'
|| format == 'x'))
{
- /* We can't print it normally, but we can print it in hex.
- Printing it in the wrong radix is more useful than saying
- "use /x, you dummy". */
- /* FIXME: we could also do octal or binary if that was the
- desired format. */
- /* FIXME: we should be using the size field to give us a minimum
- field width to print. */
- val_print_type_code_int (type, valaddr, stream);
- return;
- }
+ if (! TYPE_UNSIGNED (type)
+ || ! extract_long_unsigned_integer (valaddr, len, &val_long))
+ {
+ /* We can't print it normally, but we can print it in hex.
+ Printing it in the wrong radix is more useful than saying
+ "use /x, you dummy". */
+ /* FIXME: we could also do octal or binary if that was the
+ desired format. */
+ /* FIXME: we should be using the size field to give us a
+ minimum field width to print. */
+ val_print_type_code_int (type, valaddr, stream);
+ return;
+ }
- if (format != 'f')
+ /* If we get here, extract_long_unsigned_integer set val_long. */
+ }
+ else if (format != 'f')
val_long = unpack_long (type, valaddr);
/* If we are printing it as unsigned, truncate it in case it is actually
@@ -684,6 +690,7 @@ do_examine (fmt, addr)
while (count > 0)
{
+ QUIT;
print_address (next_address, gdb_stdout);
printf_filtered (":");
for (i = maxelts;
@@ -1014,6 +1021,21 @@ address_info (exp, from_tty)
gdb_stdout);
break;
+ case LOC_UNRESOLVED:
+ {
+ struct minimal_symbol *msym;
+
+ msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, NULL);
+ if (msym == NULL)
+ printf_filtered ("unresolved");
+ else
+ {
+ printf_filtered ("static storage at address ");
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (msym), 1, gdb_stdout);
+ }
+ }
+ break;
+
case LOC_OPTIMIZED_OUT:
printf_filtered ("optimized out");
break;
@@ -1530,7 +1552,6 @@ print_frame_args (func, fi, num, stream)
case LOC_REF_ARG:
{
long current_offset = SYMBOL_VALUE (sym);
-
arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
/* Compute address of next argument by adding the size of
@@ -1898,9 +1919,10 @@ printf_command (arg, from_tty)
if (argclass[nargs] == double_arg)
{
- if (TYPE_LENGTH (VALUE_TYPE (val_args[nargs])) == sizeof (float))
+ struct type *type = VALUE_TYPE (val_args[nargs]);
+ if (TYPE_LENGTH (type) == sizeof (float))
VALUE_TYPE (val_args[nargs]) = builtin_type_float;
- if (TYPE_LENGTH (VALUE_TYPE (val_args[nargs])) == sizeof (double))
+ if (TYPE_LENGTH (type) == sizeof (double))
VALUE_TYPE (val_args[nargs]) = builtin_type_double;
}
nargs++;
@@ -2058,23 +2080,15 @@ print_insn (memaddr, stream)
CORE_ADDR memaddr;
GDB_FILE *stream;
{
- disassemble_info info;
-
-#define GDB_INIT_DISASSEMBLE_INFO(INFO, STREAM) \
- (INFO).fprintf_func = (fprintf_ftype)fprintf_filtered, \
- (INFO).stream = (STREAM), \
- (INFO).read_memory_func = dis_asm_read_memory, \
- (INFO).memory_error_func = dis_asm_memory_error, \
- (INFO).print_address_func = dis_asm_print_address, \
- (INFO).insn_info_valid = 0
-
- GDB_INIT_DISASSEMBLE_INFO(info, stream);
-
/* If there's no disassembler, something is very wrong. */
if (tm_print_insn == NULL)
abort ();
- return (*tm_print_insn) (memaddr, &info);
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ tm_print_insn_info.endian = BFD_ENDIAN_BIG;
+ else
+ tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
+ return (*tm_print_insn) (memaddr, &tm_print_insn_info);
}
@@ -2229,4 +2243,9 @@ environment, the value is printed in its own window.");
examine_h_type = init_type (TYPE_CODE_INT, 2, 0, "examine_h_type", NULL);
examine_w_type = init_type (TYPE_CODE_INT, 4, 0, "examine_w_type", NULL);
examine_g_type = init_type (TYPE_CODE_INT, 8, 0, "examine_g_type", NULL);
+
+ INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered);
+ tm_print_insn_info.read_memory_func = dis_asm_read_memory;
+ tm_print_insn_info.memory_error_func = dis_asm_memory_error;
+ tm_print_insn_info.print_address_func = dis_asm_print_address;
}
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 2ce7a10..bd85d28 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "obstack.h"
#include "target.h"
#include "value.h"
+#include "bfd.h"
#ifdef USE_PROC_FS
#include <sys/procfs.h>
@@ -1548,5 +1549,6 @@ sparc_print_register_hook (regno)
void
_initialize_sparc_tdep ()
{
- tm_print_insn = TM_PRINT_INSN; /* Selects sparc/sparclite */
+ tm_print_insn = print_insn_sparc;
+ tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */
}