* m2-exp.y: Comment cleanup, mostly periods and spaces.
* m2-lang.c: Ditto.
* m2-typeprint.c: Ditto.
* m2-valprint.c: Ditto.
* m32c-tdep.c: Ditto.
* m32r-linux-nat.c: Ditto.
* m32r-rom.c: Ditto.
* m32r-tdep.c: Ditto.
* m32r-tdep.h: Ditto.
* m68hc11-tdep.c: Ditto.
* m58klinux-nat.c: Ditto.
* m68k-tdep.c: Ditto.
* m88k-tdep.c: Ditto.
* m88k-tdep.h: Ditto.
* machoread.c: Ditto.
* macrocmd.c: Ditto.
* macroexp.c: Ditto.
* macrotab.c: Ditto.
* main.c: Ditto.
* maint.c: Ditto.
* mdebugread.c: Ditto.
* mdebugread.h: Ditto.
* memattr.c: Ditto.
* memattr.h: Ditto.
* memory-map.h: Ditto.
* mep-tdep.c: Ditto.
* microblaze-rom.c: Ditto.
* microblaze-tdep.c: Ditto.
* minsyms.c: Ditto.
* mips-irix-tdep.c: Ditto.
* mips-linux-nat.c: Ditto.
* mips-linux-tdep.c: Ditto.
* mips-linux-tdep.h: Ditto.
* mipsnbsd-nat.c: Ditto.
* mipsnbsd-tdep.c: Ditto.
* mipsread.c: Ditto.
* mips-tdep.c: Ditto.
* mips-tdep.h: Ditto.
* mn10300-linux-tdep.c: Ditto.
* mn10300-tdep.c: Ditto.
* mn10300-tdep.h: Ditto.
* monitor.c: Ditto.
* monitor.h: Ditto.
* moxie-tdep.c: Ditto.
* moxie-tdep.h: Ditto.
* mt-tdep.c: Ditto.
* linux-thread-db.c: Ditto.
* lm32-tdep.c: Ditto.
+2011-01-08 Michael Snyder <msnyder@vmware.com>
+
+ * m2-exp.y: Comment cleanup, mostly periods and spaces.
+ * m2-lang.c: Ditto.
+ * m2-typeprint.c: Ditto.
+ * m2-valprint.c: Ditto.
+ * m32c-tdep.c: Ditto.
+ * m32r-linux-nat.c: Ditto.
+ * m32r-rom.c: Ditto.
+ * m32r-tdep.c: Ditto.
+ * m32r-tdep.h: Ditto.
+ * m68hc11-tdep.c: Ditto.
+ * m58klinux-nat.c: Ditto.
+ * m68k-tdep.c: Ditto.
+ * m88k-tdep.c: Ditto.
+ * m88k-tdep.h: Ditto.
+ * machoread.c: Ditto.
+ * macrocmd.c: Ditto.
+ * macroexp.c: Ditto.
+ * macrotab.c: Ditto.
+ * main.c: Ditto.
+ * maint.c: Ditto.
+ * mdebugread.c: Ditto.
+ * mdebugread.h: Ditto.
+ * memattr.c: Ditto.
+ * memattr.h: Ditto.
+ * memory-map.h: Ditto.
+ * mep-tdep.c: Ditto.
+ * microblaze-rom.c: Ditto.
+ * microblaze-tdep.c: Ditto.
+ * minsyms.c: Ditto.
+ * mips-irix-tdep.c: Ditto.
+ * mips-linux-nat.c: Ditto.
+ * mips-linux-tdep.c: Ditto.
+ * mips-linux-tdep.h: Ditto.
+ * mipsnbsd-nat.c: Ditto.
+ * mipsnbsd-tdep.c: Ditto.
+ * mipsread.c: Ditto.
+ * mips-tdep.c: Ditto.
+ * mips-tdep.h: Ditto.
+ * mn10300-linux-tdep.c: Ditto.
+ * mn10300-tdep.c: Ditto.
+ * mn10300-tdep.h: Ditto.
+ * monitor.c: Ditto.
+ * monitor.h: Ditto.
+ * moxie-tdep.c: Ditto.
+ * moxie-tdep.h: Ditto.
+ * mt-tdep.c: Ditto.
+
2011-01-08 Mike Frysinger <vapier@gentoo.org>
* bfin-tdep.h (BFIN_A0_DOT_W_REGNUM): Fix typo in name.
generator. Doing this with #defines and trying to control the interaction
with include files (<malloc.h> and <stdlib.h> for example) just became
too messy, particularly when such includes can be inserted at random
- times by the parser generator. */
+ times by the parser generator. */
%{
yacc generated parsers in gdb. Note that these are only the variables
produced by yacc. If other parser generators (bison, byacc, etc) produce
additional global names that conflict at link time, then those parser
- generators need to be fixed instead of adding those names to this list. */
+ generators need to be fixed instead of adding those names to this list. */
#define yymaxdepth m2_maxdepth
#define yyparse m2_parse
static int parse_number (int);
-/* The sign of the number being parsed. */
+/* The sign of the number being parsed. */
static int number_sign = 1;
/* The block that the module specified by the qualifer on an identifer is
write_exp_elt_opcode (OP_M2_STRING); }
;
-/* This will be used for extensions later. Like adding modules. */
+/* This will be used for extensions later. Like adding modules. */
block : fblock
{ $$ = SYMBOL_BLOCK_VALUE($1); }
;
write_exp_elt_opcode (OP_VAR_VALUE); }
;
-/* Base case for variables. */
+/* Base case for variables. */
variable: NAME
{ struct symbol *sym;
int is_a_field_of_this;
if(!unsigned_p && number_sign == 1 && (prevn >= n))
unsigned_p=1; /* Try something unsigned */
/* Don't do the range check if n==i and i==0, since that special
- case will give an overflow error. */
+ case will give an overflow error. */
if(RANGE_CHECK && n!=i && i)
{
if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
}
else
{
- /* Built-in BOOLEAN type. This is sort of a hack. */
+ /* Built-in BOOLEAN type. This is sort of a hack. */
if (strncmp (tokstart, "TRUE", 4) == 0)
{
yylval.ulval = 1;
}
}
- /* Must be another type of name... */
+ /* Must be another type of name... */
return NAME;
}
}
m2_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
{
- c &= 0xFF; /* Avoid sign bit follies */
+ c &= 0xFF; /* Avoid sign bit follies. */
if (PRINT_LITERAL_FORM (c))
{
type = TYPE_FIELD_TYPE (type, 0);
if (type == NULL || (TYPE_CODE (type) != TYPE_CODE_PTR))
{
- warning (_("internal error: unbounded array structure is unknown"));
+ warning (_("internal error: unbounded "
+ "array structure is unknown"));
return evaluate_subexp_standard (expect_type, exp, pos, noside);
}
/* i18n: Do not translate the "_m2_contents" part! */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
- NULL, /* Language specific class_name_from_physname */
+ NULL, /* Language specific
+ class_name_from_physname */
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
0, /* String lower bound */
void
-m2_print_type (struct type *type, const char *varstring, struct ui_file *stream,
+m2_print_type (struct type *type, const char *varstring,
+ struct ui_file *stream,
int show, int level)
{
enum type_code code;
break;
case TYPE_CODE_UNDEF:
- /* i18n: Do not translate the "struct" part! */
+ /* i18n: Do not translate the "struct" part! */
m2_unknown (_("undef"), type, stream, show, level);
break;
int
m2_is_long_set (struct type *type)
{
- LONGEST previous_high = 0; /* unnecessary initialization
- keeps gcc -Wall happy */
+ LONGEST previous_high = 0; /* Unnecessary initialization
+ keeps gcc -Wall happy. */
int len, i;
struct type *range;
}
}
else
- /* i18n: Do not translate the "SET OF" part! */
+ /* i18n: Do not translate the "SET OF" part! */
fprintf_filtered(stream, _("SET OF <unknown>"));
return 1;
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
fprintf_filtered (stream, "RECORD\n");
else if (TYPE_CODE (type) == TYPE_CODE_UNION)
- /* i18n: Do not translate "CASE" and "OF" */
+ /* i18n: Do not translate "CASE" and "OF". */
fprintf_filtered (stream, _("CASE <variant> OF\n"));
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
const struct value_print_options *options)
{
struct gdbarch *gdbarch = get_type_arch (type);
- unsigned int i = 0; /* Number of characters printed */
+ unsigned int i = 0; /* Number of characters printed. */
unsigned len;
struct type *elttype;
unsigned eltlen;
{
unsigned int temp_len;
- /* Look for a NULL char. */
+ /* Look for a NULL char. */
for (temp_len = 0;
(valaddr + embedded_offset)[temp_len]
&& temp_len < len && temp_len < options->print_max;
{
fprintf_filtered (stream, "{");
val_print_array_elements (type, valaddr + embedded_offset,
- address, stream, recurse, original_value,
+ address, stream,
+ recurse, original_value,
options, 0);
fprintf_filtered (stream, "}");
}
/* What we have now is the address of a jump instruction.
What we need is the destination of that jump.
- The opcode is 1 byte, and the destination is the next 3 bytes.
- */
+ The opcode is 1 byte, and the destination is the next 3 bytes. */
+
target = read_memory_unsigned_integer (target + 1, 3, byte_order);
return target;
}
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
- internal_error (__FILE__, __LINE__, _("No virtual frame pointer available"));
+ internal_error (__FILE__, __LINE__,
+ _("No virtual frame pointer available"));
m32c_analyze_prologue (gdbarch, func_addr, pc, &p);
switch (p.kind)
}
/* Sanity check */
if (*frame_regnum > gdbarch_num_regs (gdbarch))
- internal_error (__FILE__, __LINE__, _("No virtual frame pointer available"));
+ internal_error (__FILE__, __LINE__,
+ _("No virtual frame pointer available"));
}
\f
They may be in the dwarf2 cfi code in GDB, or they may be in
the debug info emitted by the upstream toolchain. I don't
know which, but I do know that the prologue analyzer works better.
- MVS 04/13/06
- */
+ MVS 04/13/06 */
dwarf2_append_sniffers (arch);
#endif
frame_unwind_append_unwinder (arch, &m32c_unwind);
/* m32c function boundary addresses are not necessarily even.
Therefore, the `vbit', which indicates a pointer to a virtual
member function, is stored in the delta field, rather than as
- the low bit of a function pointer address.
+ the low bit of a function pointer address.
In order to verify this, see the definition of
TARGET_PTRMEMFUNC_VBIT_LOCATION in gcc/defaults.h along with the
#define SPU_REGMAP 23
#define SPI_REGMAP 26
-/* Doee apply to the corresponding SET requests as well. */
-#define GETREGS_SUPPLIES(regno) (0 <= (regno) && (regno) <= M32R_LINUX_NUM_REGS)
+/* Doee (??) apply to the corresponding SET requests as well. */
+#define GETREGS_SUPPLIES(regno) (0 <= (regno) \
+ && (regno) <= M32R_LINUX_NUM_REGS)
\f
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* This module defines communication with the Renesas m32r monitor */
+/* This module defines communication with the Renesas m32r monitor. */
#include "defs.h"
#include "gdbcore.h"
#include <sys/time.h>
#include <time.h> /* for time_t */
#include "gdb_string.h"
-#include "objfiles.h" /* for ALL_OBJFILES etc. */
+#include "objfiles.h" /* for ALL_OBJFILES etc. */
#include "inferior.h"
#include <ctype.h>
#include "regcache.h"
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
&end_time);
- /* Finally, make the PC point at the start address */
+ /* Finally, make the PC point at the start address. */
if (exec_bfd)
regcache_write_pc (get_current_regcache (),
bfd_get_start_address (exec_bfd));
- inferior_ptid = null_ptid; /* No process now */
+ inferior_ptid = null_ptid; /* No process now. */
/* This is necessary because many things were based on the PC at the
time that we attached to the monitor, which is no longer valid
now that we have loaded new code (and just changed the PC).
Another way to do this might be to call normal_stop, except that
the stack may not be valid, and things would get horribly
- confused... */
+ confused... */
clear_symtab_users (0);
}
static void m32r_open (char *args, int from_tty);
static void mon2000_open (char *args, int from_tty);
-/* This array of registers needs to match the indexes used by GDB. The
+/* This array of registers needs to match the indexes used by GDB. The
whole reason this exists is because the various ROM monitors use
different names than GDB does, and don't support all the registers
- either. So, typing "info reg sp" becomes an "A7". */
+ either. So, typing "info reg sp" becomes an "A7". */
static char *m32r_regnames[] =
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
return; /* no match */
if (regno == ACCL_REGNUM)
- { /* special handling for 64-bit acc reg */
+ { /* Special handling for 64-bit acc reg. */
monitor_supply_register (regcache, ACCH_REGNUM, val);
- val = strchr (val, ':'); /* skip past ':' to get 2nd word */
+ val = strchr (val, ':'); /* Skip past ':' to get 2nd word. */
if (val != NULL)
monitor_supply_register (regcache, ACCL_REGNUM, val + 1);
}
#ifdef SM_REGNUM
/* Stack mode bit */
- monitor_supply_register (regcache, SM_REGNUM, (psw & 0x80) ? one : zero);
+ monitor_supply_register (regcache, SM_REGNUM,
+ (psw & 0x80) ? one : zero);
#endif
#ifdef BSM_REGNUM
/* Backup stack mode bit */
- monitor_supply_register (regcache, BSM_REGNUM, (psw & 0x8000) ? one : zero);
+ monitor_supply_register (regcache, BSM_REGNUM,
+ (psw & 0x8000) ? one : zero);
#endif
#ifdef IE_REGNUM
/* Interrupt enable bit */
- monitor_supply_register (regcache, IE_REGNUM, (psw & 0x40) ? one : zero);
+ monitor_supply_register (regcache, IE_REGNUM,
+ (psw & 0x40) ? one : zero);
#endif
#ifdef BIE_REGNUM
/* Backup interrupt enable bit */
- monitor_supply_register (regcache, BIE_REGNUM, (psw & 0x4000) ? one : zero);
+ monitor_supply_register (regcache, BIE_REGNUM,
+ (psw & 0x4000) ? one : zero);
#endif
#ifdef COND_REGNUM
/* Condition bit (carry etc.) */
- monitor_supply_register (regcache, COND_REGNUM, (psw & 0x1) ? one : zero);
+ monitor_supply_register (regcache, COND_REGNUM,
+ (psw & 0x1) ? one : zero);
#endif
#ifdef CBR_REGNUM
- monitor_supply_register (regcache, CBR_REGNUM, (psw & 0x1) ? one : zero);
+ monitor_supply_register (regcache, CBR_REGNUM,
+ (psw & 0x1) ? one : zero);
#endif
#ifdef BPC_REGNUM
- monitor_supply_register (regcache, BPC_REGNUM, zero); /* KLUDGE: (???????) */
+ monitor_supply_register (regcache, BPC_REGNUM,
+ zero); /* KLUDGE: (???????) */
#endif
#ifdef BCARRY_REGNUM
- monitor_supply_register (regcache, BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
+ monitor_supply_register (regcache, BCARRY_REGNUM,
+ zero); /* KLUDGE: (??????) */
#endif
}
if (regno == SPI_REGNUM || regno == SPU_REGNUM)
- { /* special handling for stack pointer (spu or spi) */
+ { /* special handling for stack pointer (spu or spi). */
ULONGEST stackmode, psw;
regcache_cooked_read_unsigned (regcache, PSW_REGNUM, &psw);
stackmode = psw & 0x80;
m32r_cmds.getreg.term = NULL; /* getreg.term */
m32r_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
m32r_cmds.dump_registers = ".reg\r"; /* dump_registers */
- m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
+ /* register_pattern */
+ m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";
m32r_cmds.supply_register = m32r_supply_register;
m32r_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
m32r_cmds.load = NULL; /* download command */
mon2000_cmds.getreg.term = NULL; /* getreg.term */
mon2000_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
mon2000_cmds.dump_registers = ".reg\r"; /* dump_registers */
- mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
+ /* register_pattern */
+ mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";
mon2000_cmds.supply_register = m32r_supply_register;
mon2000_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
mon2000_cmds.load = NULL; /* download command */
struct hostent *hostent;
struct in_addr inet_addr;
- /* first check to see if there's an ethernet port! */
+ /* First check to see if there's an ethernet port! */
monitor_printf ("ust\r");
resp_len = monitor_expect_prompt (buf, sizeof (buf));
if (!strchr (buf, ':'))
if (board_addr == 0)
{
- /* scan second colon in the output from the "ust" command */
+ /* Scan second colon in the output from the "ust" command. */
char *myIPaddress = strchr (strchr (buf, ':') + 1, ':') + 1;
while (isspace (*myIPaddress))
myIPaddress++;
if (!strncmp (myIPaddress, "0.0.", 4)) /* empty */
- error
- ("Please use 'set board-address' to set the M32R-EVA board's IP address.");
+ error ("Please use 'set board-address' to "
+ "set the M32R-EVA board's IP address.");
if (strchr (myIPaddress, '('))
*(strchr (myIPaddress, '(')) = '\0'; /* delete trailing junk */
board_addr = xstrdup (myIPaddress);
{
#ifdef __MINGW32__
WSADATA wd;
- /* Winsock initialization. */
+ /* Winsock initialization. */
if (WSAStartup (MAKEWORD (1, 1), &wd))
error (_("Couldn't initialize WINSOCK."));
#endif
#endif
}
}
- if (server_addr == 0) /* failed? */
- error
- ("Need to know gdb host computer's IP address (use 'set server-address')");
+ if (server_addr == 0) /* failed? */
+ error ("Need to know gdb host computer's "
+ "IP address (use 'set server-address')");
}
- if (args == 0 || args[0] == 0) /* no args: upload the current file */
+ if (args == 0 || args[0] == 0) /* No args: upload the current
+ file. */
args = get_exec_file (1);
if (args[0] != '/' && download_path == 0)
if (current_directory)
download_path = xstrdup (current_directory);
else
- error
- ("Need to know default download path (use 'set download-path')");
+ error ("Need to know default download "
+ "path (use 'set download-path')");
}
gettimeofday (&start_time, NULL);
monitor_printf ("uhip %s\r", server_addr);
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+ resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
monitor_printf ("ulip %s\r", board_addr);
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+ resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
if (args[0] != '/')
monitor_printf ("up %s\r", download_path); /* use default path */
else
monitor_printf ("up\r"); /* rooted filename/path */
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+ resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
if (strrchr (args, '.') && !strcmp (strrchr (args, '.'), ".srec"))
monitor_printf ("ul %s\r", args);
else /* add ".srec" suffix */
monitor_printf ("ul %s.srec\r", args);
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+ resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
if (buf[0] == 0 || strstr (buf, "complete") == 0)
- error
- ("Upload file not found: %s.srec\nCheck IP addresses and download path.",
+ error ("Upload file not found: %s.srec\n"
+ "Check IP addresses and download path.",
args);
else
printf_filtered (" -- Ethernet load complete.\n");
gettimeofday (&end_time, NULL);
abfd = bfd_openr (args, 0);
if (abfd != NULL)
- { /* Download is done -- print section statistics */
+ { /* Download is done -- print section statistics. */
if (bfd_check_format (abfd, bfd_object) == 0)
{
printf_filtered ("File is not an object file\n");
printf_filtered ("\n");
gdb_flush (gdb_stdout);
}
- /* Finally, make the PC point at the start address */
+ /* Finally, make the PC point at the start address. */
regcache_write_pc (get_current_regcache (),
bfd_get_start_address (abfd));
printf_filtered ("Start address 0x%lx\n",
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
&end_time);
}
- inferior_ptid = null_ptid; /* No process now */
+ inferior_ptid = null_ptid; /* No process now. */
/* This is necessary because many things were based on the PC at the
time that we attached to the monitor, which is no longer valid
now that we have loaded new code (and just changed the PC).
Another way to do this might be to call normal_stop, except that
the stack may not be valid, and things would get horribly
- confused... */
+ confused... */
clear_symtab_users (0);
}
void
_initialize_m32r_rom (void)
{
- /* Initialize m32r RevC monitor target */
+ /* Initialize m32r RevC monitor target. */
init_m32r_cmds ();
init_monitor_ops (&m32r_ops);
m32r_ops.to_shortname = "m32r";
m32r_ops.to_longname = "m32r monitor";
- m32r_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
+ m32r_ops.to_load = m32r_load_gen; /* Monitor lacks a download
+ command. */
m32r_ops.to_doc = "Debug via the m32r monitor.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).";
m32r_ops.to_open = m32r_open;
mon2000_ops.to_shortname = "mon2000";
mon2000_ops.to_longname = "Mon2000 monitor";
- mon2000_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
+ mon2000_ops.to_load = m32r_load_gen; /* Monitor lacks a download
+ command. */
mon2000_ops.to_doc = "Debug via the Mon2000 monitor.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).";
mon2000_ops.to_open = mon2000_open;
Show the default path for downloadable SREC files."), _("\
Determines the default path for downloadable SREC files."),
NULL,
- NULL, /* FIXME: i18n: The default path for downloadable SREC files is %s. */
+ NULL, /* FIXME: i18n: The default path for
+ downloadable SREC files is %s. */
&setlist, &showlist);
add_setshow_string_cmd ("board-address", class_obscure, &board_addr, _("\
Show IP address for M32R-EVA target board."), _("\
Determine the IP address for M32R-EVA target board."),
NULL,
- NULL, /* FIXME: i18n: IP address for M32R-EVA target board is %s. */
+ NULL, /* FIXME: i18n: IP address for
+ M32R-EVA target board is %s. */
&setlist, &showlist);
add_setshow_string_cmd ("server-address", class_obscure, &server_addr, _("\
Show IP address for download server (GDB's host computer)."), _("\
Determine the IP address for download server (GDB's host computer)."),
NULL,
- NULL, /* FIXME: i18n: IP address for download server (GDB's host computer) is %s. */
+ NULL, /* FIXME: i18n: IP address for
+ download server (GDB's host
+ computer) is %s. */
&setlist, &showlist);
add_com ("upload", class_obscure, m32r_upload_command, _("\
/* Breakpoints
- The little endian mode of M32R is unique. In most of architectures,
+ The little endian mode of M32R is unique. In most of architectures,
two 16-bit instructions, A and B, are placed as the following:
Big endian:
This is because M32R always fetches instructions in 32-bit.
- The following functions take care of this behavior. */
+ The following functions take care of this behavior. */
static int
m32r_memory_insert_breakpoint (struct gdbarch *gdbarch,
}
static const gdb_byte *
-m32r_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
+m32r_breakpoint_from_pc (struct gdbarch *gdbarch,
+ CORE_ADDR *pcptr, int *lenptr)
{
- static gdb_byte be_bp_entry[] = { 0x10, 0xf1, 0x70, 0x00 }; /* dpt -> nop */
- static gdb_byte le_bp_entry[] = { 0x00, 0x70, 0xf1, 0x10 }; /* dpt -> nop */
+ static gdb_byte be_bp_entry[] = {
+ 0x10, 0xf1, 0x70, 0x00
+ }; /* dpt -> nop */
+ static gdb_byte le_bp_entry[] = {
+ 0x00, 0x70, 0xf1, 0x10
+ }; /* dpt -> nop */
gdb_byte *bp;
/* Determine appropriate breakpoint. */
/* Write into appropriate registers a function return value
- of type TYPE, given in virtual format.
+ of type TYPE, given in virtual format.
- Things always get returned in RET1_REGNUM, RET2_REGNUM. */
+ Things always get returned in RET1_REGNUM, RET2_REGNUM. */
static void
m32r_store_return_value (struct type *type, struct regcache *regcache,
}
}
-/* This is required by skip_prologue. The results of decoding a prologue
+/* This is required by skip_prologue. The results of decoding a prologue
should be cached because this thrashing is getting nuts. */
static int
for (current_pc = start_pc; current_pc < scan_limit; current_pc += 2)
{
- /* Check if current pc's location is readable. */
+ /* Check if current pc's location is readable. */
if (!safe_read_memory_integer (current_pc, 2, byte_order, &return_value))
return -1;
break;
/* If this is a 32 bit instruction, we dont want to examine its
- immediate data as though it were an instruction */
+ immediate data as though it were an instruction. */
if (current_pc & 0x02)
{
- /* decode this instruction further */
+ /* Decode this instruction further. */
insn &= 0x7fff;
}
else
current_pc += 2; /* skip the immediate data */
- /* Check if current pc's location is readable. */
+ /* Check if current pc's location is readable. */
if (!safe_read_memory_integer (current_pc, 2, byte_order,
&return_value))
return -1;
}
else
{
- if (((insn >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
+ if (((insn >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
&& safe_read_memory_integer (current_pc + 2,
2, byte_order,
&return_value)
&& read_memory_unsigned_integer (current_pc + 2,
2, byte_order)
== 0x0f24)
- /* subtract 24 bit sign-extended negative-offset */
{
+ /* Subtract 24 bit sign-extended negative-offset. */
insn = read_memory_unsigned_integer (current_pc - 2,
4, byte_order);
if (insn & 0x00800000) /* sign extend */
continue;
}
}
- op1 = insn & 0xf000; /* isolate just the first nibble */
+ op1 = insn & 0xf000; /* Isolate just the first nibble. */
if ((insn & 0xf0ff) == 0x207f)
{ /* st reg, @-sp */
continue;
}
if ((insn >> 8) == 0x4f) /* addi sp, xx */
- /* add 8 bit sign-extended offset */
+ /* Add 8 bit sign-extended offset. */
{
int stack_adjust = (signed char) (insn & 0xff);
break; /* end of stack adjustments */
}
- /* Nop looks like a branch, continue explicitly */
+ /* Nop looks like a branch, continue explicitly. */
if (insn == 0x7000)
{
after_prologue = current_pc + 2;
- continue; /* nop occurs between pushes */
+ continue; /* nop occurs between pushes. */
}
- /* End of prolog if any of these are trap instructions */
+ /* End of prolog if any of these are trap instructions. */
if ((insn & 0xfff0) == 0x10f0)
{
after_prologue = current_pc;
break;
}
- /* End of prolog if any of these are branch instructions */
+ /* End of prolog if any of these are branch instructions. */
if ((op1 == 0x7000) || (op1 == 0xb000) || (op1 == 0xf000))
{
after_prologue = current_pc;
continue;
}
- /* Some of the branch instructions are mixed with other types */
+ /* Some of the branch instructions are mixed with other types. */
if (op1 == 0x1000)
{
int subop = insn & 0x0ff0;
if (after_stack_adjust != 0)
/* We did not find a "mv fp,sp", but we DID find
a stack_adjust. Is it safe to use that as the
- end of the prologue? I just don't know. */
+ end of the prologue? I just don't know. */
{
*pl_endptr = after_stack_adjust;
}
else if (after_push != 0)
/* We did not find a "mv fp,sp", but we DID find
a push. Is it safe to use that as the
- end of the prologue? I just don't know. */
+ end of the prologue? I just don't know. */
{
*pl_endptr = after_push;
}
else
/* We reached the end of the loop without finding the end
- of the prologue. No way to win -- we should report failure.
- The way we do that is to return the original start_pc.
- GDB will set a breakpoint at the start of the function (etc.) */
+ of the prologue. No way to win -- we should report
+ failure. The way we do that is to return the original
+ start_pc. GDB will set a breakpoint at the start of
+ the function (etc.) */
*pl_endptr = start_pc;
}
return 0;
} /* decode_prologue */
/* Function: skip_prologue
- Find end of function prologue */
+ Find end of function prologue. */
#define DEFAULT_SEARCH_LIMIT 128
struct symtab_and_line sal;
LONGEST return_value;
- /* See what the symbol table says */
+ /* See what the symbol table says. */
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
else
func_end = pc + DEFAULT_SEARCH_LIMIT;
- /* If pc's location is not readable, just quit. */
+ /* If pc's location is not readable, just quit. */
if (!safe_read_memory_integer (pc, 4, byte_order, &return_value))
return pc;
the saved registers of frame described by FRAME_INFO. This
includes special registers such as pc and fp saved in special ways
in the stack frame. sp is even more special: the address we return
- for it IS the sp for the next frame. */
+ for it IS the sp for the next frame. */
static struct m32r_unwind_cache *
m32r_frame_unwind_cache (struct frame_info *this_frame,
}
else if ((op & 0xfff0) == 0x10f0)
{
- /* end of prologue if this is a trap instruction */
- break; /* end of stack adjustments */
+ /* End of prologue if this is a trap instruction. */
+ break; /* End of stack adjustments. */
}
}
int len;
int odd_sized_struct;
- /* first force sp to a 4-byte alignment */
+ /* First force sp to a 4-byte alignment. */
sp = sp & ~3;
/* Set the return address. For the m32r, the return breakpoint is
argreg++;
}
- /* Now make sure there's space on the stack */
+ /* Now make sure there's space on the stack. */
for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++)
stack_alloc += ((TYPE_LENGTH (value_type (args[argnum])) + 3) & ~3);
- sp -= stack_alloc; /* make room on stack for args */
+ sp -= stack_alloc; /* Make room on stack for args. */
for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
{
}
else if (len < 4)
{
- /* value gets right-justified in the register or stack word */
+ /* Value gets right-justified in the register or stack word. */
memcpy (valbuf + (register_size (gdbarch, argreg) - len),
(gdb_byte *) value_contents (args[argnum]), len);
val = valbuf;
{
if (argreg > ARGN_REGNUM)
{
- /* must go on the stack */
+ /* Must go on the stack. */
write_memory (sp + stack_offset, val, 4);
stack_offset += 4;
}
else if (argreg <= ARGN_REGNUM)
{
- /* there's room in a register */
+ /* There's room in a register. */
regval =
extract_unsigned_integer (val,
register_size (gdbarch, argreg),
store_unsigned_integer (valbuf, (len > 4 ? len - 4 : len), byte_order, tmp);
/* Ignore return values more than 8 bytes in size because the m32r
- returns anything more than 8 bytes in the stack. */
+ returns anything more than 8 bytes in the stack. */
if (len > 4)
{
regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp);
set_gdbarch_write_pc (gdbarch, m32r_write_pc);
set_gdbarch_unwind_sp (gdbarch, m32r_unwind_sp);
- set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS);
+
set_gdbarch_sp_regnum (gdbarch, M32R_SP_REGNUM);
set_gdbarch_register_name (gdbarch, m32r_register_name);
set_gdbarch_register_type (gdbarch, m32r_register_type);
struct gdbarch_tdep
{
- /* gdbarch target dependent data here. Currently unused for M32R. */
+ /* gdbarch target dependent data here. Currently unused for M32R. */
};
-/* m32r register names. */
+/* m32r register names. */
enum m32r_regnum
{
SPU_REGNUM = 18,
SPI_REGNUM = 19,
M32R_PC_REGNUM = 21,
- /* m32r calling convention. */
+ /* m32r calling convention. */
ARG1_REGNUM = R0_REGNUM,
ARGN_REGNUM = R3_REGNUM,
RET1_REGNUM = R0_REGNUM,
MSYMBOL_IS_RTC Tests the "RTC" bit in a minimal symbol.
MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. */
-#define MSYMBOL_SET_RTC(msym) \
+#define MSYMBOL_SET_RTC(msym) \
MSYMBOL_TARGET_FLAG_1 (msym) = 1
-#define MSYMBOL_SET_RTI(msym) \
+#define MSYMBOL_SET_RTI(msym) \
MSYMBOL_TARGET_FLAG_2 (msym) = 1
#define MSYMBOL_IS_RTC(msym) \
}
\f
-/* 68HC11 & 68HC12 prologue analysis.
+/* 68HC11 & 68HC12 prologue analysis. */
- */
#define MAX_CODES 12
/* 68HC11 opcodes. */
We limit the search to 128 bytes so that the algorithm is bounded
in case of random and wrong code. We also stop and abort if
we find an instruction which is not supposed to appear in the
- prologue (as generated by gcc 2.95, 2.96).
- */
+ prologue (as generated by gcc 2.95, 2.96). */
+
func_end = pc + 128;
found_frame_point = 0;
info->size = 0;
{
ULONGEST pc;
- pc = frame_unwind_register_unsigned (next_frame, gdbarch_pc_regnum (gdbarch));
+ pc = frame_unwind_register_unsigned (next_frame,
+ gdbarch_pc_regnum (gdbarch));
return pc;
}
the saved registers of frame described by FRAME_INFO. This
includes special registers such as pc and fp saved in special ways
in the stack frame. sp is even more special: the address we return
- for it IS the sp for the next frame. */
+ for it IS the sp for the next frame. */
static struct m68hc11_unwind_cache *
m68hc11_frame_unwind_cache (struct frame_info *this_frame,
}
/* Add 1 here to adjust for the post-decrement nature of the push
- instruction.*/
+ instruction. */
info->prev_sp = prev_sp;
info->base = this_base;
V = (l & M6811_V_BIT) != 0;
C = (l & M6811_C_BIT) != 0;
- /* Print flags following the h8300 */
+ /* Print flags following the h8300. */
if ((C | Z) == 0)
fprintf_filtered (file, "u> ");
else if ((C | Z) == 1)
else
elf_flags = 0;
- /* try to find a pre-existing architecture */
+ /* Try to find a pre-existing architecture. */
for (arches = gdbarch_list_lookup_by_info (arches, &info);
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
return arches->gdbarch;
}
- /* Need a new architecture. Fill in a target specific vector. */
+ /* Need a new architecture. Fill in a target specific vector. */
tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
return gdbarch;
}
-extern initialize_file_ftype _initialize_m68hc11_tdep; /* -Wmissing-prototypes */
+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_m68hc11_tdep;
void
_initialize_m68hc11_tdep (void)
#define P_MOVEL_SP 0x2f00
#define P_MOVEML_SP 0x48e7
-/* Offset from SP to first arg on stack at first instruction of a function */
+/* Offset from SP to first arg on stack at first instruction of a function. */
#define SP_ARG0 (1 * 4)
#if !defined (BPT_VECTOR)
};
/* Function: m68k_register_name
- Returns the name of the standard m68k register regnum. */
+ Returns the name of the standard m68k register regnum. */
static const char *
m68k_register_name (struct gdbarch *gdbarch, int regnum)
{
if (regnum < 0 || regnum >= ARRAY_SIZE (m68k_register_names))
internal_error (__FILE__, __LINE__,
- _("m68k_register_name: illegal register number %d"), regnum);
+ _("m68k_register_name: illegal register number %d"),
+ regnum);
else if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM
&& gdbarch_tdep (gdbarch)->fpregs_present == 0)
return "";
needs any special handling. */
static int
-m68k_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
+m68k_convert_register_p (struct gdbarch *gdbarch,
+ int regnum, struct type *type)
{
if (!gdbarch_tdep (gdbarch)->fpregs_present)
return 0;
/* Figure out where the longjmp will land. Slurp the args out of the stack.
We expect the first arg to be a pointer to the jmp_buf structure from which
we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
- This routine returns true on success. */
+ This routine returns true on success. */
static int
m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
buf = alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
sp = get_frame_register_unsigned (frame, gdbarch_sp_regnum (gdbarch));
- if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */
+ if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack. */
buf, gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
return 0;
/* Function: m68k_gdbarch_init
Initializer function for the m68k gdbarch vector.
- Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
+ Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
static struct gdbarch *
m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* The mechanism for returning floating values from function
and the type of long double depend on whether we're
- on ColdFire or standard m68k. */
+ on ColdFire or standard m68k. */
if (info.bfd_arch_info && info.bfd_arch_info->mach != 0)
{
set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
set_gdbarch_breakpoint_from_pc (gdbarch, m68k_local_breakpoint_from_pc);
- /* Stack grows down. */
+ /* Stack grows down. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_frame_align (gdbarch, m68k_frame_align);
tdep->float_return = 0;
}
- /* Function call & return */
+ /* Function call & return. */
set_gdbarch_push_dummy_call (gdbarch, m68k_push_dummy_call);
set_gdbarch_return_value (gdbarch, m68k_return_value);
#include "target.h"
-/* Prototypes for supply_gregset etc. */
+/* Prototypes for supply_gregset etc. */
#include "gregset.h"
\f
/* This table must line up with gdbarch_register_name in "m68k-tdep.c". */
char buf[MAX_REGISTER_SIZE];
int tid;
- /* Overload thread id onto process id */
+ /* Overload thread id onto process id. */
tid = TIDGET (inferior_ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid); /* no thread id, just use process id */
+ tid = PIDGET (inferior_ptid); /* no thread id, just use
+ process id. */
regaddr = 4 * regmap[regno];
for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
/* Fetch register values from the inferior.
If REGNO is negative, do this for all registers.
- Otherwise, REGNO specifies which register (so we can save time). */
+ Otherwise, REGNO specifies which register (so we can save time). */
static void
old_fetch_inferior_registers (struct regcache *regcache, int regno)
}
}
-/* Store one register. */
+/* Store one register. */
static void
store_register (const struct regcache *regcache, int regno)
int tid;
char buf[MAX_REGISTER_SIZE];
- /* Overload thread id onto process id */
+ /* Overload thread id onto process id. */
tid = TIDGET (inferior_ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid); /* no thread id, just use process id */
+ tid = PIDGET (inferior_ptid); /* no thread id, just use
+ process id. */
regaddr = 4 * regmap[regno];
- /* Put the contents of regno into a local buffer */
+ /* Put the contents of regno into a local buffer. */
regcache_raw_collect (regcache, regno, buf);
- /* Store the local buffer into the inferior a chunk at the time. */
+ /* Store the local buffer into the inferior a chunk at the time. */
for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
{
errno = 0;
\f
/* Given a pointer to a general register set in /proc format
(elf_gregset_t *), unpack the register contents and supply
- them as gdb's idea of the current register values. */
+ them as gdb's idea of the current register values. */
void
supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
#else
-static void fetch_regs (struct regcache *regcache, int tid) {}
-static void store_regs (const struct regcache *regcache, int tid, int regno) {}
+static void fetch_regs (struct regcache *regcache, int tid)
+{
+}
+
+static void store_regs (const struct regcache *regcache, int tid, int regno)
+{
+}
#endif
#else
-static void fetch_fpregs (struct regcache *regcache, int tid) {}
-static void store_fpregs (const struct regcache *regcache, int tid, int regno) {}
+static void fetch_fpregs (struct regcache *regcache, int tid)
+{
+}
+
+static void store_fpregs (const struct regcache *regcache, int tid, int regno)
+{
+}
#endif
\f
/* GNU/Linux LWP ID's are process ID's. */
tid = TIDGET (inferior_ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
transfers more registers in one system call, and we'll cache the
}
/* Return the GDB type object for the "standard" data type of data in
- register REGNUM. */
+ register REGNUM. */
static struct type *
m88k_register_type (struct gdbarch *gdbarch, int regnum)
set_gdbarch_push_dummy_call (gdbarch, m88k_push_dummy_call);
set_gdbarch_dummy_id (gdbarch, m88k_dummy_id);
- /* Return value info */
+ /* Return value info. */
set_gdbarch_return_value (gdbarch, m88k_return_value);
set_gdbarch_addr_bits_remove (gdbarch, m88k_addr_bits_remove);
M88K_R3_REGNUM,
M88K_R12_REGNUM = 12,
M88K_R30_REGNUM = 30, /* Frame pointer. */
- M88K_R31_REGNUM, /* Stack pointer. */
+ M88K_R31_REGNUM, /* Stack pointer. */
M88K_EPSR_REGNUM,
M88K_FPSR_REGNUM,
M88K_FPCR_REGNUM,
during the link.
Each time an oso (other source) is found in the executable, the reader
creates such a structure. They are read after the processing of the
- executable.
-*/
+ executable. */
+
typedef struct oso_el
{
/* Object file name. */
if (sym->name == NULL || *sym->name == '\0')
{
/* Skip names that don't exist (shouldn't happen), or names
- that are null strings (may happen). */
+ that are null strings (may happen). */
continue;
}
struct minimal_symbol *msym;
CORE_ADDR symaddr;
- /* Bfd symbols are section relative. */
+ /* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
/* Select global/local/weak symbols. Note that bfd puts abs
symbols in their own section, so all symbols we are
- interested in will have a section. */
+ interested in will have a section. */
/* Relocate all non-absolute and non-TLS symbols by the
section offset. */
if (sym->section != &bfd_abs_section
ms_type = mst_unknown;
}
else
- continue; /* Skip this symbol. */
+ continue; /* Skip this symbol. */
gdb_assert (sym->section->index < nbr_sections);
if (oso_file != NULL
{
alloced *= 2;
argv = (char **) xrealloc (argv, alloced * sizeof (char *));
- /* Must update new_macro as well... */
+ /* Must update new_macro as well... */
new_macro.argv = (const char * const *) argv;
}
argv[new_macro.argc] = extract_identifier (&exp, 1);
init_shared_buffer (tok, start, end - start);
tok->last_token = 0;
- /* Presumed; get_identifier may overwrite this. */
+ /* Presumed; get_identifier may overwrite this. */
tok->is_identifier = 0;
}
particular macro, and otherwise delegates the decision to another
function/baton pair. But that makes the linked list of excluded
macros chained through untyped baton pointers, which will make it
- harder to debug. :( */
+ harder to debug. :( */
static int
currently_rescanning (struct macro_name_list *list, const char *name)
{
its expansion to DEST. SRC is the input text following the ID
token. We are currently rescanning the expansions of the macros
named in NO_LOOP; don't re-expand them. Use LOOKUP_FUNC and
- LOOKUP_BATON to find definitions for any nested macro references.
+ LOOKUP_BATON to find definitions for any nested macro references.
Return 1 if we decided to expand it, zero otherwise. (If it's a
function-like macro name that isn't followed by an argument list,
struct macro_table *table;
/* The name of the macro. This is in the table's bcache, if it has
- one. */
+ one. */
const char *name;
/* The source file and line number where the definition's scope
/* If the .gdbinit file in the current directory is the same as
the $HOME/.gdbinit file, it should not be sourced. homebuf
- and cwdbuf are used in that purpose. Make sure that the stats
+ and cwdbuf are used in that purpose. Make sure that the stats
are zero in case one of them fails (this guarantees that they
won't match if either exists). */
check to detect bad FUNCs code. */
do_cleanups (ALL_CLEANUPS);
/* If the command_loop returned, normally (rather than threw an
- error) we try to quit. If the quit is aborted, catch_errors()
+ error) we try to quit. If the quit is aborted, catch_errors()
which called this catch the signal and restart the command
loop. */
quit_command (NULL, instream == stdin);
break;
case 'f':
annotation_level = 1;
-/* We have probably been invoked from emacs. Disable window interface. */
+ /* We have probably been invoked from emacs. Disable
+ window interface. */
use_windows = 0;
break;
case 's':
(optind == argc - 1) ? "" : " ...");
}
- /* Lookup gdbinit files. Note that the gdbinit file name may be
+ /* Lookup gdbinit files. Note that the gdbinit file name may be
overriden during file initialization, so get_init_files should be
called after gdb_init. */
get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
/* Stimulate the internal error mechanism that GDB uses when an
internal problem is detected. Allows testing of the mechanism.
Also useful when the user wants to drop a core file but not exit
- GDB. */
+ GDB. */
static void
maintenance_internal_error (char *args, int from_tty)
/* Stimulate the internal error mechanism that GDB uses when an
internal problem is detected. Allows testing of the mechanism.
Also useful when the user wants to drop a core file but not exit
- GDB. */
+ GDB. */
static void
maintenance_internal_warning (char *args, int from_tty)
debuggee's process space, and have gdb fetch and demangle that
string. If we have a char* pointer "ptr" that points to a string,
we might want to be able to given just the name and have GDB
- demangle and print what it points to, etc. (FIXME) */
+ demangle and print what it points to, etc. (FIXME) */
static void
maintenance_demangle (char *args, int from_tty)
while ((tok = strstr (string, substr)) != NULL)
{
- /* Got a partial match. Is it a whole word? */
+ /* Got a partial match. Is it a whole word? */
if (tok == string
|| tok[-1] == ' '
|| tok[-1] == '\t')
{
- /* Token is delimited at the front... */
+ /* Token is delimited at the front... */
if (tok[substr_len] == ' '
|| tok[substr_len] == '\t'
|| tok[substr_len] == '\0')
/* The "maintenance translate-address" command converts a section and address
to a symbol. This can be called in two ways:
maintenance translate-address <secname> <addr>
- or maintenance translate-address <addr>
- */
+ or maintenance translate-address <addr>. */
static void
maintenance_translate_address (char *arg, int from_tty)
p = arg;
if (!isdigit (*p))
- { /* See if we have a valid section name */
- while (*p && !isspace (*p)) /* Find end of section name */
+ { /* See if we have a valid section name. */
+ while (*p && !isspace (*p)) /* Find end of section name. */
p++;
- if (*p == '\000') /* End of command? */
+ if (*p == '\000') /* End of command? */
error (_("Need to specify <section-name> and <address>"));
*p++ = '\000';
while (isspace (*p))
- p++; /* Skip whitespace */
+ p++; /* Skip whitespace. */
ALL_OBJSECTIONS (objfile, sect)
{
/* When a command is deprecated the user will be warned the first time
the command is used. If possible, a replacement will be
- offered. */
+ offered. */
static void
maintenance_deprecate (char *args, int from_tty)
}
-/* You really shouldn't be using this. It is just for the testsuite.
+/* You really shouldn't be using this. It is just for the testsuite.
Rather, you should use deprecate_cmd() when the command is created
in _initialize_blah().
if (deprecate)
{
- /* look for a replacement command */
+ /* Look for a replacement command. */
start_ptr = strchr (text, '\"');
if (start_ptr != NULL)
{
Note the MALLOCED_REPLACEMENT test. If the command's replacement
string was allocated at compile time we don't want to free the
- memory. */
+ memory. */
if (alias)
{
if (alias->flags & MALLOCED_REPLACEMENT)
#include "bfd.h"
-#include "coff/ecoff.h" /* COFF-like aspects of ecoff files */
+#include "coff/ecoff.h" /* COFF-like aspects of ecoff files. */
#include "libaout.h" /* Private BFD a.out information. */
#include "aout/aout64.h"
-#include "aout/stab_gnu.h" /* STABS information */
+#include "aout/stab_gnu.h" /* STABS information. */
#include "expression.h"
extern void _initialize_mdebugread (void);
-/* Provide a way to test if we have both ECOFF and ELF symbol tables.
+/* Provide a way to test if we have both ECOFF and ELF symbol tables.
We use this define in order to know whether we should override a
symbol's ECOFF section with its ELF section. This is necessary in
case the symbol's ELF section could not be represented in ECOFF. */
#define SC_IS_SBSS(sc) ((sc) == scSBss)
#define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
\f
-/* Various complaints about symbol reading that don't abort the process */
+/* Various complaints about symbol reading that don't abort the process. */
static void
index_complaint (const char *arg1)
{
complaint (&symfile_complaints, _("unexpected type code for %s"), arg1);
}
-/* Macros and extra defs */
+/* Macros and extra defs. */
-/* Puns: hard to find whether -g was used and how */
+/* Puns: hard to find whether -g was used and how. */
#define MIN_GLEVEL GLEVEL_0
#define compare_glevel(a,b) \
(((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
\f
-/* Things that really are local to this module */
+/* Things that really are local to this module. */
-/* Remember what we deduced to be the source language of this psymtab. */
+/* Remember what we deduced to be the source language of this psymtab. */
static enum language psymtab_language = language_unknown;
static struct ecoff_debug_info *debug_info;
-/* Pointer to current file decriptor record, and its index */
+/* Pointer to current file decriptor record, and its index. */
static FDR *cur_fdr;
static int cur_fd;
-/* Index of current symbol */
+/* Index of current symbol. */
static int cur_sdx;
/* Note how much "debuggable" this image is. We would like
- to see at least one FDR with full symbols */
+ to see at least one FDR with full symbols. */
static int max_gdbinfo;
static int max_glevel;
-/* When examining .o files, report on undefined symbols */
+/* When examining .o files, report on undefined symbols. */
static int n_undef_symbols, n_undef_labels, n_undef_vars, n_undef_procs;
static int found_ecoff_debugging_info;
-/* Forward declarations */
+/* Forward declarations. */
static int upgrade_type (int, struct type **, int, union aux_ext *,
int, char *);
/* Exported procedure: Builds a symtab from the PST partial one.
Restores the environment in effect when PST was created, delegates
most of the work to an ancillary procedure, and sorts
- and reorders the symtab list at the end */
+ and reorders the symtab list at the end. */
static void
mdebug_psymtab_to_symtab (struct partial_symtab *pst)
psymtab_to_symtab_1 (pst, pst->filename);
/* Match with global symbols. This only needs to be done once,
- after all of the symtabs and dependencies have been read in. */
+ after all of the symtabs and dependencies have been read in. */
scan_file_globals (pst->objfile);
if (info_verbose)
printf_filtered (_("done.\n"));
}
\f
-/* File-level interface functions */
+/* File-level interface functions. */
-/* Find a file descriptor given its index RF relative to a file CF */
+/* Find a file descriptor given its index RF relative to a file CF. */
static FDR *
get_rfd (int cf, int rf)
fdrs = debug_info->fdr;
f = fdrs + cf;
- /* Object files do not have the RFD table, all refs are absolute */
+ /* Object files do not have the RFD table, all refs are absolute. */
if (f->rfdBase == 0)
return fdrs + rf;
(*debug_swap->swap_rfd_in) (cur_bfd,
return fdrs + rfd;
}
-/* Return a safer print NAME for a file descriptor */
+/* Return a safer print NAME for a file descriptor. */
static char *
fdr_name (FDR *f)
\f
/* Local utilities */
-/* Map of FDR indexes to partial symtabs */
+/* Map of FDR indexes to partial symtabs. */
struct pst_map
{
/* Utility stack, used to nest procedures and blocks properly.
It is a doubly linked list, to avoid too many alloc/free.
Since we might need it quite a few times it is NOT deallocated
- after use. */
+ after use. */
static struct parse_stack
{
struct parse_stack *next, *prev;
- struct symtab *cur_st; /* Current symtab. */
- struct block *cur_block; /* Block in it. */
+ struct symtab *cur_st; /* Current symtab. */
+ struct block *cur_block; /* Block in it. */
/* What are we parsing. stFile, or stBlock are for files and
blocks. stProc or stStaticProc means we have seen the start of a
int blocktype;
- struct type *cur_type; /* Type we parse fields for. */
- int cur_field; /* Field number in cur_type. */
- CORE_ADDR procadr; /* Start addres of this procedure */
- int numargs; /* Its argument count */
+ struct type *cur_type; /* Type we parse fields for. */
+ int cur_field; /* Field number in cur_type. */
+ CORE_ADDR procadr; /* Start addres of this procedure. */
+ int numargs; /* Its argument count. */
}
*top_stack; /* Top stack ptr */
-/* Enter a new lexical context */
+/* Enter a new lexical context. */
static void
push_parse_stack (void)
{
struct parse_stack *new;
- /* Reuse frames if possible */
+ /* Reuse frames if possible. */
if (top_stack && top_stack->prev)
new = top_stack->prev;
else
new = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
- /* Initialize new frame with previous content */
+ /* Initialize new frame with previous content. */
if (top_stack)
{
struct parse_stack *prev = new->prev;
top_stack = new;
}
-/* Exit a lexical context */
+/* Exit a lexical context. */
static void
pop_parse_stack (void)
/* Cross-references might be to things we haven't looked at
yet, e.g. type references. To avoid too many type
duplications we keep a quick fixup table, an array
- of lists of references indexed by file descriptor */
+ of lists of references indexed by file descriptor. */
struct mdebug_pending
{
static struct mdebug_pending **pending_list;
-/* Check whether we already saw symbol SH in file FH */
+/* Check whether we already saw symbol SH in file FH. */
static struct mdebug_pending *
is_pending_symbol (FDR *fh, char *sh)
int f_idx = fh - debug_info->fdr;
struct mdebug_pending *p;
- /* Linear search is ok, list is typically no more than 10 deep */
+ /* Linear search is ok, list is typically no more than 10 deep. */
for (p = pending_list[f_idx]; p; p = p->next)
if (p->s == sh)
break;
return p;
}
-/* Add a new symbol SH of type T */
+/* Add a new symbol SH of type T. */
static void
add_pending (FDR *fh, char *sh, struct type *t)
int f_idx = fh - debug_info->fdr;
struct mdebug_pending *p = is_pending_symbol (fh, sh);
- /* Make sure we do not make duplicates */
+ /* Make sure we do not make duplicates. */
if (!p)
{
p = ((struct mdebug_pending *)
}
\f
-/* Parsing Routines proper. */
+/* Parsing Routines proper. */
-/* Parse a single symbol. Mostly just make up a GDB symbol for it.
+/* Parse a single symbol. Mostly just make up a GDB symbol for it.
For blocks, procedures and types we open a new lexical context.
This is basically just a big switch on the symbol's type. Argument
AX is the base pointer of aux symbols for this file (fh->iauxBase).
case stNil:
break;
- case stGlobal: /* external symbol, goes into global block */
+ case stGlobal: /* External symbol, goes into global block. */
class = LOC_STATIC;
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack->cur_st),
GLOBAL_BLOCK);
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
goto data;
- case stStatic: /* static data, goes into current block. */
+ case stStatic: /* Static data, goes into current block. */
class = LOC_STATIC;
b = top_stack->cur_block;
s = new_symbol (name);
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
goto data;
- case stLocal: /* local variable, goes into current block */
+ case stLocal: /* Local variable, goes into current block. */
b = top_stack->cur_block;
s = new_symbol (name);
SYMBOL_VALUE (s) = svalue;
else
class = LOC_LOCAL;
- data: /* Common code for symbols describing data */
+ data: /* Common code for symbols describing data. */
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_CLASS (s) = class;
add_symbol (s, top_stack->cur_st, b);
SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
else
SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
- /* Value of a data symbol is its memory address */
+ /* Value of a data symbol is its memory address. */
break;
- case stParam: /* arg to procedure, goes into current block */
+ case stParam: /* Arg to procedure, goes into current
+ block. */
max_gdbinfo++;
found_ecoff_debugging_info = 1;
top_stack->numargs++;
/* Special GNU C++ name. */
if (is_cplus_marker (name[0]) && name[1] == 't' && name[2] == 0)
- name = "this"; /* FIXME, not alloc'd in obstack */
+ name = "this"; /* FIXME, not alloc'd in obstack. */
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
- case stLabel: /* label, goes into current block */
+ case stLabel: /* label, goes into current block. */
s = new_symbol (name);
- SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* so that it can be used */
- SYMBOL_CLASS (s) = LOC_LABEL; /* but not misused */
+ SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* So that it can be used */
+ SYMBOL_CLASS (s) = LOC_LABEL; /* but not misused. */
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_int;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
- case stProc: /* Procedure, usually goes into global block */
- case stStaticProc: /* Static procedure, goes into current block */
+ case stProc: /* Procedure, usually goes into global block. */
+ case stStaticProc: /* Static procedure, goes into current block. */
/* For stProc symbol records, we need to check the storage class
as well, as only (stProc, scText) entries represent "real"
procedures - See the Compaq document titled "Object File /
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_CLASS (s) = LOC_BLOCK;
- /* Type of the return value */
+ /* Type of the return value. */
if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil)
t = objfile_type (objfile)->builtin_int;
else
printf("howdy\n")" would fail with the error message
"program has no memory available". To avoid this, we
patch up the type and make it void*
- instead. (davidm@azstarnet.com)
- */
+ instead. (davidm@azstarnet.com). */
t = make_pointer_type (t, NULL);
}
}
}
add_symbol (s, top_stack->cur_st, b);
- /* Make a type for the procedure itself */
+ /* Make a type for the procedure itself. */
SYMBOL_TYPE (s) = lookup_function_type (t);
/* All functions in C++ have prototypes. For C we don't have enough
if (SYMBOL_LANGUAGE (s) == language_cplus)
TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
- /* Create and enter a new lexical context */
+ /* Create and enter a new lexical context. */
b = new_block (FUNCTION_BLOCK);
SYMBOL_BLOCK_VALUE (s) = b;
BLOCK_FUNCTION (b) = s;
BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
add_block (b, top_stack->cur_st);
- /* Not if we only have partial info */
+ /* Not if we only have partial info. */
if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil)
break;
long max_value;
struct field *f;
- case stStruct: /* Start a block defining a struct type */
+ case stStruct: /* Start a block defining a struct type. */
type_code = TYPE_CODE_STRUCT;
goto structured_common;
- case stUnion: /* Start a block defining a union type */
+ case stUnion: /* Start a block defining a union type. */
type_code = TYPE_CODE_UNION;
goto structured_common;
- case stEnum: /* Start a block defining an enum type */
+ case stEnum: /* Start a block defining an enum type. */
type_code = TYPE_CODE_ENUM;
goto structured_common;
- case stBlock: /* Either a lexical block, or some type */
+ case stBlock: /* Either a lexical block, or some type. */
if (sh->sc != scInfo && !SC_IS_COMMON (sh->sc))
goto case_stBlock_code; /* Lexical block */
push_parse_stack ();
top_stack->blocktype = stBlock;
- /* First count the number of fields and the highest value. */
+ /* First count the number of fields and the highest value. */
nfields = 0;
max_value = 0;
for (ext_tsym = ext_sh + external_sym_size;
{
case stEnd:
/* C++ encodes class types as structures where there the
- methods are encoded as stProc. The scope of stProc
+ methods are encoded as stProc. The scope of stProc
symbols also ends with stEnd, thus creating a risk of
taking the wrong stEnd symbol record as the end of
the current struct, which would cause GDB to undercount
/* mips cc puts out a typedef for struct x if it is not yet
defined when it encounters
struct y { struct x *xp; };
- Just ignore it. */
+ Just ignore it. */
break;
case stIndirect:
/* Irix5 cc puts out a stIndirect for struct x if it is not
yet defined when it encounters
struct y { struct x *xp; };
- Just ignore it. */
+ Just ignore it. */
break;
default:
differently from struct/union fields, and that is harder to
patch up, but luckily we shouldn't need to. (If there are
any enumeration members, we can tell for sure it's an enum
- here.) */
+ here.) */
if (type_code == TYPE_CODE_UNDEF)
{
{
int unsigned_enum = 1;
- /* This is a non-empty enum. */
+ /* This is a non-empty enum. */
/* DEC c89 has the number of enumerators in the sh.value field,
not the type length, so we have to compensate for that
unsigned_enum = 0;
add_symbol (enum_sym, top_stack->cur_st, top_stack->cur_block);
- /* Skip the stMembers that we've handled. */
+ /* Skip the stMembers that we've handled. */
count++;
f++;
}
if (unsigned_enum)
TYPE_UNSIGNED (t) = 1;
}
- /* make this the current type */
+ /* Make this the current type. */
top_stack->cur_type = t;
top_stack->cur_field = 0;
case_stBlock_code:
found_ecoff_debugging_info = 1;
- /* beginnning of (code) block. Value of symbol
- is the displacement from procedure start */
+ /* Beginnning of (code) block. Value of symbol
+ is the displacement from procedure start. */
push_parse_stack ();
/* Do not start a new block if this is the outermost block of a
BLOCK_END (top_stack->cur_block) += sh->value; /* size */
- /* Make up special symbol to contain procedure specific info */
+ /* Make up special symbol to contain procedure specific info. */
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
SYMBOL_CLASS (s) = LOC_CONST;
if (TYPE_NFIELDS (ftype) <= 0)
{
/* No parameter type information is recorded with the function's
- type. Set that from the type of the parameter symbols. */
+ type. Set that from the type of the parameter symbols. */
int nparams = top_stack->numargs;
int iparams;
struct symbol *sym;
}
else if (sh->sc == scText && top_stack->blocktype == stBlock)
{
- /* End of (code) block. The value of the symbol is the
+ /* End of (code) block. The value of the symbol is the
displacement from the procedure`s start address of the
- end of this block. */
+ end of this block. */
BLOCK_END (top_stack->cur_block) = sh->value + top_stack->procadr;
}
else if (sh->sc == scText && top_stack->blocktype == stNil)
complaint (&symfile_complaints,
_("stEnd with storage class %d not handled"), sh->sc);
- pop_parse_stack (); /* restore previous lexical context */
+ pop_parse_stack (); /* Restore previous lexical context. */
break;
case stMember: /* member of struct or union */
else
t = pend->t;
- /* mips cc puts out a typedef with the name of the struct for forward
- declarations. These should not go into the symbol table and
+ /* Mips cc puts out a typedef with the name of the struct for forward
+ declarations. These should not go into the symbol table and
TYPE_NAME should not be set for them.
They can't be distinguished from an intentional typedef to
the same name however:
}
/* Parse the type information provided in the raw AX entries for
- the symbol SH. Return the bitfield size in BS, in case.
+ the symbol SH. Return the bitfield size in BS, in case.
We must byte-swap the AX entries before we use them; BIGEND says whether
they are big-endian or little-endian (from fh->fBigendian). */
struct type *tp = 0;
enum type_code type_code = TYPE_CODE_UNDEF;
- /* Handle undefined types, they have indexNil. */
+ /* Handle undefined types, they have indexNil. */
if (aux_index == indexNil)
return basic_type (btInt, current_objfile);
tp = basic_type (t->bt, current_objfile);
if (tp == NULL)
{
- /* Cannot use builtin types -- build our own */
+ /* Cannot use builtin types -- build our own. */
switch (t->bt)
{
case btStruct:
type_code = TYPE_CODE_SET;
break;
case btIndirect:
- /* alpha cc -migrate uses this for typedefs. The true type will
+ /* alpha cc -migrate uses this for typedefs. The true type will
be obtained by crossreferencing below. */
type_code = TYPE_CODE_ERROR;
break;
case btTypedef:
- /* alpha cc uses this for typedefs. The true type will be
+ /* alpha cc uses this for typedefs. The true type will be
obtained by crossreferencing below. */
type_code = TYPE_CODE_ERROR;
break;
}
}
- /* Move on to next aux */
+ /* Move on to next aux. */
ax++;
if (t->fBitfield)
/* All these types really point to some (common) MIPS type
definition, and only the type-qualifiers fully identify
- them. We'll make the same effort at sharing. */
+ them. We'll make the same effort at sharing. */
if (t->bt == btStruct ||
t->bt == btUnion ||
t->bt == btEnum ||
else
{
/* Usually, TYPE_CODE(tp) is already type_code. The main
- exception is if we guessed wrong re struct/union/enum. */
+ exception is if we guessed wrong re struct/union/enum. */
if (TYPE_CODE (tp) != type_code)
{
bad_tag_guess_complaint (sym_name);
}
}
- /* Deal with range types */
+ /* Deal with range types. */
if (t->bt == btRange)
{
TYPE_NFIELDS (tp) = 0;
ax++;
}
- /* Parse all the type qualifiers now. If there are more
- than 6 the game will continue in the next aux */
+ /* Parse all the type qualifiers now. If there are more
+ than 6 the game will continue in the next aux. */
while (1)
{
}
/* Make up a complex type from a basic one. Type is passed by
- reference in TPP and side-effected as necessary. The type
+ reference in TPP and side-effected as necessary. The type
qualifier TQ says how to handle the aux symbols at AX for
the symbol SX we are currently analyzing. BIGEND says whether
aux symbols are big-endian or little-endian.
- Returns the number of aux symbols we parsed. */
+ Returns the number of aux symbols we parsed. */
static int
upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
int off;
struct type *t;
- /* Used in array processing */
+ /* Used in array processing. */
int rf, id;
FDR *fh;
struct type *range;
case tqArray:
off = 0;
- /* Determine and record the domain type (type of index) */
+ /* Determine and record the domain type (type of index). */
(*debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, &rndx);
id = rndx.index;
rf = rndx.rfd;
struct block *b;
char *sh_name;
- /* Simple rule to find files linked "-x" */
+ /* Simple rule to find files linked "-x". */
if (cur_fdr->rss == -1)
{
if (pr->isym == -1)
{
- /* Static procedure at address pr->adr. Sigh. */
+ /* Static procedure at address pr->adr. Sigh. */
/* FIXME-32x64. assuming pr->adr fits in long. */
complaint (&symfile_complaints,
_("can't handle PDR for static proc at 0x%lx"),
s = new_symbol (sh_name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_CLASS (s) = LOC_BLOCK;
- /* Donno its type, hope int is ok */
+ /* Donno its type, hope int is ok. */
SYMBOL_TYPE (s)
= lookup_function_type (objfile_type (pst->objfile)->builtin_int);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
- /* Wont have symbols for this one */
+ /* Won't have symbols for this one. */
b = new_block (2);
SYMBOL_BLOCK_VALUE (s) = b;
BLOCK_FUNCTION (b) = s;
SYMBOL_TYPE (s) = objfile_type (pst->objfile)->nodebug_text_symbol;
}
-/* Parse the external symbol ES. Just call parse_symbol() after
+/* Parse the external symbol ES. Just call parse_symbol() after
making sure we know where the aux are for it.
BIGEND says whether aux entries are big-endian or little-endian.
- This routine clobbers top_stack->cur_block and ->cur_st. */
+ This routine clobbers top_stack->cur_block and ->cur_st. */
static void parse_external (EXTR *, int, struct section_offsets *,
struct objfile *);
break;
}
n_undef_symbols++;
- /* FIXME: Turn this into a complaint? */
+ /* FIXME: Turn this into a complaint? */
if (info_verbose)
printf_filtered (_("Warning: %s `%s' is undefined (in %s)\n"),
what, debug_info->ssext + es->asym.iss,
GDB's linetable LT. MIPS' encoding requires a little bit
of magic to get things out. Note also that MIPS' line
numbers can go back and forth, apparently we can live
- with that and do not need to reorder our linetables */
+ with that and do not need to reorder our linetables. */
static void parse_lines (FDR *, PDR *, struct linetable *, int,
struct partial_symtab *, CORE_ADDR);
if (fh->cbLine == 0)
return;
- /* Scan by procedure descriptors */
+ /* Scan by procedure descriptors. */
k = 0;
for (j = 0; j < fh->cpd; j++, pr++)
{
CORE_ADDR adr;
unsigned char *halt;
- /* No code for this one */
+ /* No code for this one. */
if (pr->iline == ilineNil ||
pr->lnLow == -1 || pr->lnHigh == -1)
continue;
}
lineno += delta; /* first delta is 0 */
- /* Complain if the line table overflows. Could happen
+ /* Complain if the line table overflows. Could happen
with corrupt binaries. */
if (lt->nitems >= maxlines)
{
int textlow_not_set = 1;
int past_first_source_file = 0;
- /* List of current psymtab's include files */
+ /* List of current psymtab's include files. */
char **psymtab_include_list;
int includes_allocated;
int includes_used;
EXTR *extern_tab;
struct pst_map *fdr_to_pst;
- /* Index within current psymtab dependency list */
+ /* Index within current psymtab dependency list. */
struct partial_symtab **dependency_list;
int dependencies_used, dependencies_allocated;
struct cleanup *old_chain;
* Only parse the Local and External symbols, and the Relative FDR.
* Fixup enough of the loader symtab to be able to use it.
* Allocate space only for the file's portions we need to
- * look at. (XXX)
+ * look at. (XXX)
*/
max_gdbinfo = 0;
/* Allocate the map FDR -> PST.
Minor hack: -O3 images might claim some global data belongs
- to FDR -1. We`ll go along with that */
+ to FDR -1. We`ll go along with that. */
fdr_to_pst = (struct pst_map *)
xzalloc ((hdr->ifdMax + 1) * sizeof *fdr_to_pst);
old_chain = make_cleanup (xfree, fdr_to_pst);
for (; ext_out < ext_out_end; ext_out += external_ext_size, ext_in++)
(*swap_ext_in) (cur_bfd, ext_out, ext_in);
- /* Pass 1 over external syms: Presize and partition the list */
+ /* Pass 1 over external syms: Presize and partition the list. */
ext_in = ext_block;
ext_in_end = ext_in + hdr->iextMax;
for (; ext_in < ext_in_end; ext_in++)
fdr_to_pst[ext_in->ifd].n_globals++;
}
- /* Pass 1.5 over files: partition out global symbol space */
+ /* Pass 1.5 over files: partition out global symbol space. */
s_idx = 0;
for (f_idx = -1; f_idx < hdr->ifdMax; f_idx++)
{
Since absolute sections don't get relocated, we
end up calculating an address different from that of
the symbol's minimal symbol (created earlier from the
- Elf symtab).
+ Elf symtab).
To fix this, either :
1) don't create the duplicate symbol
I've implemented #1 here...
Skip the creation of the minimal symbols based on the ECOFF
- symbol table. */
+ symbol table. */
- /* Pass 2 over external syms: fill in external symbols */
+ /* Pass 2 over external syms: fill in external symbols. */
ext_in = ext_block;
ext_in_end = ext_in + hdr->iextMax;
for (; ext_in < ext_in_end; ext_in++)
continue;
- /* Pass 3 over files, over local syms: fill in static symbols */
+ /* Pass 3 over files, over local syms: fill in static symbols. */
name = debug_info->ssext + ext_in->asym.iss;
- /* Process ECOFF Symbol Types and Storage Classes */
+ /* Process ECOFF Symbol Types and Storage Classes. */
switch (ext_in->asym.st)
{
case stProc:
/* Label */
/* On certain platforms, some extra label symbols can be
- generated by the linker. One possible usage for this kind
+ generated by the linker. One possible usage for this kind
of symbols is to represent the address of the begining of a
- given section. For instance, on Tru64 5.1, the address of
+ given section. For instance, on Tru64 5.1, the address of
the _ftext label is the start address of the .text section.
The storage class of these symbols is usually directly
- related to the section to which the symbol refers. For
+ related to the section to which the symbol refers. For
instance, on Tru64 5.1, the storage class for the _fdata
label is scData, refering to the .data section.
It is actually possible that the section associated to the
- storage class of the label does not exist. On True64 5.1
+ storage class of the label does not exist. On True64 5.1
for instance, the libm.so shared library does not contain
any .data section, although it contains a _fpdata label
- which storage class is scData... Since these symbols are
+ which storage class is scData... Since these symbols are
usually useless for the debugger user anyway, we just
- discard these symbols.
- */
+ discard these symbols. */
if (SC_IS_TEXT (ext_in->asym.sc))
{
case stLocal:
case stNil:
/* The alpha has the section start addresses in stLocal symbols
- whose name starts with a `.'. Skip those but complain for all
+ whose name starts with a `.'. Skip those but complain for all
other stLocal symbols.
Irix6 puts the section start addresses in stNil symbols, skip
- those too. */
+ those too. */
if (name[0] == '.')
continue;
/* Fall through. */
objfile);
}
- /* Pass 3 over files, over local syms: fill in static symbols */
+ /* Pass 3 over files, over local syms: fill in static symbols. */
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++)
{
struct partial_symtab *save_pst;
DEBUG_INFO (pst) = debug_info;
PENDING_LIST (pst) = pending_list;
- /* The way to turn this into a symtab is to call... */
+ /* The way to turn this into a symtab is to call... */
pst->read_symtab = mdebug_psymtab_to_symtab;
/* Set up language for the pst.
a header file, which is not what we want.
But the FDRs for the header files are after the FDR for the source
file, so we can assign the language of the source file to the
- following header files. Then we save the language in the private
+ following header files. Then we save the language in the private
pst data so that we can reuse it when building symtabs. */
prev_language = psymtab_language;
current object file uses encapsulated stabs instead of mips
ecoff for local symbols. (It is the second symbol because
the first symbol is the stFile used to signal the start of a
- file). */
+ file). */
processing_gcc_compilation = 0;
if (fh->csym >= 2)
{
default:
/* FIXME! Shouldn't this use cases for bss,
- then have the default be abs? */
+ then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
sh.value += ANOFFSET (objfile->section_offsets,
SECT_OFF_BSS (objfile));
}
continue;
}
- /* Handle stabs continuation */
+ /* Handle stabs continuation. */
{
char *stabstring = debug_info->ss + fh->issBase + sh.iss;
int len = strlen (stabstring);
char *stabstring2;
int len2;
- /* Ignore continuation char from 1st string */
+ /* Ignore continuation char from 1st string. */
len--;
- /* Read next stabstring */
+ /* Read next stabstring. */
cur_sdx++;
(*swap_sym_in) (cur_bfd,
(((char *) debug_info->external_sym)
stabstring2 = debug_info->ss + fh->issBase + sh2.iss;
len2 = strlen (stabstring2);
- /* Concatinate stabstring2 with stabstring1 */
+ /* Concatinate stabstring2 with stabstring1. */
if (stabstring
&& stabstring != debug_info->ss + fh->issBase + sh.iss)
stabstring = xrealloc (stabstring, len + len2 + 1);
case N_BSS:
case N_BSS | N_EXT:
case N_NBBSS | N_EXT:
- case N_SETV | N_EXT: /* FIXME, is this in BSS? */
+ case N_SETV | N_EXT: /* FIXME, is this in BSS? */
sh.value += ANOFFSET (objfile->section_offsets,
SECT_OFF_BSS (objfile));
goto record_it;
record_it:
continue;
- /* Standard, local, non-debugger, symbols */
+ /* Standard, local, non-debugger, symbols. */
case N_NBTEXT:
goto record_it;
case N_UNDF | N_EXT:
- continue; /* Just undefined, not COMMON */
+ continue; /* Just undefined, not COMMON. */
case N_UNDF:
continue;
case N_NBBSS:
continue;
- /* Keep going . . . */
+ /* Keep going . . . */
/*
* Special symbol types for GNU
prev_textlow_not_set = textlow_not_set;
/* A zero value is probably an indication for the
- SunPRO 3.0 compiler. end_psymtab explicitly tests
+ SunPRO 3.0 compiler. end_psymtab explicitly tests
for zero, so don't relocate it. */
if (sh.value == 0
past_first_source_file = 1;
if (prev_so_symnum != symnum - 1)
- { /* Here if prev stab wasn't N_SO */
+ { /* Here if prev stab wasn't N_SO. */
first_so_symnum = symnum;
if (pst)
prev_so_symnum = symnum;
- /* End the current partial symtab and start a new one */
+ /* End the current partial symtab and start a
+ new one. */
/* SET_NAMESTRING ();*/
namestring = stabstring;
/* Null name means end of .o file. Don't start a new
- one. */
+ one. */
if (*namestring == '\000')
continue;
initial N_SOs. The first one is a directory name;
the second the file name. If pst exists, is
empty, and has a filename ending in '/', we assume
- the previous N_SO was a directory name. */
+ the previous N_SO was a directory name. */
p = strrchr (namestring, '/');
if (p && *(p + 1) == '\000')
continue; /* Simply ignore directory
- name SOs */
+ name SOs. */
/* Some other compilers (C++ ones in particular) emit
useless SOs for non-existant .c files. We ignore
{
enum language tmp_language;
- /* Mark down an include file in the current psymtab */
+ /* Mark down an include file in the current psymtab. */
- /* SET_NAMESTRING ();*/
+ /* SET_NAMESTRING (); */
namestring = stabstring;
tmp_language
/* In C++, one may expect the same filename to come
round many times, when code is coming alternately
from the main file and from inline functions in
- other files. So I check to see if this is a file
+ other files. So I check to see if this is a file
we've seen before -- either the main source file,
or a previously included file.
}
continue;
}
- case N_LSYM: /* Typedef or automatic variable. */
+ case N_LSYM: /* Typedef or automatic variable. */
case N_STSYM: /* Data seg var -- static */
case N_LCSYM: /* BSS " */
case N_ROSYM: /* Read-only data seg var -- static. */
case N_PC: /* I may or may not need this; I
suspect not. */
case N_M2C: /* I suspect that I can ignore this
- here. */
- case N_SCOPE: /* Same. */
+ here. */
+ case N_SCOPE: /* Same. */
- /* SET_NAMESTRING ();*/
+ /* SET_NAMESTRING (); */
namestring = stabstring;
p = (char *) strchr (namestring, ':');
if (!p)
- continue; /* Not a debugging symbol. */
+ continue; /* Not a debugging symbol. */
case 'G':
sh.value += ANOFFSET (objfile->section_offsets,
SECT_OFF_DATA (objfile));
- /* The addresses in these entries are reported to be
- wrong. See the code that reads 'G's for symtabs. */
+ /* The addresses in these entries are reported
+ to be wrong. See the code that reads 'G's
+ for symtabs. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
&objfile->global_psymbols,
goto check_enum;
case 't':
if (p != namestring) /* a name is there, not
- just :T... */
+ just :T... */
{
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
/* If this is an enumerated type, we need to add
all the enum constants to the partial symbol
table. This does not cover enums without names,
- e.g. "enum {a, b} c;" in C, but fortunately
+ e.g. "enum {a, b} c;" in C, but fortunately
those are rare. There is no way for GDB to find
those from the enum type without spending too
much time on it. Thus to solve this problem,
element. Hopefully, I can
ignore this. */
case N_ENTRY: /* Alternate entry point; can
- ignore. */
+ ignore. */
case N_MAIN: /* Can definitely ignore this. */
- case N_CATCH: /* These are GNU C++ extensions */
- case N_EHDECL: /* that can safely be ignored here. */
+ case N_CATCH: /* These are GNU C++ extensions. */
+ case N_EHDECL: /* that can safely be ignored here. */
case N_LENG:
case N_BCOMM:
case N_ECOMM:
case N_ALIAS: /* SunPro F77: alias name, ignore
for now. */
- case N_OBJ: /* useless types from Solaris */
+ case N_OBJ: /* Useless types from Solaris. */
case N_OPT:
/* These symbols aren't interesting; don't worry about
- them */
+ them. */
continue;
probably some new type we don't know about yet. */
complaint (&symfile_complaints,
_("unknown symbol type %s"),
- hex_string (type_code)); /*CUR_SYMBOL_TYPE*/
+ hex_string (type_code)); /* CUR_SYMBOL_TYPE */
continue;
}
if (stabstring
|| (sh.index == indexNil
&& (sh.st != stStatic || sh.sc == scAbs)))
{
- /* FIXME, premature? */
+ /* FIXME, premature? */
cur_sdx++;
continue;
}
/* Should not happen, but does when cross-compiling
with the MIPS compiler. FIXME -- pull later. */
index_complaint (name);
- new_sdx = cur_sdx + 1; /* Don't skip at all */
+ new_sdx = cur_sdx + 1; /* Don't skip at all. */
}
else
new_sdx = AUX_GET_ISYM (fh->fBigendian,
complaint (&symfile_complaints,
_("bad proc end in aux found from symbol %s"),
name);
- new_sdx = cur_sdx + 1; /* Don't skip backward */
+ new_sdx = cur_sdx + 1; /* Don't skip backward. */
}
/* For stProc symbol records, we need to check the
goto skip;
/* Usually there is a local and a global stProc symbol
- for a function. This means that the function name
+ for a function. This means that the function name
has already been entered into the mimimal symbol table
while processing the global symbols in pass 2 above.
One notable exception is the PROGRAM name from
break;
case stIndirect: /* Irix5 forward declaration */
- /* Skip forward declarations from Irix5 cc */
+ /* Skip forward declarations from Irix5 cc. */
goto skip;
case stTypedef: /* Typedef */
case stEnum:
case stBlock: /* { }, str, un, enum */
/* Do not create a partial symbol for cc unnamed aggregates
- and gcc empty aggregates. */
+ and gcc empty aggregates. */
if ((sh.sc == scInfo
|| SC_IS_COMMON (sh.sc))
&& sh.iss != 0
}
handle_psymbol_enumerators (objfile, fh, sh.st, sh.value);
- /* Skip over the block */
+ /* Skip over the block. */
new_sdx = sh.index;
if (new_sdx <= cur_sdx)
{
- /* This happens with the Ultrix kernel. */
+ /* This happens with the Ultrix kernel. */
complaint (&symfile_complaints,
_("bad aux index at block symbol %s"), name);
- new_sdx = cur_sdx + 1; /* Don't skip backward */
+ new_sdx = cur_sdx + 1; /* Don't skip backward. */
}
cur_sdx = new_sdx;
continue;
case stLocal: /* Local variables */
/* Normally these are skipped because we skip over
all blocks we see. However, these can occur
- as visible symbols in a .h file that contains code. */
+ as visible symbols in a .h file that contains code. */
goto skip;
default:
cur_sdx++;
continue;
}
- /* Use this gdb symbol */
+ /* Use this gdb symbol. */
add_psymbol_to_list (name, strlen (name), 1,
VAR_DOMAIN, class,
&objfile->static_psymbols,
0, sh.value, psymtab_language, objfile);
skip:
- cur_sdx++; /* Go to next file symbol */
+ cur_sdx++; /* Go to next file symbol. */
}
- /* Now do enter the external symbols. */
+ /* Now do enter the external symbols. */
ext_ptr = &extern_tab[fdr_to_pst[f_idx].globals_offset];
cur_sdx = fdr_to_pst[f_idx].n_globals;
PST_PRIVATE (save_pst)->extern_count = cur_sdx;
}
}
- /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
+ /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
empty and put on the free list. */
fdr_to_pst[f_idx].pst = end_psymtab (save_pst,
psymtab_include_list, includes_used,
}
}
- /* Now scan the FDRs for dependencies */
+ /* Now scan the FDRs for dependencies. */
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++)
{
fh = f_idx + debug_info->fdr;
if (pst == (struct partial_symtab *) NULL)
continue;
- /* This should catch stabs-in-ecoff. */
+ /* This should catch stabs-in-ecoff. */
if (fh->crfd <= 1)
continue;
}
}
-/* Get the next symbol. OBJFILE is unused. */
+/* Get the next symbol. OBJFILE is unused. */
static char *
mdebug_next_symbol_text (struct objfile *objfile)
wrap_here (""); /* Flush output */
gdb_flush (gdb_stdout);
}
- /* We only pass the filename for debug purposes */
+ /* We only pass the filename for debug purposes. */
psymtab_to_symtab_1 (pst->dependencies[i],
pst->dependencies[i]->filename);
}
&& pst->textlow == 0 && pst->texthigh == 0)
return;
- /* Now read the symbols for this symtab */
+ /* Now read the symbols for this symtab. */
cur_bfd = CUR_BFD (pst);
debug_swap = DEBUG_SWAP (pst);
: debug_info->fdr + cur_fd);
cur_fdr = fh;
- /* See comment in parse_partial_symbols about the @stabs sentinel. */
+ /* See comment in parse_partial_symbols about the @stabs sentinel. */
processing_gcc_compilation = 0;
if (fh != (FDR *) NULL && fh->csym >= 2)
{
/* This symbol table contains stabs-in-ecoff entries. */
- /* Parse local symbols first */
+ /* Parse local symbols first. */
- if (fh->csym <= 2) /* FIXME, this blows psymtab->symtab ptr */
+ if (fh->csym <= 2) /* FIXME, this blows psymtab->symtab ptr. */
{
current_objfile = NULL;
return;
it here instead of in process_one_symbol, so we
can keep a handle to its symtab. The symtab
would otherwise be ended twice, once in
- process_one_symbol, and once after this loop. */
+ process_one_symbol, and once after this loop. */
if (type_code == N_SO
&& last_source_file
&& previous_stab_code != (unsigned char) N_SO
if (type_code == N_FUN)
{
/* Make up special symbol to contain
- procedure specific info */
+ procedure specific info. */
struct mdebug_extra_func_info *e =
((struct mdebug_extra_func_info *)
obstack_alloc (¤t_objfile->objfile_obstack,
}
else
{
- /* Handle encoded stab line number. */
+ /* Handle encoded stab line number. */
valu += ANOFFSET (pst->section_offsets,
SECT_OFF_TEXT (pst->objfile));
record_line (current_subfile, sh.index,
}
else if (sh.st == stProc || sh.st == stStaticProc
|| sh.st == stStatic || sh.st == stEnd)
- /* These are generated by gcc-2.x, do not complain */
+ /* These are generated by gcc-2.x, do not complain. */
;
else
complaint (&symfile_complaints,
lines = LINETABLE (st);
- /* Get a new lexical context */
+ /* Get a new lexical context. */
push_parse_stack ();
top_stack->cur_st = st;
char *sym_ptr;
char *sym_end;
- /* Parse local symbols first */
+ /* Parse local symbols first. */
sym_ptr = ((char *) debug_info->external_sym
+ fh->isymBase * external_sym_size);
sym_end = sym_ptr + fh->csym * external_sym_size;
LINETABLE (st) = lines;
/* .. and our share of externals.
- XXX use the global list to speed up things here. how?
- FIXME, Maybe quit once we have found the right number of ext's? */
+ XXX use the global list to speed up things here. How?
+ FIXME, Maybe quit once we have found the right number of ext's? */
top_stack->cur_st = st;
top_stack->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack->cur_st),
current_objfile = NULL;
}
\f
-/* Ancillary parsing procedures. */
+/* Ancillary parsing procedures. */
/* Return 1 if the symbol pointed to by SH has a cross reference
to an opaque aggregate type, else 0. */
/* Lookup the type at relative index RN. Return it in TPP
if found and in any event come up with its name PNAME.
BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
- Return value says how many aux symbols we ate. */
+ Return value says how many aux symbols we ate. */
static int
cross_ref (int fd, union aux_ext *ax, struct type **tpp,
enum type_code type_code,
- /* Use to alloc new type if none is found. */
+ /* Use to alloc new type if none is found. */
char **pname, int bigend, char *sym_name)
{
RNDXR rn[1];
(*debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, rn);
- /* Escape index means 'the next one' */
+ /* Escape index means 'the next one'. */
if (rn->rfd == 0xfff)
{
result++;
}
/* mips cc uses an escaped rn->index of 0 for struct return types
- of procedures that were compiled without -g. These will always remain
+ of procedures that were compiled without -g. These will always remain
undefined. */
if (rn->rfd == 0xfff && rn->index == 0)
{
two cases:
a) forward declarations of structs/unions/enums which are not
defined in this compilation unit.
- For these the type will be void. This is a bad design decision
+ For these the type will be void. This is a bad design decision
as cross referencing across compilation units is impossible
due to the missing name.
b) forward declarations of structs/unions/enums/typedefs which
are defined later in this file or in another file in the same
- compilation unit. Irix5 cc uses a stIndirect symbol for this.
+ compilation unit. Irix5 cc uses a stIndirect symbol for this.
Simply cross reference those again to get the true type.
The forward references are not entered in the pending list and
in the symbol table. */
break;
case btTypedef:
- /* Follow a forward typedef. This might recursively
+ /* Follow a forward typedef. This might recursively
call cross_ref till we get a non typedef'ed type.
FIXME: This is not correct behaviour, but gdb currently
- cannot handle typedefs without type copying. Type
+ cannot handle typedefs without type copying. Type
copying is impossible as we might have mutual forward
references between two files and the copied type would not
get filled in when we later parse its definition. */
}
else if (sh.st == stTypedef)
{
- /* Parse the type for a normal typedef. This might recursively call
+ /* Parse the type for a normal typedef. This might recursively call
cross_ref till we get a non typedef'ed type.
FIXME: This is not correct behaviour, but gdb currently
- cannot handle typedefs without type copying. But type copying is
+ cannot handle typedefs without type copying. But type copying is
impossible as we might have mutual forward references between
two files and the copied type would not get filled in when
we later parse its definition. */
add_pending (fh, esh, *tpp);
}
- /* We used one auxent normally, two if we got a "next one" rf. */
+ /* We used one auxent normally, two if we got a "next one" rf. */
return result;
}
/* Quick&dirty lookup procedure, to avoid the MI ones that require
- keeping the symtab sorted */
+ keeping the symtab sorted. */
static struct symbol *
mylookup_symbol (char *name, struct block *block,
dict_add_symbol (BLOCK_DICT (b), s);
}
-/* Add a new block B to a symtab S */
+/* Add a new block B to a symtab S. */
static void
add_block (struct block *b, struct symtab *s)
a prologue than mips_skip_prologue).
But due to the compressed line table format there are line number entries
for the same line which are needed to bridge the gap to the next
- line number entry. These entries have a bogus address info with them
+ line number entry. These entries have a bogus address info with them
and we are unable to tell them from intended duplicate line number
entries.
This is another reason why -ggdb debugging format is preferable. */
add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
{
/* DEC c89 sometimes produces zero linenos which confuse gdb.
- Change them to something sensible. */
+ Change them to something sensible. */
if (lineno == 0)
lineno = 1;
if (last == 0)
- last = -2; /* make sure we record first line */
+ last = -2; /* Make sure we record first line. */
- if (last == lineno) /* skip continuation lines */
+ if (last == lineno) /* Skip continuation lines. */
return lineno;
lt->item[lt->nitems].line = lineno;
return lineno;
}
\f
-/* Sorting and reordering procedures */
+/* Sorting and reordering procedures. */
-/* Blocks with a smaller low bound should come first */
+/* Blocks with a smaller low bound should come first. */
static int
compare_blocks (const void *arg1, const void *arg2)
/* Sort the blocks of a symtab S.
Reorder the blocks in the blockvector by code-address,
- as required by some MI search routines */
+ as required by some MI search routines. */
static void
sort_blocks (struct symtab *s)
}
\f
-/* Constructor/restructor/destructor procedures */
+/* Constructor/restructor/destructor procedures. */
/* Allocate a new symtab for NAME. Needs an estimate of how many
- linenumbers MAXLINES we'll put in it */
+ linenumbers MAXLINES we'll put in it. */
static struct symtab *
new_symtab (const char *name, int maxlines, struct objfile *objfile)
LINETABLE (s) = new_linetable (maxlines);
- /* All symtabs must have at least two blocks */
+ /* All symtabs must have at least two blocks. */
BLOCKVECTOR (s) = new_bvect (2);
BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK)
= new_block (NON_FUNCTION_BLOCK);
return (s);
}
-/* Allocate a new partial_symtab NAME */
+/* Allocate a new partial_symtab NAME. */
static struct partial_symtab *
new_psymtab (char *name, struct objfile *objfile)
psymtab = allocate_psymtab (name, objfile);
psymtab->section_offsets = objfile->section_offsets;
- /* Keep a backpointer to the file's symbols */
+ /* Keep a backpointer to the file's symbols. */
psymtab->read_symtab_private = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc));
DEBUG_INFO (psymtab) = debug_info;
PENDING_LIST (psymtab) = pending_list;
- /* The way to turn this into a symtab is to call... */
+ /* The way to turn this into a symtab is to call... */
psymtab->read_symtab = mdebug_psymtab_to_symtab;
return (psymtab);
}
return l;
}
-/* Oops, too big. Shrink it. This was important with the 2.4 linetables,
+/* Oops, too big. Shrink it. This was important with the 2.4 linetables,
I am not so sure about the 3.4 ones.
Since the struct linetable already includes one item, we subtract one when
* sizeof (lt->item))));
}
-/* Allocate and zero a new blockvector of NBLOCKS blocks. */
+/* Allocate and zero a new blockvector of NBLOCKS blocks. */
static struct blockvector *
new_bvect (int nblocks)
return retval;
}
-/* Create a new symbol with printname NAME */
+/* Create a new symbol with printname NAME. */
static struct symbol *
new_symbol (char *name)
return s;
}
-/* Create a new type with printname NAME */
+/* Create a new type with printname NAME. */
static struct type *
new_type (char *name)
struct mdebug_extra_func_info
{
- long numargs; /* number of args to procedure (was iopt) */
- PDR pdr; /* Procedure descriptor record */
+ long numargs; /* Number of args to procedure (was iopt). */
+ PDR pdr; /* Procedure descriptor record. */
};
/* Special symbol found in blocks associated with routines. We can
struct mem_region new;
int i, ix;
- /* lo == hi is a useless empty region */
+ /* lo == hi is a useless empty region. */
if (lo >= hi && hi != 0)
{
printf_unfiltered (_("invalid memory region: low >= high\n"));
mem_region_list = NULL;
}
-/* Clear memory region list */
+/* Clear memory region list. */
static void
mem_clear (void)
}
\f
-/* Enable the memory region number NUM. */
+/* Enable the memory region number NUM. */
static void
mem_enable (int num)
}
\f
-/* Disable the memory region number NUM. */
+/* Disable the memory region number NUM. */
static void
mem_disable (int num)
}
}
-/* Delete the memory region number NUM. */
+/* Delete the memory region number NUM. */
static void
mem_delete (int num)
enum mem_access_mode
{
- MEM_NONE, /* Memory that is not physically present. */
+ MEM_NONE, /* Memory that is not physically present. */
MEM_RW, /* read/write */
MEM_RO, /* read only */
MEM_WO, /* write only */
the mem_region structure.
FIXME: It would be useful if there was a mechanism for targets to
- add their own attributes. For example, the number of wait states. */
+ add their own attributes. For example, the number of wait states. */
struct mem_attrib
{
/* enables host-side caching of memory region data */
int cache;
- /* enables memory verification. after a write, memory is re-read
- to verify that the write was successful. */
- int verify;
+ /* Enables memory verification. After a write, memory is re-read
+ to verify that the write was successful. */
+ int verify;
/* Block size. Only valid if mode == MEM_FLASH. */
int blocksize;
If 0, upper bound is "infinity". */
CORE_ADDR hi;
- /* Item number of this memory region. */
+ /* Item number of this memory region. */
int number;
- /* Status of this memory region (enabled if non-zero, otherwise disabled) */
+ /* Status of this memory region (enabled if non-zero, otherwise
+ disabled). */
int enabled_p;
- /* Attributes for this region */
+ /* Attributes for this region. */
struct mem_attrib attrib;
};
/* Parses XML memory map passed as argument and returns the memory
regions it describes. On any error, emits error message and
- returns 0. Does not throw. Ownership of result is passed to the caller. */
+ returns 0. Does not throw. Ownership of result is passed to the
+ caller. */
VEC(mem_region_s) *parse_memory_map (const char *memory_map);
#endif
/* Disassembly. */
/* The mep disassembler needs to know about the section in order to
- work correctly. */
+ work correctly. */
static int
mep_gdb_print_insn (bfd_vma pc, disassemble_info * info)
{
Every bundle is four bytes long, and naturally aligned, and can hold
one or two instructions:
- 16-bit core instruction; 16-bit coprocessor instruction
- These execute in parallel.
+ These execute in parallel.
- 32-bit core instruction
- 32-bit coprocessor instruction
Every bundle is eight bytes long, and naturally aligned, and can hold
one or two instructions:
- 16-bit core instruction; 48-bit (!) coprocessor instruction
- These execute in parallel.
+ These execute in parallel.
- 32-bit core instruction; 32-bit coprocessor instruction
- These execute in parallel.
+ These execute in parallel.
- 64-bit coprocessor instruction
Now, the MeP manual doesn't define any 48- or 64-bit coprocessor
body, gcc 4.x will use a BRA instruction to branch to the
loop condition checking code. This BRA instruction is
marked as part of the prologue. We therefore set next_pc
- to this branch target and also stop the prologue scan.
+ to this branch target and also stop the prologue scan.
The instructions at and beyond the branch target should
no longer be associated with the prologue.
else
offset = 0;
- /* Return values that do fit in a single register are returned in R0. */
+ /* Return values that do fit in a single register are returned in R0. */
regcache_cooked_read_part (regcache, MEP_R0_REGNUM,
offset, TYPE_LENGTH (type),
valbuf);
/* Return values larger than a single register are returned in
memory, pointed to by R0. Unfortunately, we can't count on R0
- pointing to the return buffer, so we raise an error here. */
+ pointing to the return buffer, so we raise an error here. */
else
error ("GDB cannot set return values larger than four bytes; "
"the Media Processor's\n"
{
/* Return values larger than a single register are returned in
memory, pointed to by R0. Unfortunately, we can't count on R0
- pointing to the return buffer, so we raise an error here. */
+ pointing to the return buffer, so we raise an error here. */
error ("GDB cannot set return values larger than four bytes; "
"the Media Processor's\n"
"calling conventions do not provide enough information "
4.2.1 Core register conventions
- Parameters should be evaluated from left to right, and they
- should be held in $1,$2,$3,$4 in order. The fifth parameter or
- after should be held in the stack. If the size is larger than 4
+ should be held in $1,$2,$3,$4 in order. The fifth parameter or
+ after should be held in the stack. If the size is larger than 4
bytes in the first four parameters, the pointer should be held in
- the registers instead. If the size is larger than 4 bytes in the
+ the registers instead. If the size is larger than 4 bytes in the
fifth parameter or after, the pointer should be held in the stack.
- - Return value of a function should be held in register $0. If the
+ - Return value of a function should be held in register $0. If the
size of return value is larger than 4 bytes, $1 should hold the
- pointer pointing memory that would hold the return value. In this
+ pointer pointing memory that would hold the return value. In this
case, the first parameter should be held in $2, the second one in
$3, and the third one in $4, and the forth parameter or after
should be held in the stack.
static struct target_ops picobug_ops;
static struct monitor_ops picobug_cmds;
-/* Picobug only supports a subset of registers from MCore. In reality,
+/* Picobug only supports a subset of registers from MCore. In reality,
it doesn't support ss1, either. */
static char *picobug_regnames[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
{
if (strchr (p, '-'))
{
- /* got a range. either r0-r7, r8-r15 or ss0-ss4. */
+ /* Got a range. Either r0-r7, r8-r15 or ss0-ss4. */
if (strncmp (p, "r0", 2) == 0 || strncmp (p, "r8", 2) == 0)
{
int rn = (p[1] == '0' ? 0 : 8);
}
else if (strncmp (p, "ss", 2) == 0)
{
- /* get the next five values, ignoring the first. */
+ /* Get the next five values, ignoring the first. */
int rn;
p = strtok (NULL, " \t\r\n");
for (rn = 39; rn < 43; rn++)
This set also needs to be verified if it is complete. */
#define IS_RETURN(op) (op == rtsd || op == rtid)
#define IS_UPDATE_SP(op, rd, ra) \
- ((op == addik || op == addi) && rd == REG_SP && ra == REG_SP)
+ ((op == addik || op == addi) && rd == REG_SP && ra == REG_SP)
#define IS_SPILL_SP(op, rd, ra) \
- ((op == swi || op == sw) && rd == REG_SP && ra == REG_SP)
+ ((op == swi || op == sw) && rd == REG_SP && ra == REG_SP)
#define IS_SPILL_REG(op, rd, ra) \
- ((op == swi || op == sw) && rd != REG_SP && ra == REG_SP)
+ ((op == swi || op == sw) && rd != REG_SP && ra == REG_SP)
#define IS_ALSO_SPILL_REG(op, rd, ra, rb) \
- ((op == swi || op == sw) && rd != REG_SP && ra == 0 && rb == REG_SP)
+ ((op == swi || op == sw) && rd != REG_SP && ra == 0 && rb == REG_SP)
#define IS_SETUP_FP(op, ra, rb) \
- ((op == add || op == addik || op == addk) && ra == REG_SP && rb == 0)
+ ((op == add || op == addik || op == addk) && ra == REG_SP && rb == 0)
#define IS_SPILL_REG_FP(op, rd, ra, fpregnum) \
- ((op == swi || op == sw) && rd != REG_SP && ra == fpregnum && ra != 0)
+ ((op == swi || op == sw) && rd != REG_SP && ra == fpregnum && ra != 0)
#define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
- ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
+ ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
/* The registers of the Xilinx microblaze processor. */
/* Analyze the prologue to determine where registers are saved,
the end of the prologue, etc. Return the address of the first line
- of "real" code (i.e., the end of the prologue). */
+ of "real" code (i.e., the end of the prologue). */
static CORE_ADDR
microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
int save_hidden_pointer_found = 0;
int non_stack_instruction_found = 0;
- /* Find the start of this function. */
+ /* Find the start of this function. */
find_pc_partial_function (pc, &name, &func_addr, &func_end);
if (func_addr < pc)
pc = func_addr;
If we're about to return, our frame has already been deallocated.
If we are stopped at the first instruction of a prologue,
- then our frame has not yet been set up. */
+ then our frame has not yet been set up. */
/* Get the first insn from memory. */
else if (IS_SETUP_FP(op, ra, rb))
{
/* We have a frame pointer. Note the register which is
- acting as the frame pointer. */
+ acting as the frame pointer. */
flags |= MICROBLAZE_MY_FRAME_IN_FP;
flags &= ~MICROBLAZE_MY_FRAME_IN_SP;
cache->fp_regnum = rd;
/* When optimizations are enabled, it is not guaranteed that prologue
instructions are not mixed in with other instructions from the
- program. Some programs show this behavior at -O2. This can be
+ program. Some programs show this behavior at -O2. This can be
avoided by adding -fno-schedule-insns2 switch as of now (edk 8.1)
In such cases, we scan the function until we see the first control
instruction. */
continue; /* continue if imm. */
}
- /* This is not a prologue insn, so stop here. */
+ /* This is not a prologue insn, so stop here. */
microblaze_debug ("insn is not a prologue insn -- ending scan\n");
break;
}
regnum = 15;
if (regnum == MICROBLAZE_SP_REGNUM)
regnum = 1;
- return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
+ return trad_frame_get_prev_register (this_frame,
+ cache->saved_regs, regnum);
}
else
return trad_frame_get_prev_register (this_frame, cache->saved_regs,
};
\f
static CORE_ADDR
-microblaze_frame_base_address (struct frame_info *next_frame, void **this_cache)
+microblaze_frame_base_address (struct frame_info *next_frame,
+ void **this_cache)
{
struct microblaze_frame_cache *cache =
microblaze_frame_cache (next_frame, this_cache);
Longs are stored in r3 (most significant word) and r4 (least
significant word).
- Small structures are always returned on stack.
-*/
+ Small structures are always returned on stack. */
static void
microblaze_store_return_value (struct type *type, struct regcache *regcache,
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
- /* Unwind the frame. */
+ /* Unwind the frame. */
dwarf2_append_unwinders (gdbarch);
frame_unwind_append_unwinder (gdbarch, µblaze_frame_unwind);
frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
Even when a file contains enough debugging information to build a full
symbol table, these minimal symbols are still useful for quickly mapping
between names and addresses, and vice versa. They are also sometimes used
- to figure out what full symbol table entries need to be read in. */
+ to figure out what full symbol table entries need to be read in. */
#include "defs.h"
sfile = p + 1;
}
- /* For C++, canonicalize the input name. */
+ /* For C++, canonicalize the input name. */
modified_name = name;
if (current_language->la_language == language_cplus)
{
case mst_solib_trampoline:
/* If a trampoline symbol is found, we prefer to
- keep looking for the *real* symbol. If the
+ keep looking for the *real* symbol. If the
actual symbol is not found, then we'll use the
- trampoline entry. */
+ trampoline entry. */
if (trampoline_symbol == NULL)
trampoline_symbol = msymbol;
break;
a binary search. Note that a minimal symbol table always consists
of at least two symbols, a "real" symbol and the terminating
"null symbol". If there are no real symbols, then there is no
- minimal symbol table at all. */
+ minimal symbol table at all. */
if (objfile->minimal_symbol_count > 0)
{
terminates. In essence, we are iterating the test interval
down until the pc value is pushed out of it from the high end.
- Warning: this code is trickier than it would appear at first. */
+ Warning: this code is trickier than it would appear at first. */
- /* Should also require that pc is <= end of objfile. FIXME! */
+ /* Should also require that pc is <= end of objfile. FIXME! */
if (pc >= SYMBOL_VALUE_ADDRESS (&msymbol[lo]))
{
while (SYMBOL_VALUE_ADDRESS (&msymbol[hi]) > pc)
{
- /* pc is still strictly less than highest address */
- /* Note "new" will always be >= lo */
+ /* pc is still strictly less than highest address. */
+ /* Note "new" will always be >= lo. */
new = (lo + hi) / 2;
if ((SYMBOL_VALUE_ADDRESS (&msymbol[new]) >= pc) ||
(lo == new))
/* The minimal symbol indexed by hi now is the best one in this
objfile's minimal symbol table. See if it is the best one
- overall. */
+ overall. */
if (hi >= 0
&& ((best_symbol == NULL) ||
}
/* Backward compatibility: search through the minimal symbol table
- for a matching PC (no section given) */
+ for a matching PC (no section given). */
struct minimal_symbol *
lookup_minimal_symbol_by_pc (CORE_ADDR pc)
}
\f
-/* Return leading symbol character for a BFD. If BFD is NULL,
+/* Return leading symbol character for a BFD. If BFD is NULL,
return the leading symbol character from the main objfile. */
static int get_symbol_leading_char (bfd *);
/* Prepare to start collecting minimal symbols. Note that presetting
msym_bunch_index to BUNCH_SIZE causes the first call to save a minimal
- symbol to allocate the memory for the first bunch. */
+ symbol to allocate the memory for the first bunch. */
void
init_minimal_symbol_collection (void)
return (NULL);
/* It's safe to strip the leading char here once, since the name
- is also stored stripped in the minimal symbol table. */
+ is also stored stripped in the minimal symbol table. */
if (name[0] == get_symbol_leading_char (objfile->obfd))
{
++name;
MSYMBOL_SIZE (msymbol) = 0;
/* The hash pointers must be cleared! If they're not,
- add_minsym_to_hash_table will NOT add this msymbol to the hash table. */
+ add_minsym_to_hash_table will NOT add this msymbol to the hash table. */
msymbol->hash_next = NULL;
msymbol->demangled_hash_next = NULL;
}
/* Compare two minimal symbols by address and return a signed result based
- on unsigned comparisons, so that we sort into unsigned numeric order.
+ on unsigned comparisons, so that we sort into unsigned numeric order.
Within groups with the same address, sort by name. */
static int
if (SYMBOL_VALUE_ADDRESS (fn1) < SYMBOL_VALUE_ADDRESS (fn2))
{
- return (-1); /* addr 1 is less than addr 2 */
+ return (-1); /* addr 1 is less than addr 2. */
}
else if (SYMBOL_VALUE_ADDRESS (fn1) > SYMBOL_VALUE_ADDRESS (fn2))
{
- return (1); /* addr 1 is greater than addr 2 */
+ return (1); /* addr 1 is greater than addr 2. */
}
else
/* addrs are equal: sort by name */
if (name1 && name2) /* both have names */
return strcmp (name1, name2);
else if (name2)
- return 1; /* fn1 has no name, so it is "less" */
- else if (name1) /* fn2 has no name, so it is "less" */
+ return 1; /* fn1 has no name, so it is "less". */
+ else if (name1) /* fn2 has no name, so it is "less". */
return -1;
else
- return (0); /* neither has a name, so they're equal. */
+ return (0); /* Neither has a name, so they're equal. */
}
}
FIXME: We could allocate the minimal symbol bunches on their own
obstack and then simply blow the obstack away when we are done with
- it. Is it worth the extra trouble though? */
+ it. Is it worth the extra trouble though? */
static void
do_discard_minimal_symbols_cleanup (void *arg)
/* Build (or rebuild) the minimal symbol hash tables. This is necessary
after compacting or sorting the table since the entries move around
- thus causing the internal minimal_symbol pointers to become jumbled. */
+ thus causing the internal minimal_symbol pointers to become jumbled. */
static void
build_minimal_symbol_hash_tables (struct objfile *objfile)
int i;
struct minimal_symbol *msym;
- /* Clear the hash tables. */
+ /* Clear the hash tables. */
for (i = 0; i < MINIMAL_SYMBOL_HASH_SIZE; i++)
{
objfile->msymbol_hash[i] = 0;
objfile->msymbol_demangled_hash[i] = 0;
}
- /* Now, (re)insert the actual entries. */
+ /* Now, (re)insert the actual entries. */
for (i = objfile->minimal_symbol_count, msym = objfile->msymbols;
i > 0;
i--, msym++)
to demangle it, and if successful, record it as a language_cplus symbol
and cache the demangled form on the symbol obstack. Symbols which don't
demangle are marked as language_unknown symbols, which inhibits future
- attempts to demangle them if we later add more minimal symbols. */
+ attempts to demangle them if we later add more minimal symbols. */
void
install_minimal_symbols (struct objfile *objfile)
to the new contiguous array of symbols. Note that we start with the
current, possibly partially filled bunch (thus we use the current
msym_bunch_index for the first bunch we copy over), and thereafter
- each bunch is full. */
+ each bunch is full. */
mcount = objfile->minimal_symbol_count;
to some symbol in the middle of it. Zero out the fields in the
"null symbol" allocated at the end of the array. Note that the
symbol count does *not* include this null symbol, which is why it
- is indexed by mcount and not mcount-1. */
+ is indexed by mcount and not mcount-1. */
SYMBOL_LINKAGE_NAME (&msymbols[mcount]) = NULL;
SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0;
/* Now build the hash tables; we can't do this incrementally
at an earlier point since we weren't finished with the obstack
yet. (And if the msymbol obstack gets moved, all the internal
- pointers to other msymbols need to be adjusted.) */
+ pointers to other msymbols need to be adjusted.) */
build_minimal_symbol_hash_tables (objfile);
}
}
We may fail to find the right function if a function with the
same name is defined in more than one shared library, but this
- is considered bad programming style. We could return 0 if we find
+ is considered bad programming style. We could return 0 if we find
a duplicate function in case this matters someday. */
CORE_ADDR
/* When elfosabi is ELFOSABI_NONE (0), then the ELF structures in the
file are conforming to the base specification for that machine
(there are no OS-specific extensions). In order to determine the
- real OS in use we must look for OS notes that have been added.
+ real OS in use we must look for OS notes that have been added.
For IRIX, we simply look for sections named with .MIPS. as
prefixes. */
if (mips_isa_regsize (get_regcache_arch (regcache)) == 4)
mips_supply_fpregset (regcache, (const mips_elf_fpregset_t *) fpregsetp);
else
- mips64_supply_fpregset (regcache, (const mips64_elf_fpregset_t *) fpregsetp);
+ mips64_supply_fpregset (regcache,
+ (const mips64_elf_fpregset_t *) fpregsetp);
}
void
if (mips_isa_regsize (get_regcache_arch (regcache)) == 4)
mips_fill_fpregset (regcache, (mips_elf_fpregset_t *) fpregsetp, regno);
else
- mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *) fpregsetp, regno);
+ mips64_fill_fpregset (regcache,
+ (mips64_elf_fpregset_t *) fpregsetp, regno);
}
using PTRACE_SETREGS et al. */
static void
-mips64_linux_regsets_store_registers (const struct regcache *regcache, int regno)
+mips64_linux_regsets_store_registers (const struct regcache *regcache,
+ int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int is_fp;
#define MAX_DEBUG_REGISTER 8
-/* A value of zero in a watchlo indicates that it is available. */
+/* A value of zero in a watchlo indicates that it is available. */
struct mips32_watch_regs
{
uint32_t watchlo[MAX_DEBUG_REGISTER];
- /* Lower 16 bits of watchhi. */
+ /* Lower 16 bits of watchhi. */
uint16_t watchhi[MAX_DEBUG_REGISTER];
/* Valid mask and I R W bits.
* bit 0 -- 1 if W bit is usable.
/* Target to_stopped_by_watchpoint implementation. Return 1 if
stopped by watchpoint. The watchhi R and W bits indicate the watch
- register triggered. */
+ register triggered. */
static int
mips_linux_stopped_by_watchpoint (void)
mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->lo);
mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->hi);
mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->pc);
- mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->badvaddr);
+ mips64_fill_gregset (regcache, gregsetp,
+ mips_regnum (gdbarch)->badvaddr);
mips64_fill_gregset (regcache, gregsetp, MIPS_PS_REGNUM);
mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->cause);
mips64_fill_gregset (regcache, gregsetp, MIPS_RESTART_REGNUM);
}
else
{
- to = (gdb_byte *) (*fpregsetp + regno - gdbarch_fp0_regnum (gdbarch));
+ to = (gdb_byte *) (*fpregsetp + regno
+ - gdbarch_fp0_regnum (gdbarch));
regcache_raw_collect (regcache, regno, to);
}
}
#define MIPS64_EF_SIZE 304
void mips64_supply_gregset (struct regcache *, const mips64_elf_gregset_t *);
-void mips64_fill_gregset (const struct regcache *, mips64_elf_gregset_t *, int);
-void mips64_supply_fpregset (struct regcache *, const mips64_elf_fpregset_t *);
-void mips64_fill_fpregset (const struct regcache *, mips64_elf_fpregset_t *, int);
+void mips64_fill_gregset (const struct regcache *,
+ mips64_elf_gregset_t *, int);
+void mips64_supply_fpregset (struct regcache *,
+ const mips64_elf_fpregset_t *);
+void mips64_fill_fpregset (const struct regcache *,
+ mips64_elf_fpregset_t *, int);
enum {
/* The Linux kernel stores an error code from any interrupted
== MIPS_ABI_EABI32 \
|| gdbarch_tdep (gdbarch)->mips_abi == MIPS_ABI_EABI64)
-#define MIPS_LAST_FP_ARG_REGNUM(gdbarch) (gdbarch_tdep (gdbarch)->mips_last_fp_arg_regnum)
+#define MIPS_LAST_FP_ARG_REGNUM(gdbarch) \
+ (gdbarch_tdep (gdbarch)->mips_last_fp_arg_regnum)
-#define MIPS_LAST_ARG_REGNUM(gdbarch) (gdbarch_tdep (gdbarch)->mips_last_arg_regnum)
+#define MIPS_LAST_ARG_REGNUM(gdbarch) \
+ (gdbarch_tdep (gdbarch)->mips_last_arg_regnum)
#define MIPS_FPU_TYPE(gdbarch) (gdbarch_tdep (gdbarch)->mips_fpu_type)
/ gdbarch_bfd_arch_info (gdbarch)->bits_per_byte);
}
-/* Return the currently configured (or set) saved register size. */
+/* Return the currently configured (or set) saved register size. */
unsigned int
mips_abi_regsize (struct gdbarch *gdbarch)
static void reinit_frame_cache_sfunc (char *, int, struct cmd_list_element *);
-/* The list of available "set mips " and "show mips " commands */
+/* The list of available "set mips " and "show mips " commands. */
static struct cmd_list_element *setmipscmdlist = NULL;
static struct cmd_list_element *showmipscmdlist = NULL;
}
static int
-mips_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
+mips_convert_register_p (struct gdbarch *gdbarch,
+ int regnum, struct type *type)
{
return mips_convert_register_float_case_p (gdbarch, regnum, type)
|| mips_convert_register_gpreg_case_p (gdbarch, regnum, type);
return rawtype;
}
-/* Should the upper word of 64-bit addresses be zeroed? */
+/* Should the upper word of 64-bit addresses be zeroed? */
enum auto_boolean mask_address_var = AUTO_BOOLEAN_AUTO;
static int
case AUTO_BOOLEAN_AUTO:
return tdep->default_mask_address_p;
default:
- internal_error (__FILE__, __LINE__, _("mips_mask_address_p: bad switch"));
+ internal_error (__FILE__, __LINE__,
+ _("mips_mask_address_p: bad switch"));
return -1;
}
}
{
struct minimal_symbol *sym;
- /* If bit 0 of the address is set, assume this is a MIPS16 address. */
+ /* If bit 0 of the address is set, assume this is a MIPS16 address. */
if (is_mips16_addr (memaddr))
return 1;
}
/* MIPS believes that the PC has a sign extended value. Perhaps the
- all registers should be sign extended for simplicity? */
+ all registers should be sign extended for simplicity? */
static CORE_ADDR
mips_read_pc (struct regcache *regcache)
return extract_unsigned_integer (buf, instlen, byte_order);
}
-/* These the fields of 32 bit mips instructions */
+/* These are the fields of 32 bit mips instructions. */
#define mips32_op(x) (x >> 26)
#define itype_op(x) (x >> 26)
#define itype_rs(x) ((x >> 21) & 0x1f)
unsigned long inst;
int op;
inst = mips_fetch_instruction (gdbarch, pc);
- if ((inst & 0xe0000000) != 0) /* Not a special, jump or branch instruction */
+ if ((inst & 0xe0000000) != 0) /* Not a special, jump or branch
+ instruction. */
{
if (itype_op (inst) >> 2 == 5)
/* BEQL, BNEL, BLEZL, BGTZL: bits 0101xx */
pc += 8;
}
else
- pc += 4; /* Not a branch, next instruction is easy */
+ pc += 4; /* Not a branch, next instruction is easy. */
}
else
- { /* This gets way messy */
+ { /* This gets way messy. */
- /* Further subdivide into SPECIAL, REGIMM and other */
- switch (op = itype_op (inst) & 0x07) /* extract bits 28,27,26 */
+ /* Further subdivide into SPECIAL, REGIMM and other. */
+ switch (op = itype_op (inst) & 0x07) /* Extract bits 28,27,26. */
{
case 0: /* SPECIAL */
op = rtype_funct (inst);
{
case 8: /* JR */
case 9: /* JALR */
- /* Set PC to that address */
+ /* Set PC to that address. */
pc = get_frame_register_signed (frame, rtype_rs (inst));
break;
case 12: /* SYSCALL */
}
break; /* end SPECIAL */
- case 1: /* REGIMM */
+ case 1: /* REGIMM */
{
op = itype_rt (inst); /* branch condition */
switch (op)
{
unsigned long reg;
reg = jtype_target (inst) << 2;
- /* Upper four bits get never changed... */
+ /* Upper four bits get never changed... */
pc = reg + ((pc + 4) & ~(CORE_ADDR) 0x0fffffff);
}
break;
{
unsigned long reg;
reg = jtype_target (inst) << 2;
- pc = reg + ((pc + 4) & ~(CORE_ADDR) 0x0fffffff) + 1; /* yes, +1 */
+ pc = reg + ((pc + 4) & ~(CORE_ADDR) 0x0fffffff) + 1; /* yes, +1 */
/* Add 1 to indicate 16 bit mode - Invert ISA mode */
}
break; /* The new PC will be alternate mode */
} /* mips32_next_pc */
/* Decoding the next place to set a breakpoint is irregular for the
- mips 16 variant, but fortunately, there fewer instructions. We have to cope
- ith extensions for 16 bit instructions and a pair of actual 32 bit instructions.
- We dont want to set a single step instruction on the extend instruction
- either.
- */
+ mips 16 variant, but fortunately, there fewer instructions. We have
+ to cope ith extensions for 16 bit instructions and a pair of actual
+ 32 bit instructions. We dont want to set a single step instruction
+ on the extend instruction either. */
/* Lots of mips16 instruction formats */
/* Predicting jumps requires itype,ritype,i8type
- and their extensions extItype,extritype,extI8type
- */
+ and their extensions extItype,extritype,extI8type. */
enum mips16_inst_fmts
{
itype, /* 0 immediate 5,10 */
extshift64type /* 21 5,5,1,1,1,1,1,1,5,1,1,1,3,5 */
};
/* I am heaping all the fields of the formats into one structure and
- then, only the fields which are involved in instruction extension */
+ then, only the fields which are involved in instruction extension. */
struct upk_mips16
{
CORE_ADDR offset;
- unsigned int regx; /* Function in i8 type */
+ unsigned int regx; /* Function in i8 type. */
unsigned int regy;
};
CORE_ADDR value;
value = (extension >> 21) & 0x3f; /* * extract 15:11 */
value = value << 6;
- value |= (extension >> 16) & 0x1f; /* extrace 10:5 */
+ value |= (extension >> 16) & 0x1f; /* extract 10:5 */
value = value << 5;
value |= extension & 0x01f; /* extract 4:0 */
return value;
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[8];
- pc &= 0xfffffffe; /* clear the low order bit */
+ pc &= 0xfffffffe; /* Clear the low order bit. */
target_read_memory (pc, buf, 2);
return extract_unsigned_integer (buf, 2, byte_order);
}
else
{
value = inst & 0x7ff;
- /* FIXME : Consider sign extension */
+ /* FIXME : Consider sign extension. */
}
offset = value;
regx = -1;
break;
case ritype:
case i8type:
- { /* A register identifier and an offset */
+ { /* A register identifier and an offset. */
/* Most of the fields are the same as I type but the
- immediate value is of a different length */
+ immediate value is of a different length. */
CORE_ADDR value;
if (extension)
{
value = extended_offset (extension);
- value = value << 8; /* from the original instruction */
+ value = value << 8; /* from the original instruction */
value |= inst & 0xff; /* eleven bits from instruction */
regx = (extension >> 8) & 0x07; /* or i8 funct */
- if (value & 0x4000) /* test the sign bit , bit 26 */
+ if (value & 0x4000) /* Test the sign bit, bit 26. */
{
- value &= ~0x3fff; /* remove the sign bit */
+ value &= ~0x3fff; /* Remove the sign bit. */
value = -value;
}
}
{
value = inst & 0xff; /* 8 bits */
regx = (inst >> 8) & 0x07; /* or i8 funct */
- /* FIXME: Do sign extension , this format needs it */
- if (value & 0x80) /* THIS CONFUSES ME */
+ /* FIXME: Do sign extension, this format needs it. */
+ if (value & 0x80) /* THIS CONFUSES ME. */
{
- value &= 0xef; /* remove the sign bit */
+ value &= 0xef; /* Remove the sign bit. */
value = -value;
}
}
unsigned int nexthalf;
value = ((inst & 0x1f) << 5) | ((inst >> 5) & 0x1f);
value = value << 16;
- nexthalf = mips_fetch_instruction (gdbarch, pc + 2); /* low bit still set */
+ nexthalf = mips_fetch_instruction (gdbarch, pc + 2); /* low bit
+ still set. */
value |= nexthalf;
offset = value;
regx = -1;
pc += (offset << 1) + 2;
break;
}
- case 3: /* JAL , JALX - Watch out, these are 32 bit instruction */
+ case 3: /* JAL , JALX - Watch out, these are 32 bit
+ instructions. */
{
struct upk_mips16 upk;
unpack_mips16 (gdbarch, pc, extension, insn, jalxtype, &upk);
pc = add_offset_16 (pc, upk.offset);
if ((insn >> 10) & 0x01) /* Exchange mode */
- pc = pc & ~0x01; /* Clear low bit, indicate 32 bit mode */
+ pc = pc & ~0x01; /* Clear low bit, indicate 32 bit mode. */
else
pc |= 0x01;
break;
break;
case 1:
reg = 31;
- break; /* Function return instruction */
+ break; /* Function return instruction. */
case 2:
reg = upk.regx;
break;
case 30:
/* This is an instruction extension. Fetch the real instruction
(which follows the extension) and decode things based on
- that. */
+ that. */
{
pc += 2;
pc = extended_mips16_next_pc (frame, pc, insn,
/* The mips_next_pc function supports single_step when the remote
target monitor or stub is not developed enough to do a single_step.
It works by decoding the current instruction and predicting where a
- branch will go. This isnt hard because all the data is available.
+ branch will go. This isnt hard because all the data is available.
The MIPS32 and MIPS16 variants are quite different. */
static CORE_ADDR
mips_next_pc (struct frame_info *frame, CORE_ADDR pc)
unsigned short inst, /* current instruction */
int nbits, /* number of bits in imm field */
int scale, /* scale factor to be applied to imm */
- int is_signed) /* is the imm field signed? */
+ int is_signed) /* is the imm field signed? */
{
int offset;
struct mips_frame_cache *this_cache)
{
CORE_ADDR cur_pc;
- CORE_ADDR frame_addr = 0; /* Value of $r17, used as frame pointer */
+ CORE_ADDR frame_addr = 0; /* Value of $r17, used as frame pointer. */
CORE_ADDR sp;
long frame_offset = 0; /* Size of stack frame. */
long frame_adjust = 0; /* Offset of FP from SP. */
int frame_reg = MIPS_SP_REGNUM;
- unsigned short prev_inst = 0; /* saved copy of previous instruction */
+ unsigned short prev_inst = 0; /* saved copy of previous instruction. */
unsigned inst = 0; /* current instruction */
unsigned entry_inst = 0; /* the entry instruction */
unsigned save_inst = 0; /* the save instruction */
the immediate offset extension from it in mips16_get_imm. */
prev_inst = inst;
- /* Fetch and decode the instruction. */
+ /* Fetch and decode the instruction. */
inst = (unsigned short) mips_fetch_instruction (gdbarch, cur_pc);
/* Normally we ignore extend instructions. However, if it is
|| (inst & 0xff00) == 0xfb00) /* daddiu sp */
{
offset = mips16_get_imm (prev_inst, inst, 8, 8, 1);
- if (offset < 0) /* negative stack adjustment? */
+ if (offset < 0) /* Negative stack adjustment? */
frame_offset -= offset;
else
/* Exit loop if a positive stack adjustment is found, which
}
else if ((inst & 0xf81f) == 0xe809
&& (inst & 0x700) != 0x700) /* entry */
- entry_inst = inst; /* save for later processing */
+ entry_inst = inst; /* Save for later processing. */
else if ((inst & 0xff80) == 0x6480) /* save */
{
- save_inst = inst; /* save for later processing */
+ save_inst = inst; /* Save for later processing. */
if (prev_extend_bytes) /* extend */
save_inst |= prev_inst << 16;
}
(before the prologue). But the value of the sp parameter to this
function is the new SP (after the prologue has been executed). So we
can't calculate those offsets until we've seen the entire prologue,
- and can calculate what the old SP must have been. */
+ and can calculate what the old SP must have been. */
if (entry_inst != 0)
{
int areg_count = (entry_inst >> 8) & 7;
gdbarch_num_regs (gdbarch) + frame_reg)
+ frame_offset - frame_adjust);
/* FIXME: brobecker/2004-10-10: Just as in the mips32 case, we should
- be able to get rid of the assignment below, evetually. But it's
+ be able to get rid of the assignment below, evetually. But it's
still needed for now. */
this_cache->saved_regs[gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->pc]
}
}
-/* Analyze the function prologue from START_PC to LIMIT_PC. Builds
+/* Analyze the function prologue from START_PC to LIMIT_PC. Builds
the associated FRAME_CACHE if not null.
Return the address of the first instruction past the prologue. */
struct mips_frame_cache *this_cache)
{
CORE_ADDR cur_pc;
- CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */
+ CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for
+ frame-pointer. */
CORE_ADDR sp;
long frame_offset;
int frame_reg = MIPS_SP_REGNUM;
unsigned long inst, high_word, low_word;
int reg;
- /* Fetch the instruction. */
+ /* Fetch the instruction. */
inst = (unsigned long) mips_fetch_instruction (gdbarch, cur_pc);
/* Save some code by pre-extracting some useful fields. */
low_word = inst & 0xffff;
reg = high_word & 0x1f;
- if (high_word == 0x27bd /* addiu $sp,$sp,-i */
+ if (high_word == 0x27bd /* addiu $sp,$sp,-i */
|| high_word == 0x23bd /* addi $sp,$sp,-i */
|| high_word == 0x67bd) /* daddiu $sp,$sp,-i */
{
- if (low_word & 0x8000) /* negative stack adjustment? */
+ if (low_word & 0x8000) /* Negative stack adjustment? */
frame_offset += 0x10000 - low_word;
else
/* Exit loop if a positive stack adjustment is found, which
alloca_adjust = (unsigned) (frame_addr - (sp + low_word));
if (alloca_adjust > 0)
{
- /* FP > SP + frame_size. This may be because of
+ /* FP > SP + frame_size. This may be because of
an alloca or somethings similar. Fix sp to
"pre-alloca" value, and try again. */
sp += alloca_adjust;
alloca_adjust = (unsigned) (frame_addr - sp);
if (alloca_adjust > 0)
{
- /* FP > SP + frame_size. This may be because of
+ /* FP > SP + frame_size. This may be because of
an alloca or somethings similar. Fix sp to
"pre-alloca" value, and try again. */
sp = frame_addr;
}
/* The instructions below load $at or $t0 with an immediate
value in preparation for a stack adjustment via
- subu $sp,$sp,[$at,$t0]. These instructions could also
+ subu $sp,$sp,[$at,$t0]. These instructions could also
initialize a local variable, so we accept them only before
a stack adjustment instruction was seen. */
else if (!seen_sp_adjust
end_prologue_addr = cur_pc;
/* In a frameless function, we might have incorrectly
- skipped some load immediate instructions. Undo the skipping
+ skipped some load immediate instructions. Undo the skipping
if the load immediate was not followed by a stack adjustment. */
if (load_immediate_bytes && !seen_sp_adjust)
end_prologue_addr -= load_immediate_bytes;
{
case 0: /* SPECIAL */
if (rtype_funct (insn) >> 1 == 4) /* JR, JALR */
- return 0; /* fallback to the standard single-step code. */
+ return 0; /* fallback to the standard single-step code. */
break;
case 1: /* REGIMM */
is_branch = ((itype_rt (insn) & 0xc0) == 0); /* B{LT,GE}Z* */
break;
case 2: /* J */
case 3: /* JAL */
- return 0; /* fallback to the standard single-step code. */
+ return 0; /* fallback to the standard single-step code. */
case 4: /* BEQ */
case 5: /* BNE */
case 6: /* BLEZ */
breaks[0] = loc;
/* Check for duplicated breakpoints. Check also for a breakpoint
- placed (branch instruction's destination) in the atomic sequence */
+ placed (branch instruction's destination) in the atomic sequence. */
if (last_breakpoint && pc <= breaks[1] && breaks[1] <= breaks[0])
last_breakpoint = 0;
}
/* Test whether the PC points to the return instruction at the
- end of a function. */
+ end of a function. */
static int
mips_about_to_return (struct gdbarch *gdbarch, CORE_ADDR pc)
inf = current_inferior ();
- /* search back for previous return */
+ /* Search back for previous return. */
for (start_pc -= instlen;; start_pc -= instlen)
if (start_pc < fence)
{
entry
addiu sp,-n
daddiu sp,-n
- extend -n followed by 'addiu sp,+n' or 'daddiu sp,+n' */
+ extend -n followed by 'addiu sp,+n' or 'daddiu sp,+n'. */
inst = mips_fetch_instruction (gdbarch, start_pc);
if ((inst & 0xff80) == 0x6480) /* save */
{
floating-point register (assuming that there is space)? When there
is no FPU, FP are not even considered as possible candidates for
FP registers and, consequently this returns false - forces FP
- arguments into integer registers. */
+ arguments into integer registers. */
static int
fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
}
/* On o32, argument passing in GPRs depends on the alignment of the type being
- passed. Return 1 if this type must be aligned to a doubleword boundary. */
+ passed. Return 1 if this type must be aligned to a doubleword boundary. */
static int
mips_type_needs_double_align (struct type *type)
{
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
- "mips_eabi_push_dummy_call: struct_return reg=%d %s\n",
+ "mips_eabi_push_dummy_call: "
+ "struct_return reg=%d %s\n",
argreg, paddress (gdbarch, struct_addr));
regcache_cooked_write_unsigned (regcache, argreg++, struct_addr);
}
|| fp_register_arg_p (gdbarch, typecode, arg_type))
{
/* Should shorter than int integer values be
- promoted to int before being stored? */
+ promoted to int before being stored? */
int longword_offset = 0;
CORE_ADDR addr;
stack_used_p = 1;
{
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
- "mips_n32n64_push_dummy_call: struct_return reg=%d %s\n",
+ "mips_n32n64_push_dummy_call: "
+ "struct_return reg=%d %s\n",
argreg, paddress (gdbarch, struct_addr));
regcache_cooked_write_unsigned (regcache, argreg++, struct_addr);
}
if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch))
{
/* Should shorter than int integer values be
- promoted to int before being stored? */
+ promoted to int before being stored? */
int longword_offset = 0;
CORE_ADDR addr;
stack_used_p = 1;
{
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
- "mips_o32_push_dummy_call: struct_return reg=%d %s\n",
+ "mips_o32_push_dummy_call: "
+ "struct_return reg=%d %s\n",
argreg, paddress (gdbarch, struct_addr));
regcache_cooked_write_unsigned (regcache, argreg++, struct_addr);
stack_offset += MIPS32_REGSIZE;
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, 4));
- regcache_cooked_write_unsigned (regcache, float_argreg++, regval);
+ regcache_cooked_write_unsigned (regcache,
+ float_argreg++, regval);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
argreg, phex (regval, 4));
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, 4));
- regcache_cooked_write_unsigned (regcache, float_argreg++, regval);
+ regcache_cooked_write_unsigned (regcache,
+ float_argreg++, regval);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, len));
- regcache_cooked_write_unsigned (regcache, float_argreg++, regval);
+ regcache_cooked_write_unsigned (regcache,
+ float_argreg++, regval);
/* Although two FP registers are reserved for each
argument, only one corresponding integer register is
reserved. */
|| odd_sized_struct)
{
/* Should shorter than int integer values be
- promoted to int before being stored? */
+ promoted to int before being stored? */
int longword_offset = 0;
CORE_ADDR addr;
stack_used_p = 1;
{
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
- "mips_o64_push_dummy_call: struct_return reg=%d %s\n",
+ "mips_o64_push_dummy_call: "
+ "struct_return reg=%d %s\n",
argreg, paddress (gdbarch, struct_addr));
regcache_cooked_write_unsigned (regcache, argreg++, struct_addr);
stack_offset += MIPS64_REGSIZE;
|| odd_sized_struct)
{
/* Should shorter than int integer values be
- promoted to int before being stored? */
+ promoted to int before being stored? */
int longword_offset = 0;
CORE_ADDR addr;
stack_used_p = 1;
big endian targets.
It does not seem to be necessary to do the
- same for integral types. */
+ same for integral types. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
&& partial_len < MIPS64_REGSIZE
else
{
/* A scalar extract each part but least-significant-byte
- justified. */
+ justified. */
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
Note that this code only deals with "live" registers at the top of the
stack. We will attempt to deal with saved registers later, when
- the raw/cooked register interface is in place. (We need a general
+ the raw/cooked register interface is in place. (We need a general
interface that can deal with dynamic saved register sizes -- fp
regs could be 32 bits wide in one frame and 64 on the frame above
and below). */
static void
mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
int regnum)
-{ /* do values for FP (float) regs */
+{ /* Do values for FP (float) regs. */
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte *raw_buffer;
- double doub, flt1; /* doubles extracted from raw hex data */
+ double doub, flt1; /* Doubles extracted from raw hex data. */
int inv1, inv2;
- raw_buffer = alloca (2 * register_size (gdbarch, mips_regnum (gdbarch)->fp0));
+ raw_buffer = alloca (2 * register_size (gdbarch,
+ mips_regnum (gdbarch)->fp0));
fprintf_filtered (file, "%s:", gdbarch_register_name (gdbarch, regnum));
fprintf_filtered (file, "%*s",
/* 4-byte registers: Print hex and floating. Also print even
numbered registers as doubles. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
- flt1 = unpack_double (builtin_type (gdbarch)->builtin_float, raw_buffer, &inv1);
+ flt1 = unpack_double (builtin_type (gdbarch)->builtin_float,
+ raw_buffer, &inv1);
get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer,
}
-/* Print a row's worth of GP (int) registers, with name labels above */
+/* Print a row's worth of GP (int) registers, with name labels above. */
static int
print_gp_register_row (struct ui_file *file, struct frame_info *frame,
int start_regnum)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- /* do values for GP (int) regs */
+ /* Do values for GP (int) regs. */
gdb_byte raw_buffer[MAX_REGISTER_SIZE];
- int ncols = (mips_abi_regsize (gdbarch) == 8 ? 4 : 8); /* display cols per row */
+ int ncols = (mips_abi_regsize (gdbarch) == 8 ? 4 : 8); /* display cols
+ per row. */
int col, byte;
int regnum;
- /* For GP registers, we print a separate row of names above the vals */
+ /* For GP registers, we print a separate row of names above the vals. */
for (col = 0, regnum = start_regnum;
col < ncols && regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch);
continue; /* unused register */
if (TYPE_CODE (register_type (gdbarch, regnum)) ==
TYPE_CODE_FLT)
- break; /* end the row: reached FP register */
+ break; /* End the row: reached FP register. */
/* Large registers are handled separately. */
if (register_size (gdbarch, regnum) > mips_abi_regsize (gdbarch))
{
if (col == 0)
return regnum;
- /* print the R0 to R31 names */
+ /* Print the R0 to R31 names. */
if ((start_regnum % gdbarch_num_regs (gdbarch)) < MIPS_NUMREGS)
fprintf_filtered (file, "\n R%-4d",
start_regnum % gdbarch_num_regs (gdbarch));
else
fprintf_filtered (file, "\n ");
- /* now print the values in hex, 4 or 8 to the row */
+ /* Now print the values in hex, 4 or 8 to the row. */
for (col = 0, regnum = start_regnum;
col < ncols && regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch);
continue; /* unused register */
if (TYPE_CODE (register_type (gdbarch, regnum)) ==
TYPE_CODE_FLT)
- break; /* end row: reached FP register */
+ break; /* End row: reached FP register. */
if (register_size (gdbarch, regnum) > mips_abi_regsize (gdbarch))
break; /* End row: large register. */
byte < (mips_abi_regsize (gdbarch)
- register_size (gdbarch, regnum)); byte++)
printf_filtered (" ");
- /* Now print the register value in hex, endian order. */
+ /* Now print the register value in hex, endian order. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
for (byte =
register_size (gdbarch, regnum) - register_size (gdbarch, regnum);
fprintf_filtered (file, " ");
col++;
}
- if (col > 0) /* ie. if we actually printed anything... */
+ if (col > 0) /* ie. if we actually printed anything... */
fprintf_filtered (file, "\n");
return regnum;
}
-/* MIPS_DO_REGISTERS_INFO(): called by "info register" command */
+/* MIPS_DO_REGISTERS_INFO(): called by "info register" command. */
static void
mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, int regnum, int all)
{
- if (regnum != -1) /* do one specified register */
+ if (regnum != -1) /* Do one specified register. */
{
gdb_assert (regnum >= gdbarch_num_regs (gdbarch));
if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
fprintf_filtered (file, "\n");
}
else
- /* do all (or most) registers */
+ /* Do all (or most) registers. */
{
regnum = gdbarch_num_regs (gdbarch);
while (regnum < gdbarch_num_regs (gdbarch)
if (TYPE_CODE (register_type (gdbarch, regnum)) ==
TYPE_CODE_FLT)
{
- if (all) /* true for "INFO ALL-REGISTERS" command */
+ if (all) /* True for "INFO ALL-REGISTERS" command. */
regnum = print_fp_register_row (file, frame, regnum);
else
- regnum += MIPS_NUMREGS; /* skip floating point regs */
+ regnum += MIPS_NUMREGS; /* Skip floating point regs. */
}
else
regnum = print_gp_register_row (file, frame, regnum);
return mips32_in_function_epilogue_p (gdbarch, pc);
}
-/* Root of all "set mips "/"show mips " commands. This will eventually be
+/* Root of all "set mips "/"show mips " commands. This will eventually be
used for all MIPS-specific commands. */
static void
internal_error (__FILE__, __LINE__, _("bad switch"));
}
if (mips_fpu_type_auto)
- printf_unfiltered
- ("The MIPS floating-point coprocessor is set automatically (currently %s)\n",
- fpu);
+ printf_unfiltered ("The MIPS floating-point coprocessor "
+ "is set automatically (currently %s)\n",
+ fpu);
else
printf_unfiltered
("The MIPS floating-point coprocessor is assumed to be %s\n", fpu);
static void
set_mipsfpu_command (char *args, int from_tty)
{
- printf_unfiltered
- ("\"set mipsfpu\" must be followed by \"double\", \"single\",\"none\" or \"auto\".\n");
+ printf_unfiltered ("\"set mipsfpu\" must be followed by \"double\", "
+ "\"single\",\"none\" or \"auto\".\n");
show_mipsfpu_command (args, from_tty);
}
return gdb_print_insn_mips (memaddr, info);
}
-/* This function implements gdbarch_breakpoint_from_pc. It uses the program
- counter value to determine whether a 16- or 32-bit breakpoint should be used.
- It returns a pointer to a string of bytes that encode a breakpoint
- instruction, stores the length of the string to *lenptr, and adjusts pc (if
- necessary) to point to the actual memory location where the breakpoint
- should be inserted. */
+/* This function implements gdbarch_breakpoint_from_pc. It uses the
+ program counter value to determine whether a 16- or 32-bit breakpoint
+ should be used. It returns a pointer to a string of bytes that encode a
+ breakpoint instruction, stores the length of the string to *lenptr, and
+ adjusts pc (if necessary) to point to the actual memory location where
+ the breakpoint should be inserted. */
static const gdb_byte *
-mips_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
+mips_breakpoint_from_pc (struct gdbarch *gdbarch,
+ CORE_ADDR *pcptr, int *lenptr)
{
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
static gdb_byte pmon_big_breakpoint[] = { 0, 0, 0, 0xd };
static gdb_byte idt_big_breakpoint[] = { 0, 0, 0x0a, 0xd };
/* Likewise, IRIX appears to expect a different breakpoint,
- although this is not apparent until you try to use pthreads. */
+ although this is not apparent until you try to use pthreads. */
static gdb_byte irix_big_breakpoint[] = { 0, 0, 0, 0xd };
*lenptr = sizeof (big_breakpoint);
{
inst = mips_fetch_instruction (gdbarch, target_pc);
if ((inst & 0xffff0000) == 0x3c010000) /* lui $at */
- pc = (inst << 16) & 0xffff0000; /* high word */
+ pc = (inst << 16) & 0xffff0000; /* high word */
else if ((inst & 0xffff0000) == 0x24210000) /* addiu $at */
- return pc | (inst & 0xffff); /* low word */
+ return pc | (inst & 0xffff); /* low word */
}
/* Couldn't find the lui/addui pair, so return stub address. */
if (gdbarch_register_name (gdbarch,
gdbarch_num_regs (gdbarch) + regnum) != NULL
&& gdbarch_register_name (gdbarch,
- gdbarch_num_regs (gdbarch) + regnum)[0] != '\0')
+ gdbarch_num_regs (gdbarch)
+ + regnum)[0] != '\0')
return regnum;
else
return LEGACY_SIM_REGNO_IGNORE;
/* Also used when doing an architecture lookup. */
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog,
- "mips_gdbarch_init: mips64_transfers_32bit_regs_p = %d\n",
+ "mips_gdbarch_init: "
+ "mips64_transfers_32bit_regs_p = %d\n",
mips64_transfers_32bit_regs_p);
/* Determine the MIPS FPU type. */
return NULL;
}
- /* try to find a pre-existing architecture */
+ /* Try to find a pre-existing architecture. */
for (arches = gdbarch_list_lookup_by_info (arches, &info);
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
Note that for o32 and eabi32, pointers are always 32 bits
regardless of any -mlongXX option. For all others, pointers and
- longs are the same, as set by -mlongXX or set by defaults.
- */
+ longs are the same, as set by -mlongXX or set by defaults. */
if (info.abfd != NULL)
{
mips_dwarf_dwarf2_ecoff_reg_to_regnum);
set_gdbarch_register_sim_regno (gdbarch, mips_register_sim_regno);
- /* MIPS version of CALL_DUMMY */
+ /* MIPS version of CALL_DUMMY. */
/* NOTE: cagney/2003-08-05: Eventually call dummy location will be
replaced by a command, and all targets will default to on stack
set_gdbarch_skip_trampoline_code (gdbarch, mips_skip_trampoline_code);
- set_gdbarch_single_step_through_delay (gdbarch, mips_single_step_through_delay);
+ set_gdbarch_single_step_through_delay (gdbarch,
+ mips_single_step_through_delay);
/* Virtual tables. */
set_gdbarch_vbit_in_delta (gdbarch, 1);
/* Override the normal target description methods to handle our
dual real and pseudo registers. */
set_gdbarch_register_name (gdbarch, mips_register_name);
- set_gdbarch_register_reggroup_p (gdbarch, mips_tdesc_register_reggroup_p);
+ set_gdbarch_register_reggroup_p (gdbarch,
+ mips_tdesc_register_reggroup_p);
num_regs = gdbarch_num_regs (gdbarch);
set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
else
{
/* Probably shouldn't happen... */
- fprintf_filtered
- (file,
- "The (auto detected) MIPS ABI \"%s\" is in use even though the user setting was \"%s\".\n",
+ fprintf_filtered (file,
+ "The (auto detected) MIPS ABI \"%s\" is in use "
+ "even though the user setting was \"%s\".\n",
actual_abi_str, mips_abi_strings[global_abi]);
}
}
"mips_dump_tdep: tdep->mips_abi = %d (%s)\n",
tdep->mips_abi, mips_abi_strings[tdep->mips_abi]);
fprintf_unfiltered (file,
- "mips_dump_tdep: mips_mask_address_p() %d (default %d)\n",
+ "mips_dump_tdep: "
+ "mips_mask_address_p() %d (default %d)\n",
mips_mask_address_p (tdep),
tdep->default_mask_address_p);
}
: "???"));
}
-extern initialize_file_ftype _initialize_mips_tdep; /* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_mips_tdep; /* -Wmissing-prototypes */
void
_initialize_mips_tdep (void)
mips_tdesc_gp64 = allocate_target_description ();
set_tdesc_property (mips_tdesc_gp64, PROPERTY_GP64, "");
- /* Add root prefix command for all "set mips"/"show mips" commands */
+ /* Add root prefix command for all "set mips"/"show mips" commands. */
add_prefix_cmd ("mips", no_class, set_mips_command,
_("Various MIPS specific commands."),
&setmipscmdlist, "set mips ", 0, &setlist);
_("Various MIPS specific commands."),
&showmipscmdlist, "show mips ", 0, &showlist);
- /* Allow the user to override the ABI. */
+ /* Allow the user to override the ABI. */
add_setshow_enum_cmd ("abi", class_obscure, mips_abi_strings,
&mips_abi_string, _("\
Set the MIPS ABI used by this program."), _("\
program for the start of a function. This command sets the distance of the\n\
search. The only need to set it is when debugging a stripped executable."),
reinit_frame_cache_sfunc,
- NULL, /* FIXME: i18n: The distance searched for the start of a function is %s. */
+ NULL, /* FIXME: i18n: The distance searched for
+ the start of a function is %s. */
&setlist, &showlist);
/* Allow the user to control whether the upper bits of 64-bit
that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\
64 bits for others. Use \"off\" to disable compatibility mode"),
set_mips64_transfers_32bit_regs,
- NULL, /* FIXME: i18n: Compatibility with 64-bit MIPS target that transfers 32-bit quantities is %s. */
+ NULL, /* FIXME: i18n: Compatibility with 64-bit
+ MIPS target that transfers 32-bit
+ quantities is %s. */
&setlist, &showlist);
- /* Debug this files internals. */
+ /* Debug this files internals. */
add_setshow_zinteger_cmd ("mips", class_maintenance,
&mips_debug, _("\
Set mips debugging."), _("\
Show mips debugging."), _("\
When non-zero, mips specific debugging is enabled."),
NULL,
- NULL, /* FIXME: i18n: Mips debugging is currently %s. */
+ NULL, /* FIXME: i18n: Mips debugging is
+ currently %s. */
&setdebuglist, &showdebuglist);
}
struct gdbarch;
-/* All the possible MIPS ABIs. */
+/* All the possible MIPS ABIs. */
enum mips_abi
{
MIPS_ABI_UNKNOWN = 0,
MIPS_FPU_NONE /* No floating point. */
};
-/* MIPS specific per-architecture information */
+/* MIPS specific per-architecture information. */
struct gdbarch_tdep
{
/* from the elf header */
MIPS_ZERO_REGNUM = 0, /* Read-only register, always 0. */
MIPS_AT_REGNUM = 1,
MIPS_V0_REGNUM = 2, /* Function integer return value. */
- MIPS_A0_REGNUM = 4, /* Loc of first arg during a subr call */
+ MIPS_A0_REGNUM = 4, /* Loc of first arg during a subr call. */
MIPS_T9_REGNUM = 25, /* Contains address of callee in PIC. */
MIPS_SP_REGNUM = 29,
MIPS_RA_REGNUM = 31,
MIPS_EMBED_CAUSE_REGNUM = 36,
MIPS_EMBED_PC_REGNUM = 37,
MIPS_EMBED_FP0_REGNUM = 38,
- MIPS_UNUSED_REGNUM = 73, /* Never used, FIXME */
+ MIPS_UNUSED_REGNUM = 73, /* Never used, FIXME. */
MIPS_FIRST_EMBED_REGNUM = 74, /* First CP0 register for embedded use. */
MIPS_PRID_REGNUM = 89, /* Processor ID. */
MIPS_LAST_EMBED_REGNUM = 89 /* Last one. */
};
-/* Defined in mips-tdep.c and used in remote-mips.c */
+/* Defined in mips-tdep.c and used in remote-mips.c. */
extern void deprecated_mips_set_processor_regs_hack (void);
/* Instruction sizes and other useful constants. */
function. */
extern int mips_pc_is_mips16 (bfd_vma memaddr);
-/* Return the currently configured (or set) saved register size. */
+/* Return the currently configured (or set) saved register size. */
extern unsigned int mips_abi_regsize (struct gdbarch *gdbarch);
/* Target descriptions which only indicate the size of general
return;
}
- if (regno == -1 || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+ if (regno == -1
+ || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
{
struct fpreg fpregs;
return;
}
- if (regno == -1 || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+ if (regno == -1
+ || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
{
struct fpreg fpregs;
}
void
-mipsnbsd_supply_fpreg (struct regcache *regcache, const char *fpregs, int regno)
+mipsnbsd_supply_fpreg (struct regcache *regcache,
+ const char *fpregs, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int i;
read_alphacoff_dynamic_symtab (objfile->section_offsets, objfile);
/* Install any minimal symbols that have been collected as the current
- minimal symbols for this objfile. */
+ minimal symbols for this objfile. */
install_minimal_symbols (objfile);
do_cleanups (back_to);
standard COFF section. The ELF format for the symbols differs from
the format defined in elf/external.h. It seems that a normal ELF
32-bit format is used, and the representation only changes because
- longs are 64-bit on the alpha. In addition, the handling of
+ longs are 64-bit on the alpha. In addition, the handling of
text/data section indices for symbols is different from the ELF
ABI. As the BFD linker currently does not support dynamic linking
on the alpha, there seems to be no reason to pollute BFD with
}
else
{
- /* Symbols defined in the executable itself. We only care
+ /* Symbols defined in the executable itself. We only care
about them if this is a stripped executable, otherwise
they have been retrieved from the normal symbol table
already. */
static const struct sym_fns ecoff_sym_fns =
{
bfd_target_ecoff_flavour,
- mipscoff_new_init, /* sym_new_init: init anything gbl to entire symtab */
- mipscoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
- mipscoff_symfile_read, /* sym_read: read a symbol file into symtab */
- mipscoff_symfile_finish, /* sym_finish: finished with file, cleanup */
- default_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */
- default_symfile_segments, /* sym_segments: Get segment information from
- a file. */
- NULL, /* sym_read_linetable */
- default_symfile_relocate, /* sym_relocate: Relocate a debug section. */
+ mipscoff_new_init, /* init anything gbl to entire symtab */
+ mipscoff_symfile_init, /* read initial info, setup for sym_read() */
+ mipscoff_symfile_read, /* read a symbol file into symtab */
+ mipscoff_symfile_finish, /* finished with file, cleanup */
+ default_symfile_offsets, /* dummy FIXME til implem sym reloc */
+ default_symfile_segments, /* Get segment information from a file. */
+ NULL,
+ default_symfile_relocate, /* Relocate a debug section. */
&psym_functions
};
Given a section name and size, create a struct reg object
with a supply_register and a collect_register method. */
-/* Copy register value of REGNUM from regset to regcache.
+/* Copy register value of REGNUM from regset to regcache.
If REGNUM is -1, do this for all gp registers in regset. */
static void
return;
}
-/* Copy fp register value of REGNUM from regset to regcache.
- If REGNUM is -1, do this for all fp registers in regset. */
+/* Copy fp register value of REGNUM from regset to regcache.
+ If REGNUM is -1, do this for all fp registers in regset. */
static void
am33_supply_fpregset_method (const struct regset *regset,
else if (regnum == E_FPCR_REGNUM)
regcache_raw_supply (regcache, E_FPCR_REGNUM,
&fpregset->fpcr);
- else if (E_FS0_REGNUM <= regnum && regnum < E_FS0_REGNUM + MN10300_ELF_NFPREG)
+ else if (E_FS0_REGNUM <= regnum
+ && regnum < E_FS0_REGNUM + MN10300_ELF_NFPREG)
regcache_raw_supply (regcache, regnum,
&fpregset->fpregs[regnum - E_FS0_REGNUM]);
sc_base + AM33_SIGCONTEXT_PC);
fpubase = get_frame_memory_unsigned (this_frame,
- sc_base + AM33_SIGCONTEXT_FPUCONTEXT, 4);
+ sc_base + AM33_SIGCONTEXT_FPUCONTEXT,
+ 4);
if (fpubase)
{
for (i = 0; i < 32; i++)
#include "regcache.h"
#include "gdb_string.h"
#include "gdb_assert.h"
-#include "gdbcore.h" /* for write_memory_unsigned_integer */
+#include "gdbcore.h" /* For write_memory_unsigned_integer. */
#include "value.h"
#include "gdbtypes.h"
#include "frame.h"
void **this_prologue_cache,
struct frame_id *this_id)
{
- *this_id = frame_id_build (mn10300_frame_base (this_frame, this_prologue_cache),
+ *this_id = frame_id_build (mn10300_frame_base (this_frame,
+ this_prologue_cache),
get_frame_func (this_frame));
}
else
regs_used = 0;
- /* Push all arguments onto the stack. */
+ /* Push all arguments onto the stack. */
for (argnum = 0; argnum < nargs; argnum++)
{
/* FIXME what about structs? Unions? */
Note that we don't update the return value though because that's
the value of the stack just after pushing the arguments, but prior
to performing the call. This value is needed in order to
- construct the frame ID of the dummy call. */
+ construct the frame ID of the dummy call. */
{
CORE_ADDR func_addr = find_function_addr (target_func, NULL);
CORE_ADDR unwound_sp
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Breakpoints. */
set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc);
- /* decr_pc_after_break? */
+ /* decr_pc_after_break? */
/* Disassembly. */
set_gdbarch_print_insn (gdbarch, print_insn_mn10300);
return gdbarch;
}
-/* Dump out the mn10300 specific architecture information. */
+/* Dump out the mn10300 specific architecture information. */
static void
mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
movm_d2_bit = 0x80
};
-/* Values for frame_info.status */
+/* Values for frame_info.status. */
enum frame_kind {
MY_FRAME_IN_SP = 0x1,
NO_MORE_FRAMES = 0x4
};
-/* mn10300 private data */
+/* mn10300 private data. */
struct gdbarch_tdep
{
int am33_mode;
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* This file was derived from various remote-* modules. It is a collection
+/* This file was derived from various remote-* modules. It is a collection
of generic support functions so GDB can talk directly to a ROM based
- monitor. This saves use from having to hack an exception based handler
+ monitor. This saves use from having to hack an exception based handler
into existence, and makes for quick porting.
This module talks to a debug monitor called 'MONITOR', which
static struct monitor_ops *current_monitor;
-static int hashmark; /* flag set by "set hash" */
+static int hashmark; /* flag set by "set hash". */
static int timeout = 30;
-static int in_monitor_wait = 0; /* Non-zero means we are in monitor_wait() */
+static int in_monitor_wait = 0; /* Non-zero means we are in monitor_wait(). */
-static void (*ofunc) (); /* Old SIGINT signal handler */
+static void (*ofunc) (); /* Old SIGINT signal handler. */
static CORE_ADDR *breakaddr;
static struct serial *monitor_desc = NULL;
-/* Pointer to regexp pattern matching data */
+/* Pointer to regexp pattern matching data. */
static struct re_pattern_buffer register_pattern;
static char register_fastmap[256];
static int first_time = 0; /* Is this the first time we're
executing after gaving created the
- child proccess? */
+ child proccess? */
/* This is the ptid we use while we're connected to a monitor. Its
#define TARGET_BUF_SIZE 2048
/* Monitor specific debugging information. Typically only useful to
- the developer of a new monitor interface. */
+ the developer of a new monitor interface. */
static void monitor_debug (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2);
/* NOTE: This file alternates between monitor_debug_p and remote_debug
when determining if debug information is printed. Perhaps this
- could be simplified. */
+ could be simplified. */
static void
monitor_debug (const char *fmt, ...)
/* Convert a string into a printable representation, Return # byte in
the new string. When LEN is >0 it specifies the size of the
- string. Otherwize strlen(oldstr) is used. */
+ string. Otherwize strlen(oldstr) is used. */
static void
monitor_printable_string (char *newstr, char *oldstr, int len)
If it is a '%s' format, the argument is a string; otherwise the
argument is assumed to be a long integer.
- %% is also turned into a single %.
- */
+ %% is also turned into a single %. */
static void
monitor_vsprintf (char *sndbuf, char *pattern, va_list args)
{
c &= 0x7f;
/* This seems to interfere with proper function of the
- input stream */
+ input stream. */
if (monitor_debug_p || remote_debug)
{
char buf[2];
}
- /* Canonicialize \n\r combinations into one \r */
+ /* Canonicialize \n\r combinations into one \r. */
if ((current_monitor->flags & MO_HANDLE_NL) != 0)
{
if ((c == '\r' && state == last_nl)
if (c == SERIAL_TIMEOUT)
#if 0
- /* I fail to see how detaching here can be useful */
- if (in_monitor_wait) /* Watchdog went off */
+ /* I fail to see how detaching here can be useful. */
+ if (in_monitor_wait) /* Watchdog went off. */
{
target_mourn_inferior ();
error (_("GDB serial timeout has expired. Target detached."));
else
c = readchar (timeout);
- /* Don't expect any ^C sent to be echoed */
+ /* Don't expect any ^C sent to be echoed. */
if (*p == '\003' || c == *p)
{
p, since we know no prefix can be longer than that.
Note that we can use STRING itself, along with C, as a record
- of what we've received so far. :) */
+ of what we've received so far. :) */
int i;
for (i = (p - string) - 1; i >= 0; i--)
{
/* Is this prefix a suffix of what we've read so far?
In other words, does
- string[0 .. i-1] == string[p - i, p - 1]? */
+ string[0 .. i-1] == string[p - i, p - 1]? */
if (! memcmp (string, p - i, i))
{
p = string + i + 1;
int retval;
if (p - mybuf >= buflen)
- { /* Buffer about to overflow */
+ { /* Buffer about to overflow. */
/* On overflow, we copy the upper half of the buffer to the lower half. Not
- great, but it usually works... */
+ great, but it usually works... */
memcpy (mybuf, mybuf + buflen / 2, buflen / 2);
p = mybuf + buflen / 2;
re_compile_fastmap (compiled_pattern);
}
-/* Open a connection to a remote debugger. NAME is the filename used
+/* Open a connection to a remote debugger. NAME is the filename used
for communication. */
void
target_preopen (from_tty);
- /* Setup pattern for register dump */
+ /* Setup pattern for register dump. */
if (mon_ops->register_pattern)
compile_pattern (mon_ops->register_pattern, ®ister_pattern,
serial_flush_input (monitor_desc);
- /* some systems only work with 2 stop bits */
+ /* some systems only work with 2 stop bits. */
serial_setstopbits (monitor_desc, mon_ops->stopbits);
}
}
- /* wake up the monitor and see if it's alive */
+ /* wake up the monitor and see if it's alive. */
for (p = mon_ops->init; *p != NULL; p++)
{
/* Some of the characters we send may not be echoed,
- but we hope to get a prompt at the end of it all. */
+ but we hope to get a prompt at the end of it all. */
if ((current_monitor->flags & MO_NO_ECHO_ON_OPEN) == 0)
monitor_printf (*p);
memset (breakaddr, 0, mon_ops->num_breakpoints * sizeof (CORE_ADDR));
}
- /* Remove all breakpoints */
+ /* Remove all breakpoints. */
if (mon_ops->clr_all_break)
{
inferior_appeared (inf, ptid_get_pid (inferior_ptid));
add_thread_silent (inferior_ptid);
- /* Give monitor_wait something to read */
+ /* Give monitor_wait something to read. */
monitor_printf (current_monitor->line_term);
if (monitor_desc)
serial_close (monitor_desc);
- /* Free breakpoint memory */
+ /* Free breakpoint memory. */
if (breakaddr != NULL)
{
xfree (breakaddr);
static void
monitor_detach (struct target_ops *ops, char *args, int from_tty)
{
- pop_target (); /* calls monitor_close to do the real work */
+ pop_target (); /* calls monitor_close to do the real work. */
if (from_tty)
printf_unfiltered (_("Ending remote %s debugging\n"), target_shortname);
}
error (_("monitor_supply_register (%d): bad value from monitor: %s."),
regno, valstr);
- /* supply register stores in target byte order, so swap here */
+ /* supply register stores in target byte order, so swap here. */
store_unsigned_integer (regbuf, register_size (gdbarch, regno), byte_order,
val);
monitor_resume (struct target_ops *ops,
ptid_t ptid, int step, enum target_signal sig)
{
- /* Some monitors require a different command when starting a program */
+ /* Some monitors require a different command when starting a program. */
monitor_debug ("MON resume\n");
if (current_monitor->flags & MO_RUN_FIRST_TIME && first_time == 1)
{
while (resp_len < 0);
/* Print any output characters that were preceded by ^O. */
- /* FIXME - This would be great as a user settabgle flag */
+ /* FIXME - This would be great as a user settabgle flag. */
if (monitor_debug_p || remote_debug
|| current_monitor->flags & MO_PRINT_PROGRAM_OUTPUT)
{
monitor_debug ("MON wait\n");
#if 0
- /* This is somthing other than a maintenance command */
+ /* This is somthing other than a maintenance command. */
in_monitor_wait = 1;
timeout = watchdog > 0 ? watchdog : -1;
#else
- timeout = -1; /* Don't time out -- user program is running. */
+ timeout = -1; /* Don't time out -- user program is running. */
#endif
ofunc = (void (*)()) signal (SIGINT, monitor_interrupt);
else
monitor_wait_filter (buf, sizeof (buf), &resp_len, status);
-#if 0 /* Transferred to monitor wait filter */
+#if 0 /* Transferred to monitor wait filter. */
do
{
resp_len = monitor_expect_prompt (buf, sizeof (buf));
while (resp_len < 0);
/* Print any output characters that were preceded by ^O. */
- /* FIXME - This would be great as a user settabgle flag */
+ /* FIXME - This would be great as a user settabgle flag. */
if (monitor_debug_p || remote_debug
|| current_monitor->flags & MO_PRINT_PROGRAM_OUTPUT)
{
return inferior_ptid;
}
-/* Fetch register REGNO, or all registers if REGNO is -1. Returns
+/* Fetch register REGNO, or all registers if REGNO is -1. Returns
errno value. */
static void
return;
}
- /* send the register examine command */
+ /* Send the register examine command. */
monitor_printf (current_monitor->getreg.cmd, name);
}
}
- /* Skip leading spaces and "0x" if MO_HEX_PREFIX flag is set */
+ /* Skip leading spaces and "0x" if MO_HEX_PREFIX flag is set. */
if (current_monitor->flags & MO_HEX_PREFIX)
{
int c;
regbuf[i] = c;
}
- regbuf[i] = '\000'; /* terminate the number */
+ regbuf[i] = '\000'; /* Terminate the number. */
monitor_debug ("REGVAL '%s'\n", regbuf);
/* If TERM is present, we wait for that to show up. Also, (if TERM
if (current_monitor->getreg.term)
{
monitor_debug ("EXP getreg.term\n");
- monitor_expect (current_monitor->getreg.term, NULL, 0); /* get
- response */
+ monitor_expect (current_monitor->getreg.term, NULL, 0); /* Get
+ response. */
}
if (current_monitor->getreg.term_cmd)
monitor_printf (current_monitor->getreg.term_cmd);
}
if (!current_monitor->getreg.term || /* Already expected or */
- current_monitor->getreg.term_cmd) /* ack expected */
- monitor_expect_prompt (NULL, 0); /* get response */
+ current_monitor->getreg.term_cmd) /* ack expected. */
+ monitor_expect_prompt (NULL, 0); /* Get response. */
monitor_supply_register (regcache, regno, regbuf);
}
-/* Sometimes, it takes several commands to dump the registers */
+/* Sometimes, it takes several commands to dump the registers. */
/* This is a primitive for use by variations of monitor interfaces in
- case they need to compose the operation.
- */
+ case they need to compose the operation. */
+
int
monitor_dump_reg_block (struct regcache *regcache, char *block_cmd)
{
/* Read the remote registers into the block regs. */
-/* Call the specific function if it has been provided */
+/* Call the specific function if it has been provided. */
static void
monitor_dump_regs (struct regcache *regcache)
int resp_len;
if (current_monitor->dumpregs)
- (*(current_monitor->dumpregs)) (regcache); /* call supplied function */
- else if (current_monitor->dump_registers) /* default version */
+ (*(current_monitor->dumpregs)) (regcache); /* Call supplied function. */
+ else if (current_monitor->dump_registers) /* Default version. */
{
monitor_printf (current_monitor->dump_registers);
resp_len = monitor_expect_prompt (buf, sizeof (buf));
parse_register_dump (regcache, buf, resp_len);
}
else
- /* Need some way to read registers */
+ /* Need some way to read registers. */
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
}
regcache_cooked_read_unsigned (regcache, regno, &val);
monitor_debug ("MON storeg %d %s\n", regno, phex (val, reg_size));
- /* send the register deposit command */
+ /* Send the register deposit command. */
if (current_monitor->flags & MO_REGISTER_VALUE_FIRST)
monitor_printf (current_monitor->setreg.cmd, val, name);
}
else
monitor_expect_prompt (NULL, 0);
- if (current_monitor->setreg.term_cmd) /* Mode exit required */
+ if (current_monitor->setreg.term_cmd) /* Mode exit required. */
{
monitor_debug ("EXP setreg_termcmd\n");
monitor_printf ("%s", current_monitor->setreg.term_cmd);
static void
monitor_prepare_to_store (struct regcache *regcache)
{
- /* Do nothing, since we can store individual regs */
+ /* Do nothing, since we can store individual regs. */
}
static void
if (myaddr[i] != 0)
break;
- if (i > 4) /* More than 4 zeros is worth doing */
+ if (i > 4) /* More than 4 zeros is worth doing. */
{
monitor_debug ("MON FILL %d\n", i);
if (current_monitor->flags & MO_FILL_USES_ADDR)
monitor_printf ("%x\r", val);
}
if (current_monitor->setmem.term_cmd)
- { /* Emit this to get out of the memory editing state */
+ { /* Emit this to get out of the memory editing state. */
monitor_printf ("%s", current_monitor->setmem.term_cmd);
- /* Drop through to expecting a prompt */
+ /* Drop through to expecting a prompt. */
}
}
else
if (len == 0)
return 0;
- /* Enter the sub mode */
+ /* Enter the sub mode. */
monitor_printf (current_monitor->setmem.cmdb, memaddr);
monitor_expect_prompt (NULL, 0);
while (len)
myaddr++;
memaddr++;
written++;
- /* If we wanted to, here we could validate the address */
+ /* If we wanted to, here we could validate the address. */
monitor_expect_prompt (NULL, 0);
len--;
}
- /* Now exit the sub mode */
+ /* Now exit the sub mode. */
monitor_printf (current_monitor->getreg.term_cmd);
monitor_expect_prompt (NULL, 0);
return written;
i++, j--;
}
}
-/* Format 32 chars of long long value, advance the pointer */
+/* Format 32 chars of long long value, advance the pointer. */
static char *hexlate = "0123456789abcdef";
static char *
longlong_hexchars (unsigned long long value,
dp = (unsigned long long *) scan;
*dp = value;
}
- longlongendswap (disbuf); /* FIXME: ONly on big endian hosts */
+ longlongendswap (disbuf); /* FIXME: ONly on big endian hosts. */
while (scan < limit)
{
- c = *scan++; /* a byte of our long long value */
+ c = *scan++; /* A byte of our long long value. */
if (leadzero)
{
if (c == 0)
continue;
else
- leadzero = 0; /* henceforth we print even zeroes */
+ leadzero = 0; /* Henceforth we print even zeroes. */
}
nib = c >> 4; /* high nibble bits */
*outbuff++ = hexlate[nib];
/* I am only going to call this when writing virtual byte streams.
- Which possably entails endian conversions
- */
+ Which possably entails endian conversions. */
+
static int
monitor_write_memory_longlongs (CORE_ADDR memaddr, char *myaddr, int len)
{
- static char hexstage[20]; /* At least 16 digits required, plus null */
+ static char hexstage[20]; /* At least 16 digits required, plus null. */
char *endstring;
long long *llptr;
long long value;
{
value = *llptr;
endstring = longlong_hexchars (*llptr, hexstage);
- *endstring = '\0'; /* NUll terminate for printf */
+ *endstring = '\0'; /* NUll terminate for printf. */
monitor_printf ("%s\r", hexstage);
llptr++;
memaddr += 8;
written += 8;
- /* If we wanted to, here we could validate the address */
+ /* If we wanted to, here we could validate the address. */
monitor_expect_prompt (NULL, 0);
len -= 8;
}
- /* Now exit the sub mode */
+ /* Now exit the sub mode. */
monitor_printf (current_monitor->getreg.term_cmd);
monitor_expect_prompt (NULL, 0);
return written;
MO_SETMEM_INTERACTIVE
! MO_NO_ECHO_ON_SETMEM
To use this, the you have to patch the monitor_cmds block with
- this function. Otherwise, its not tuned up for use by all
- monitor variations.
- */
+ this function. Otherwise, its not tuned up for use by all
+ monitor variations. */
static int
monitor_write_memory_block (CORE_ADDR memaddr, char *myaddr, int len)
int written;
written = 0;
- /* FIXME: This would be a good place to put the zero test */
+ /* FIXME: This would be a good place to put the zero test. */
#if 1
if ((len > 8) && (((len & 0x07)) == 0) && current_monitor->setmem.cmdll)
{
/* Now, read the appropriate number of hex digits for this loc,
skipping spaces. */
- /* Skip leading spaces and "0x" if MO_HEX_PREFIX flag is set. */
+ /* Skip leading spaces and "0x" if MO_HEX_PREFIX flag is set. */
if (current_monitor->flags & MO_HEX_PREFIX)
{
int c;
}
membuf[i] = c;
}
- membuf[i] = '\000'; /* terminate the number */
+ membuf[i] = '\000'; /* Terminate the number. */
}
/* If TERM is present, we wait for that to show up. Also, (if TERM is
if (current_monitor->getmem.term)
{
- monitor_expect (current_monitor->getmem.term, NULL, 0); /* get
- response */
+ monitor_expect (current_monitor->getmem.term, NULL, 0); /* Get
+ response. */
if (current_monitor->getmem.term_cmd)
{
}
}
else
- monitor_expect_prompt (NULL, 0); /* get response */
+ monitor_expect_prompt (NULL, 0); /* Get response. */
p = membuf;
val = strtoul (membuf, &p, 16);
"bad value from monitor",
memaddr, 0, membuf, 0);
- /* supply register stores in target byte order, so swap here */
+ /* supply register stores in target byte order, so swap here. */
store_unsigned_integer (myaddr, len, byte_order, val);
len = min (len, 16);
/* Some dumpers align the first data with the preceeding 16
- byte boundary. Some print blanks and start at the
- requested boundary. EXACT_DUMPADDR
- */
+ byte boundary. Some print blanks and start at the
+ requested boundary. EXACT_DUMPADDR */
dumpaddr = (current_monitor->flags & MO_EXACT_DUMPADDR)
? memaddr : memaddr & ~0x0f;
if (((memaddr ^ (memaddr + len - 1)) & ~0xf) != 0)
len = ((memaddr + len) & ~0xf) - memaddr;
- /* send the memory examine command */
+ /* Send the memory examine command. */
if (current_monitor->flags & MO_GETMEM_NEEDS_RANGE)
monitor_printf (current_monitor->getmem.cmdb, memaddr, memaddr + len);
if (current_monitor->getmem.term)
{
resp_len = monitor_expect (current_monitor->getmem.term,
- buf, sizeof buf); /* get response */
+ buf, sizeof buf); /* Get response. */
if (resp_len <= 0)
monitor_error ("monitor_read_memory",
}
}
else
- resp_len = monitor_expect_prompt (buf, sizeof buf); /* get response */
+ resp_len = monitor_expect_prompt (buf, sizeof buf); /* Get response. */
p = buf;
++dumpaddr;
++p;
}
- ++p; /* skip a blank or other non hex char */
+ ++p; /* Skip a blank or other non hex char. */
c = *p;
}
if (fetched == 0)
error (_("Failed to read via monitor"));
if (monitor_debug_p || remote_debug)
fprintf_unfiltered (gdb_stdlog, "\n");
- return fetched; /* Return the number of bytes actually read */
+ return fetched; /* Return the number of bytes actually
+ read. */
}
monitor_debug ("MON scanning bytes\n");
for (i = len; i > 0; i--)
{
- /* Skip non-hex chars, but bomb on end of string and newlines */
+ /* Skip non-hex chars, but bomb on end of string and newlines. */
while (1)
{
}
/* Transfer LEN bytes between target address MEMADDR and GDB address
- MYADDR. Returns 0 for success, errno code for failure. TARGET is
- unused. */
+ MYADDR. Returns 0 for success, errno code for failure. TARGET is
+ unused. */
static int
monitor_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
static void
monitor_kill (struct target_ops *ops)
{
- return; /* ignore attempts to kill target system */
+ return; /* Ignore attempts to kill target system. */
}
/* All we actually do is set the PC to the start address of exec_bfd. */
monitor_mourn_inferior (struct target_ops *ops)
{
unpush_target (targ_ops);
- generic_mourn_inferior (); /* Do all the proper things now */
+ generic_mourn_inferior (); /* Do all the proper things now. */
delete_thread_silent (monitor_ptid);
}
if (breakaddr[i] == addr)
{
breakaddr[i] = 0;
- /* some monitors remove breakpoints based on the address */
+ /* Some monitors remove breakpoints based on the address. */
if (current_monitor->flags & MO_CLR_BREAK_USES_ADDR)
monitor_printf (current_monitor->clr_break, addr);
else if (current_monitor->flags & MO_CLR_BREAK_1_BASED)
return 1;
}
-/* monitor_load -- download a file. */
+/* monitor_load -- download a file. */
static void
monitor_load (char *file, int from_tty)
if (current_monitor->load_routine)
current_monitor->load_routine (monitor_desc, file, hashmark);
else
- { /* The default is ascii S-records */
+ { /* The default is ascii S-records. */
int n;
unsigned long load_offset;
char buf[128];
- /* enable user to specify address for downloading as 2nd arg to load */
+ /* Enable user to specify address for downloading as 2nd arg to load. */
n = sscanf (file, "%s 0x%lx", buf, &load_offset);
if (n > 1)
file = buf;
monitor_expect_prompt (NULL, 0);
}
- /* Finally, make the PC point at the start address */
+ /* Finally, make the PC point at the start address. */
if (exec_bfd)
regcache_write_pc (get_current_regcache (),
bfd_get_start_address (exec_bfd));
}
/* Put a COMMAND string out to MONITOR. Output from MONITOR is placed
- in OUTPUT until the prompt is seen. FIXME: We read the characters
+ in OUTPUT until the prompt is seen. FIXME: We read the characters
ourseleves here cause of a nasty echo. */
static void
resp_len = monitor_expect_prompt (buf, sizeof buf);
- fputs_unfiltered (buf, outbuf); /* Output the response */
+ fputs_unfiltered (buf, outbuf); /* Output the response. */
}
/* Convert hex digit A to a number. */
monitor_ops.to_magic = OPS_MAGIC;
} /* init_base_monitor_ops */
-/* Init the target_ops structure pointed at by OPS */
+/* Init the target_ops structure pointed at by OPS. */
void
init_monitor_ops (struct target_ops *ops)
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, see <http://www.gnu.org/licenses/>.
- */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef MONITOR_H
#define MONITOR_H
struct monitor_ops
{
int flags; /* See below */
- char **init; /* List of init commands. NULL terminated. */
+ char **init; /* List of init commands. NULL terminated. */
char *cont; /* continue command */
char *step; /* single step */
char *stop; /* Interrupt program string */
- char *set_break; /* set a breakpoint. If NULL, monitor
+ char *set_break; /* set a breakpoint. If NULL, monitor
implementation sets its own
- to_insert_breakpoint method. */
+ to_insert_breakpoint method. */
char *clr_break; /* clear a breakpoint */
char *clr_all_break; /* Clear all breakpoints */
char *fill; /* Memory fill cmd (addr len val) */
};
/* The monitor ops magic number, used to detect if an ops structure doesn't
- have the right number of entries filled in. */
+ have the right number of entries filled in. */
#define MONITOR_OPS_MAGIC 600925
-/* Flag definitions. */
+/* Flag definitions. */
/* If set, then clear breakpoint command uses address, otherwise it
uses an index returned by the monitor. */
#define MO_CLR_BREAK_USES_ADDR 0x1
/* If set, then memory fill command uses STARTADDR, ENDADDR+1, VALUE
- as args, else it uses STARTADDR, LENGTH, VALUE as args. */
+ as args, else it uses STARTADDR, LENGTH, VALUE as args. */
#define MO_FILL_USES_ADDR 0x2
#define MO_NEED_REGDUMP_AFTER_CONT 0x4
-/* getmem needs start addr and end addr */
+/* getmem needs start addr and end addr. */
#define MO_GETMEM_NEEDS_RANGE 0x8
-/* getmem can only read one loc at a time */
+/* getmem can only read one loc at a time. */
#define MO_GETMEM_READ_SINGLE 0x10
-/* handle \r\n combinations */
+/* handle \r\n combinations. */
#define MO_HANDLE_NL 0x20
-/* don't expect echos in monitor_open */
+/* don't expect echos in monitor_open. */
#define MO_NO_ECHO_ON_OPEN 0x40
-/* If set, send break to stop monitor */
+/* If set, send break to stop monitor. */
#define MO_SEND_BREAK_ON_STOP 0x80
-/* If set, target sends an ACK after each S-record */
+/* If set, target sends an ACK after each S-record. */
#define MO_SREC_ACK 0x100
-/* Allow 0x prefix on addresses retured from monitor */
+/* Allow 0x prefix on addresses retured from monitor. */
#define MO_HEX_PREFIX 0x200
-/* Some monitors require a different command when starting a program */
+/* Some monitors require a different command when starting a program. */
#define MO_RUN_FIRST_TIME 0x400
#define MO_NO_ECHO_ON_SETMEM 0x800
-/* If set, then register store command expects value BEFORE regname */
+/* If set, then register store command expects value BEFORE regname. */
#define MO_REGISTER_VALUE_FIRST 0x1000
#define MO_PRINT_PROGRAM_OUTPUT 0x200000
/* Some dump bytes commands align the first data with the preceeding
- 16 byte boundary. Some print blanks and start at the exactly the
- requested boundary. */
+ 16 byte boundary. Some print blanks and start at the exactly the
+ requested boundary. */
#define MO_EXACT_DUMPADDR 0x400000
/* Rather entering and exiting the write memory dialog for each word byte,
we can save time by transferring the whole block without exiting
- the memory editing mode. You only need to worry about this
+ the memory editing mode. You only need to worry about this
if you are doing memory downloading.
- This engages a new write function registered with dcache.
- */
+ This engages a new write function registered with dcache. */
+
#define MO_HAS_BLOCKWRITES 0x800000
#define SREC_SIZE 160
/* Found a function. */
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
/* Don't use line number debug info for assembly source
- files. */
+ files. */
if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
{
sal = find_pc_line (func_addr, 0);
/* Parse the current instruction and record the values of the registers and
memory that will be changed in current instruction to "record_arch_list".
- Return -1 if something wrong. */
+ Return -1 if something wrong. */
int
moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
ptr = extract_unsigned_integer ((gdb_byte *) & ptr,
4, byte_order);
- /* String length is at 0x12($fp) */
+ /* String length is at 0x12($fp). */
regcache_raw_read (regcache,
MOXIE_FP_REGNUM, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
struct gdbarch_tdep
{
- /* gdbarch target dependent data here. Currently unused for MOXIE. */
+ /* gdbarch target dependent data here. Currently unused for MOXIE. */
};
enum moxie_regnum
instruction in the instruction set.
The BP for ms1 is defined as 0x68000000 (BREAK).
- The BP for ms2 is defined as 0x69000000 (illegal) */
+ The BP for ms2 is defined as 0x69000000 (illegal). */
static const gdb_byte *
mt_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
unsigned index, base;
gdb_byte copro[4];
- /* Get the copro pseudo regnum. */
+ /* Get the copro pseudo regnum. */
regcache_raw_read (regcache, MT_COPRO_REGNUM, copro);
base = ((extract_signed_integer (&copro[0], 2, byte_order)
* MT_COPRO_PSEUDOREG_DIM_2)
struct mt_unwind_cache
{
- /* The previous frame's inner most stack address.
+ /* The previous frame's inner most stack address.
Used as this frame ID's stack_addr. */
CORE_ADDR prev_sp;
CORE_ADDR frame_base;
info->frameless_p = 1;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
- /* Grab the frame-relative values of SP and FP, needed below.
+ /* Grab the frame-relative values of SP and FP, needed below.
The frame_saved_register function will find them on the
stack or in the registers as appropriate. */
sp = get_frame_register_unsigned (this_frame, MT_SP_REGNUM);
for (next_addr = start_addr; next_addr < end_addr; next_addr += 4)
{
instr = get_frame_memory_unsigned (this_frame, next_addr, 4);
- if (delayed_store) /* previous instr was a push */
+ if (delayed_store) /* Previous instr was a push. */
{
upper_half = delayed_store >> 16;
regnum = upper_half & 0xf;
offset = delayed_store & 0xffff;
switch (upper_half & 0xfff0)
{
- case 0x43c0: /* push using frame pointer */
+ case 0x43c0: /* push using frame pointer. */
info->saved_regs[regnum].addr = offset;
break;
- case 0x43d0: /* push using stack pointer */
+ case 0x43d0: /* push using stack pointer. */
info->saved_regs[regnum].addr = offset;
break;
default: /* lint */
case 0x12000000: /* NO-OP */
continue;
case 0x12ddc000: /* copy sp into fp */
- info->frameless_p = 0; /* Record that the frame pointer is in use. */
+ info->frameless_p = 0; /* Record that the frame
+ pointer is in use. */
continue;
default:
upper_half = instr >> 16;
keep scanning until we reach it (or we reach end_addr). */
if (prologue_end_addr && (prologue_end_addr > (next_addr + 4)))
- continue; /* Keep scanning, recording saved_regs etc. */
+ continue; /* Keep scanning, recording saved_regs etc. */
else
- break; /* Quit scanning: breakpoint can be set here. */
+ break; /* Quit scanning: breakpoint can be set here. */
}
}
set_gdbarch_unwind_pc (gdbarch, mt_unwind_pc);
set_gdbarch_unwind_sp (gdbarch, mt_unwind_sp);
- /* Methods for saving / extracting a dummy frame's ID.
+ /* Methods for saving / extracting a dummy frame's ID.
The ID's stack address must match the SP value returned by
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
set_gdbarch_dummy_id (gdbarch, mt_dummy_id);