* nto-procfs.c: Comment cleanup, mostly periods and spaces.
* nto-tdep.c: Ditto.
* nto-tdep.h: Ditto.
* objc-exp.y: Ditto.
* objc-lang.c: Ditto.
* objfiles.c: Ditto.
* objfiles.h: Ditto.
* observer.c: Ditto.
* opencl-lang.c: Ditto.
* osabi.c: Ditto.
* parse.c: Ditto.
* parser-defs.h: Ditto.
* p-exp.y: Ditto.
* p-lang.c: Ditto.
* posix-hdep.c: Ditto.
* ppcbug-rom.c: Ditto.
* ppc-linux-nat.c: Ditto.
* ppc-linux-tdep.c: Ditto.
* ppc-linux-tdep.h: Ditto.
* ppcnbsd-tdep.c: Ditto.
* ppcobsd-tdep.c: Ditto.
* ppcobsd-tdep.h: Ditto.
* ppc-sysv-tdep.c: Ditto.
* ppc-tdep.h: Ditto.
* printcmd.c: Ditto.
* proc-abi.c: Ditto.
* proc-flags.c: Ditto.
* procfs.c: Ditto.
* proc-utils.h: Ditto.
* progspace.h: Ditto.
* prologue-value.c: Ditto.
* prologue-value.h: Ditto.
* psympriv.h: Ditto.
* psymtab.c: Ditto.
* p-typeprint.c: Ditto.
* p-valprint.c: Ditto.
* ravenscar-sparc-thread.c: Ditto.
* ravenscar-thread.c: Ditto.
* ravenscar-thread.h: Ditto.
* record.c: Ditto.
* regcache.c: Ditto.
* regcache.h: Ditto.
* remote.c: Ditto.
* remote-fileio.c: Ditto.
* remote-fileio.h: Ditto.
* remote.h: Ditto.
* remote-m32r-sdi.c: Ditto.
* remote-mips.c: Ditto.
* remote-sim.c: Ditto.
* rs6000-aix-tdep.c: Ditto.
* rs6000-nat.c: Ditto.
* rs6000-tdep.c: Ditto.
+2011-01-10 Michael Snyder <msnyder@vmware.com>
+
+ * nto-procfs.c: Comment cleanup, mostly periods and spaces.
+ * nto-tdep.c: Ditto.
+ * nto-tdep.h: Ditto.
+ * objc-exp.y: Ditto.
+ * objc-lang.c: Ditto.
+ * objfiles.c: Ditto.
+ * objfiles.h: Ditto.
+ * observer.c: Ditto.
+ * opencl-lang.c: Ditto.
+ * osabi.c: Ditto.
+ * parse.c: Ditto.
+ * parser-defs.h: Ditto.
+ * p-exp.y: Ditto.
+ * p-lang.c: Ditto.
+ * posix-hdep.c: Ditto.
+ * ppcbug-rom.c: Ditto.
+ * ppc-linux-nat.c: Ditto.
+ * ppc-linux-tdep.c: Ditto.
+ * ppc-linux-tdep.h: Ditto.
+ * ppcnbsd-tdep.c: Ditto.
+ * ppcobsd-tdep.c: Ditto.
+ * ppcobsd-tdep.h: Ditto.
+ * ppc-sysv-tdep.c: Ditto.
+ * ppc-tdep.h: Ditto.
+ * printcmd.c: Ditto.
+ * proc-abi.c: Ditto.
+ * proc-flags.c: Ditto.
+ * procfs.c: Ditto.
+ * proc-utils.h: Ditto.
+ * progspace.h: Ditto.
+ * prologue-value.c: Ditto.
+ * prologue-value.h: Ditto.
+ * psympriv.h: Ditto.
+ * psymtab.c: Ditto.
+ * p-typeprint.c: Ditto.
+ * p-valprint.c: Ditto.
+ * ravenscar-sparc-thread.c: Ditto.
+ * ravenscar-thread.c: Ditto.
+ * ravenscar-thread.h: Ditto.
+ * record.c: Ditto.
+ * regcache.c: Ditto.
+ * regcache.h: Ditto.
+ * remote.c: Ditto.
+ * remote-fileio.c: Ditto.
+ * remote-fileio.h: Ditto.
+ * remote.h: Ditto.
+ * remote-m32r-sdi.c: Ditto.
+ * remote-mips.c: Ditto.
+ * remote-sim.c: Ditto.
+ * rs6000-aix-tdep.c: Ditto.
+ * rs6000-nat.c: Ditto.
+ * rs6000-tdep.c: Ditto.
+
2011-01-10 Joel Brobecker <brobecker@adacore.com>
* ada-valprint.c (printstr): Minor comment reformatting.
/* Machine independent support for QNX Neutrino /proc (process file system)
- for GDB. Written by Colin Burgess at QNX Software Systems Limited.
+ for GDB. Written by Colin Burgess at QNX Software Systems Limited.
Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
}
while (pid == 0);
- /* Open the procfs path. */
+ /* Open the procfs path. */
fd = open (buf, O_RDONLY);
if (fd == -1)
{
target_pid_to_str (inferior_ptid), nto_procfs_path);
}
-/* Mark our target-struct as eligible for stray "run" and "attach" commands. */
+/* Mark our target-struct as eligible for stray "run" and "attach"
+ commands. */
static int
procfs_can_run (void)
{
signal_to_pass, 0, 0);
run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG;
}
- else /* Let it kill the program without telling us. */
+ else /* Let it kill the program without telling us. */
sigdelset (&run.trace, signal_to_pass);
}
}
char *buf, *arch_path, *nto_root, *endian, *base;
const char *arch;
int ret;
-#define PATH_FMT "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
+#define PATH_FMT \
+ "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
nto_root = nto_target ();
if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "i386") == 0)
displayed. Different information is displayed\n\
for different positive values."),
NULL,
- NULL, /* FIXME: i18n: QNX NTO internal debugging is %s. */
+ NULL, /* FIXME: i18n: QNX NTO internal
+ debugging is %s. */
&setdebuglist, &showdebuglist);
}
regset, 0 if unknown register. */
int (*register_area) (struct gdbarch *, int, int, unsigned *);
-/* Build the Neutrino register set info into the data buffer.
+/* Build the Neutrino register set info into the data buffer.
Return -1 if unknown regset, 0 otherwise. */
int (*regset_fill) (const struct regcache *, int, char *);
OSTYPE_NTO
};
-/* These correspond to the DSMSG_* versions in dsmsgs.h. */
+/* These correspond to the DSMSG_* versions in dsmsgs.h. */
enum
{
NTO_REG_GENERAL,
%token <sval> STRING
%token <sval> NSSTRING /* ObjC Foundation "NSString" literal */
%token <sval> SELECTOR /* ObjC "@selector" pseudo-operator */
-%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
+%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
%token <tsym> TYPENAME
%token <class> CLASSNAME /* ObjC Class name */
%type <sval> name
exp : NAME_OR_INT
{ YYSTYPE val;
- parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val);
+ parse_number ($1.stoken.ptr,
+ $1.stoken.length, 0, &val);
write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (val.typed_val_int.type);
- write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
+ write_exp_elt_longcst ((LONGEST)
+ val.typed_val_int.val);
write_exp_elt_opcode (OP_LONG);
}
;
struct symtab *tem =
lookup_symtab (copy_name ($1.stoken));
if (tem)
- $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
+ $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem),
+ STATIC_BLOCK);
else
error ("No file or function \"%s\".",
copy_name ($1.stoken));
msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol != NULL)
write_exp_msymbol (msymbol);
- else if (!have_full_symbols () && !have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
+ else if (!have_full_symbols ()
+ && !have_partial_symbols ())
+ error ("No symbol table is loaded. "
+ "Use the \"file\" command.");
else
- error ("No symbol \"%s\" in current context.", name);
+ error ("No symbol \"%s\" in current context.",
+ name);
}
;
write_exp_msymbol (msymbol);
else if (!have_full_symbols () &&
!have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
+ error ("No symbol table is loaded. "
+ "Use the \"file\" command.");
else
error ("No symbol \"%s\" in current context.",
copy_name ($1.stoken));
if (long_p == 0
&& (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
+ high_bit
+ = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
/* A large decimal (not hex or octal) constant (between INT_MAX
and UINT_MAX) is a long or unsigned long, according to ANSI,
else if (long_p <= 1
&& (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
+ high_bit
+ = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
unsigned_type = parse_type->builtin_unsigned_long;
signed_type = parse_type->builtin_long;
}
hex = 1;
local_radix = 16;
}
- else if (tokchr == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
+ else if (tokchr == '0' && (p[1]=='t' || p[1]=='T'
+ || p[1]=='d' || p[1]=='D'))
{
p += 2;
hex = 0;
function = find_function_in_inferior("objc_lookup_class", NULL);
else
{
- complaint (&symfile_complaints, _("no way to lookup Objective-C classes"));
+ complaint (&symfile_complaints,
+ _("no way to lookup Objective-C classes"));
return 0;
}
function = find_function_in_inferior("sel_get_any_uid", NULL);
else
{
- complaint (&symfile_complaints, _("no way to lookup Objective-C selectors"));
+ complaint (&symfile_complaints,
+ _("no way to lookup Objective-C selectors"));
return 0;
}
selstring = value_coerce_array (value_string (selname,
- strlen (selname) + 1, char_type));
+ strlen (selname) + 1,
+ char_type));
return value_as_long (call_function_by_hand (function, 1, &selstring));
}
*cp++ = '+'; /* for class method */
*cp++ = '['; /* opening left brace */
- strcpy(cp, mangled+3); /* tack on the rest of the mangled name */
+ strcpy(cp, mangled+3); /* Tack on the rest of the mangled name. */
while (*cp && *cp == '_')
- cp++; /* skip any initial underbars in class name */
+ cp++; /* Skip any initial underbars in class
+ name. */
cp = strchr(cp, '_');
- if (!cp) /* find first non-initial underbar */
+ if (!cp) /* Find first non-initial underbar. */
{
xfree(demangled); /* not mangled name */
return NULL;
}
- if (cp[1] == '_') /* easy case: no category name */
+ if (cp[1] == '_') /* Easy case: no category name. */
{
- *cp++ = ' '; /* replace two '_' with one ' ' */
+ *cp++ = ' '; /* Replace two '_' with one ' '. */
strcpy(cp, mangled + (cp - demangled) + 2);
}
else
{
- *cp++ = '('; /* less easy case: category name */
+ *cp++ = '('; /* Less easy case: category name. */
cp = strchr(cp, '_');
if (!cp)
{
return NULL;
}
*cp++ = ')';
- *cp++ = ' '; /* overwriting 1st char of method name... */
- strcpy(cp, mangled + (cp - demangled)); /* get it back */
+ *cp++ = ' '; /* Overwriting 1st char of method name... */
+ strcpy(cp, mangled + (cp - demangled)); /* Get it back. */
}
while (*cp && *cp == '_')
- cp++; /* skip any initial underbars in method name */
+ cp++; /* Skip any initial underbars in
+ method name. */
for (; *cp; cp++)
if (*cp == '_')
- *cp = ':'; /* replace remaining '_' with ':' */
+ *cp = ':'; /* Replace remaining '_' with ':'. */
*cp++ = ']'; /* closing right brace */
*cp++ = 0; /* string terminator */
/* Determine if we are currently in the Objective-C dispatch function.
If so, get the address of the method function that the dispatcher
- would call and use that as the function to step into instead. Also
+ would call and use that as the function to step into instead. Also
skip over the trampoline for the function (if any). This is better
for the user since they are only interested in stepping into the
method function anyway. */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
basic_lookup_transparent_type,/* lookup_transparent_type */
objc_demangle, /* Language specific symbol demangler */
- NULL, /* Language specific class_name_from_physname */
+ NULL, /* Language specific
+ class_name_from_physname */
objc_op_print_tab, /* Expression operators for printing */
1, /* C-style arrays */
0, /* String lower bound */
/*
* ObjC:
- * Following functions help construct Objective-C message calls
+ * Following functions help construct Objective-C message calls.
*/
struct selname /* For parsing Objective-C. */
a++, b++;
}
if (*a && *a != ' ' && *a != ']')
- return 1; /* a is longer therefore greater */
+ return 1; /* a is longer therefore greater. */
if (*b && *b != ' ' && *b != ']')
- return -1; /* a is shorter therefore lesser */
- return 0; /* a and b are identical */
+ return -1; /* a is shorter therefore lesser. */
+ return 0; /* a and b are identical. */
}
/*
begin_line();
}
else
- printf_filtered (_("No selectors matching \"%s\"\n"), regexp ? regexp : "*");
+ printf_filtered (_("No selectors matching \"%s\"\n"),
+ regexp ? regexp : "*");
}
/*
* into two parts: debuggable (struct symbol) syms, and
* non_debuggable (struct minimal_symbol) syms. The debuggable
* ones will come first, before NUM_DEBUGGABLE (which will thus
- * be the index of the first non-debuggable one).
+ * be the index of the first non-debuggable one).
*/
/*
}
strcpy (tmp, symname);
- if (parse_method (tmp, &ntype, &nclass, &ncategory, &nselector) == NULL)
+ if (parse_method (tmp, &ntype, &nclass,
+ &ncategory, &nselector) == NULL)
continue;
objfile_csym++;
* with debug symbols from the first batch. Repeat until either the
* second section is out of debug symbols or the first section is
* full of debug symbols. Either way we have all debug symbols
- * packed to the beginning of the buffer.
+ * packed to the beginning of the buffer.
*/
if (syms != NULL)
/* The data structure 'methcalls' is used to detect method calls (thru
* ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.),
- * and ultimately find the method being called.
+ * and ultimately find the method being called.
*/
struct objc_methcall {
* structure "objc_msgs" by finding the addresses of each of the
* (currently four) functions that it holds (of which objc_msgSend is
* the first). This must be called each time symbols are loaded, in
- * case the functions have moved for some reason.
+ * case the functions have moved for some reason.
*/
static void
* returning the address of the shlib function that would be called.
* That functionality has been moved into the gdbarch_skip_trampoline_code and
* IN_SOLIB_TRAMPOLINE macros, which are resolved in the target-
- * dependent modules.
+ * dependent modules.
*/
struct objc_submethod_helper_data {
if (catch_errors (find_objc_msgcall_submethod_helper,
(void *) &s,
- "Unable to determine target of Objective-C method call (ignoring):\n",
+ "Unable to determine target of "
+ "Objective-C method call (ignoring):\n",
RETURN_MASK_ALL) == 0)
return 1;
else
return 0;
}
-extern initialize_file_ftype _initialize_objc_language; /* -Wmissing-prototypes */
+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_objc_language;
void
_initialize_objc_language (void)
class->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
class->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
class->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
- class->instance_size = read_memory_unsigned_integer (addr + 18, 4, byte_order);
+ class->instance_size = read_memory_unsigned_integer (addr + 18, 4,
+ byte_order);
class->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
class->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
class->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
if (meth_str.name == sel)
/* FIXME: hppa arch was doing a pointer dereference
- here. There needs to be a better way to do that. */
+ here. There needs to be a better way to do that. */
return meth_str.imp;
}
mlistnum++;
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This file contains support routines for creating, manipulating, and
- destroying objfile structures. */
+ destroying objfile structures. */
#include "defs.h"
#include "bfd.h" /* Binary File Description */
static void objfile_free_data (struct objfile *objfile);
/* Externally visible variables that are owned by this module.
- See declarations in objfile.h for more info. */
+ See declarations in objfile.h for more info. */
struct objfile *current_objfile; /* For symbol file being read in */
struct objfile *rt_common_objfile; /* For runtime common symbols */
/* Records whether any objfiles appeared or disappeared since we last updated
address to obj section map. */
-/* Locate all mappable sections of a BFD file.
+/* Locate all mappable sections of a BFD file.
objfile_p_char is a char * to get it through
bfd_map_over_sections; we cast it back to its proper type. */
/* Called via bfd_map_over_sections to build up the section table that
the objfile references. The objfile contains pointers to the start
of the table (objfile->sections) and to the first location after
- the end of the table (objfile->sections_end). */
+ the end of the table (objfile->sections_end). */
static void
add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
are initialized to zero.
Also note that if anything else writes to the psymbol obstack while
- we are building the table, we're pretty much hosed. */
+ we are building the table, we're pretty much hosed. */
int
build_objfile_section_table (struct objfile *objfile)
The FLAGS word contains various bits (OBJF_*) that can be taken as
requests for specific operations. Other bits like OBJF_SHARED are
- simply copied through to the new objfile flags member. */
+ simply copied through to the new objfile flags member. */
/* NOTE: carlton/2003-02-04: This function is called with args NULL, 0
by jv-lang.c, to create an artificial objfile used to hold
/* Update the per-objfile information that comes from the bfd, ensuring
that any data that is reference is saved in the per-objfile data
- region. */
+ region. */
objfile->obfd = gdb_bfd_ref (abfd);
if (abfd != NULL)
objfile->pspace = current_program_space;
/* Initialize the section indexes for this objfile, so that we can
- later detect if they are used w/o being properly assigned to. */
+ later detect if they are used w/o being properly assigned to. */
objfile->sect_index_text = -1;
objfile->sect_index_data = -1;
objfile->cp_namespace_symtab = NULL;
- /* Add this file onto the tail of the linked list of other such files. */
+ /* Add this file onto the tail of the linked list of other such files. */
objfile->next = NULL;
if (object_files == NULL)
last_one->next = objfile;
}
- /* Save passed in flag bits. */
+ /* Save passed in flag bits. */
objfile->flags |= flags;
/* Rebuild section map next time we need it. */
return objfile->gdbarch;
}
-/* Initialize entry point information for this objfile. */
+/* Initialize entry point information for this objfile. */
void
init_entry_point_info (struct objfile *objfile)
/* Put one object file before a specified on in the global list.
This can be used to make sure an object file is destroyed before
- another when using ALL_OBJFILES_SAFE to free all objfiles. */
+ another when using ALL_OBJFILES_SAFE to free all objfiles. */
void
put_objfile_before (struct objfile *objfile, struct objfile *before_this)
{
If OBJFILE turns out to be in the list, we zap it's NEXT pointer after
unlinking it, just to ensure that we have completely severed any linkages
- between the OBJFILE and the list. */
+ between the OBJFILE and the list. */
void
unlink_objfile (struct objfile *objfile)
parent->separate_debug_objfile = objfile;
/* Put the separate debug object before the normal one, this is so that
- usage of the ALL_OBJFILES_SAFE macro will stay safe. */
+ usage of the ALL_OBJFILES_SAFE macro will stay safe. */
put_objfile_before (objfile, parent);
}
may be using the symbol information at the same time (when mmalloc is
extended to support cooperative locking). When more than one process
is using the mapped symbol info, we need to be more careful about when
- we free objects in the reusable area. */
+ we free objects in the reusable area. */
void
free_objfile (struct objfile *objfile)
is using reusable symbol information (via mmalloc) then each of
these routines is responsible for doing the correct thing, either
freeing things which are valid only during this particular gdb
- execution, or leaving them to be reused during the next one. */
+ execution, or leaving them to be reused during the next one. */
if (objfile->sf != NULL)
{
gdb_bfd_unref (objfile->obfd);
- /* Remove it from the chain of all objfiles. */
+ /* Remove it from the chain of all objfiles. */
unlink_objfile (objfile);
linkage unit, gdb used to do these things whenever the monolithic
symbol table was blown away. How much still needs to be done
is unknown, but we play it safe for now and keep each action until
- it is shown to be no longer needed. */
+ it is shown to be no longer needed. */
/* Not all our callers call clear_symtab_users (objfile_purge_solibs,
for example), so we need to call this here. */
innermost_block = NULL;
/* Check to see if the current_source_symtab belongs to this objfile,
- and if so, call clear_current_source_symtab_and_line. */
+ and if so, call clear_current_source_symtab_and_line. */
{
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
}
}
- /* The last thing we do is free the objfile struct itself. */
+ /* The last thing we do is free the objfile struct itself. */
xfree (objfile->name);
if (objfile->global_psymbols.list)
xfree (objfile->global_psymbols.list);
if (objfile->static_psymbols.list)
xfree (objfile->static_psymbols.list);
- /* Free the obstacks for non-reusable objfiles */
+ /* Free the obstacks for non-reusable objfiles. */
psymbol_bcache_free (objfile->psymbol_cache);
bcache_xfree (objfile->macro_cache);
bcache_xfree (objfile->filename_cache);
do_cleanups (my_cleanups);
}
- /* Relocate breakpoints as necessary, after things are relocated. */
+ /* Relocate breakpoints as necessary, after things are relocated. */
if (changed)
breakpoint_re_set ();
}
/* Many places in gdb want to test just to see if we have any partial
symbols available. This function returns zero if none are currently
- available, nonzero otherwise. */
+ available, nonzero otherwise. */
int
have_partial_symbols (void)
/* Many places in gdb want to test just to see if we have any full
symbols available. This function returns zero if none are currently
- available, nonzero otherwise. */
+ available, nonzero otherwise. */
int
have_full_symbols (void)
/* This operations deletes all objfile entries that represent solibs that
weren't explicitly loaded by the user, via e.g., the add-symbol-file
- command.
- */
+ command. */
+
void
objfile_purge_solibs (void)
{
ALL_OBJFILES_SAFE (objf, temp)
{
/* We assume that the solib package has been purged already, or will
- be soon.
- */
+ be soon. */
+
if (!(objf->flags & OBJF_USERLOADED) && (objf->flags & OBJF_SHARED))
free_objfile (objf);
}
/* Many places in gdb want to test just to see if we have any minimal
symbols available. This function returns zero if none are currently
- available, nonzero otherwise. */
+ available, nonzero otherwise. */
int
have_minimal_symbols (void)
/* Sections are at the same address. This could happen if
A) we have an objfile and a separate debuginfo.
B) we are confused, and have added sections without proper relocation,
- or something like that. */
+ or something like that. */
const struct objfile *const objfile1 = sect1->objfile;
const struct objfile *const objfile2 = sect2->objfile;
*pmap_size = map_size;
}
-/* Bsearch comparison function. */
+/* Bsearch comparison function. */
static int
bsearch_cmp (const void *key, const void *elt)
#define OBJFILES_H
#include "gdb_obstack.h" /* For obstack internals. */
-#include "symfile.h" /* For struct psymbol_allocation_list */
+#include "symfile.h" /* For struct psymbol_allocation_list. */
#include "progspace.h"
struct bcache;
the debugging information, where these values are the starting
address (inclusive) and ending address (exclusive) of the
instruction space in the executable which correspond to the
- "startup file", I.E. crt0.o in most cases. This file is assumed to
+ "startup file", i.e. crt0.o in most cases. This file is assumed to
be a startup file and frames with pc's inside it are treated as
nonexistent. Setting these variables is necessary so that
backtraces do not fly off the bottom of the stack.
NOTE: cagney/2003-09-09: It turns out that this "traditional"
method doesn't work. Corinna writes: ``It turns out that the call
to test for "inside entry file" destroys a meaningful backtrace
- under some conditions. E. g. the backtrace tests in the asm-source
+ under some conditions. E.g. the backtrace tests in the asm-source
testcase are broken for some targets. In this test the functions
are all implemented as part of one file and the testcase is not
necessarily linked with a start file (depending on the target).
/* Objfile this section is part of. */
struct objfile *objfile;
- /* True if this "overlay section" is mapped into an "overlay region". */
+ /* True if this "overlay section" is mapped into an "overlay region". */
int ovly_mapped;
};
/* The "objstats" structure provides a place for gdb to record some
interesting information about its internal state at runtime, on a
per objfile basis, such as information about the number of symbols
- read, size of string table (if any), etc. */
+ read, size of string table (if any), etc. */
struct objstats
{
struct list {struct list *next; struct objfile *objfile};
where the list structure is completely maintained separately within
- each gdb process. */
+ each gdb process. */
struct objfile *next;
char *name;
- /* Some flag bits for this objfile. */
+ /* Some flag bits for this objfile. */
unsigned short flags;
/* Each objfile points to a linked list of symtabs derived from this file,
one symtab structure for each compilation unit (source file). Each link
- in the symtab list contains a backpointer to this objfile. */
+ in the symtab list contains a backpointer to this objfile. */
struct symtab *symtabs;
/* Each objfile points to a linked list of partial symtabs derived from
this file, one partial symtab structure for each compilation unit
- (source file). */
+ (source file). */
struct partial_symtab *psymtabs;
struct addrmap *psymtabs_addrmap;
- /* List of freed partial symtabs, available for re-use */
+ /* List of freed partial symtabs, available for re-use. */
struct partial_symtab *free_psymtabs;
long mtime;
/* Obstack to hold objects that should be freed when we load a new symbol
- table from this object file. */
+ table from this object file. */
struct obstack objfile_obstack;
/* A byte cache where we can stash arbitrary "chunks" of bytes that
- will not change. */
+ will not change. */
- struct psymbol_bcache *psymbol_cache; /* Byte cache for partial syms */
- struct bcache *macro_cache; /* Byte cache for macros */
- struct bcache *filename_cache; /* Byte cache for file names. */
+ struct psymbol_bcache *psymbol_cache; /* Byte cache for partial syms. */
+ struct bcache *macro_cache; /* Byte cache for macros. */
+ struct bcache *filename_cache; /* Byte cache for file names. */
/* Hash table for mapping symbol names to demangled names. Each
entry in the hash table is actually two consecutive strings,
struct htab *demangled_names_hash;
/* Vectors of all partial symbols read in from file. The actual data
- is stored in the objfile_obstack. */
+ is stored in the objfile_obstack. */
struct psymbol_allocation_list global_psymbols;
struct psymbol_allocation_list static_psymbols;
of it. There is also a count of the number of symbols, which does
not include the terminating null symbol. The array itself, as well
as all the data that it points to, should be allocated on the
- objfile_obstack for this file. */
+ objfile_obstack for this file. */
struct minimal_symbol *msymbols;
int minimal_symbol_count;
struct minimal_symbol *msymbol_demangled_hash[MINIMAL_SYMBOL_HASH_SIZE];
/* Structure which keeps track of functions that manipulate objfile's
- of the same type as this objfile. I.E. the function to read partial
+ of the same type as this objfile. I.e. the function to read partial
symbols for example. Note that this structure is in statically
allocated memory, and is shared by all objfiles that use the
- object module reader of this type. */
+ object module reader of this type. */
const struct sym_fns *sf;
/* The per-objfile information about the entry point, the scope (file/func)
- containing the entry point, and the scope of the user's main() func. */
+ containing the entry point, and the scope of the user's main() func. */
struct entry_info ei;
/* Information about stabs. Will be filled in with a dbx_symfile_info
- struct by those readers that need it. */
+ struct by those readers that need it. */
/* NOTE: cagney/2004-10-23: This has been replaced by per-objfile
data points implemented using "data" and "num_data" below. For
an example of how to use this replacement, see "objfile_data"
struct section_offsets *section_offsets;
int num_sections;
- /* Indexes in the section_offsets array. These are initialized by the
+ /* Indexes in the section_offsets array. These are initialized by the
*_symfile_offsets() family of functions (som_symfile_offsets,
- xcoff_symfile_offsets, default_symfile_offsets). In theory they
+ xcoff_symfile_offsets, default_symfile_offsets). In theory they
should correspond to the section indexes used by bfd for the
- current objfile. The exception to this for the time being is the
- SOM version. */
+ current objfile. The exception to this for the time being is the
+ SOM version. */
int sect_index_text;
int sect_index_data;
struct objfile *separate_debug_objfile;
/* If this is a separate debug object, this is used as a link to the
- actual executable objfile. */
+ actual executable objfile. */
struct objfile *separate_debug_objfile_backlink;
/* If this is a separate debug object, this is a link to the next one
for the same executable objfile. */
struct objfile *separate_debug_objfile_link;
- /* Place to stash various statistics about this objfile */
+ /* Place to stash various statistics about this objfile. */
OBJSTATS;
/* A symtab that the C++ code uses to stash special symbols
struct symbol *template_symbols;
};
-/* Defines for the objfile flag word. */
+/* Defines for the objfile flag word. */
/* When an object file has its functions reordered (currently Irix-5.2
shared libraries exhibit this behaviour), we will need an expensive
#define OBJF_REORDERED (1 << 0) /* Functions are reordered */
/* Distinguish between an objfile for a shared library and a "vanilla"
- objfile. (If not set, the objfile may still actually be a solib.
+ objfile. (If not set, the objfile may still actually be a solib.
This can happen if the user created the objfile by using the
add-symbol-file command. GDB doesn't in that situation actually
check whether the file is a solib. Rather, the target's
#define OBJF_SHARED (1 << 1) /* From a shared library */
-/* User requested that this objfile be read in it's entirety. */
+/* User requested that this objfile be read in it's entirety. */
#define OBJF_READNOW (1 << 2) /* Immediate full read */
for run_command to remove old objfile entries which are no longer
valid (i.e., are associated with an old inferior), but to preserve
ones that the user explicitly loaded via the add-symbol-file
- command. */
+ command. */
#define OBJF_USERLOADED (1 << 3) /* User loaded */
/* The object file that contains the runtime common minimal symbols
- for SunOS4. Note that this objfile has no associated BFD. */
+ for SunOS4. Note that this objfile has no associated BFD. */
extern struct objfile *rt_common_objfile;
objfile, and when we are done, we set it back to NULL, to ensure that we
never put a type someplace other than where we are expecting to put it.
FIXME: Maybe we should review the entire type handling system and
- see if there is a better way to avoid this problem. */
+ see if there is a better way to avoid this problem. */
extern struct objfile *current_objfile;
/* This operation deletes all objfile entries that represent solibs that
weren't explicitly loaded by the user, via e.g., the add-symbol-file
- command.
- */
+ command. */
+
extern void objfile_purge_solibs (void);
/* Functions for dealing with the minimal symbol table, really a misc
loop's loop expression, advance OBJFILE, but iff the inner loop
reached its end. If not, there was a "break;", so leave OBJFILE
as is; the outer loop's conditional will break immediately as
- well (as OSECT will be different from OBJFILE->sections_end).
-*/
+ well (as OSECT will be different from OBJFILE->sections_end). */
#define ALL_OBJSECTIONS(objfile, osect) \
for ((objfile) = current_program_space->objfiles, \
: objfile->sect_index_text)
/* Sometimes the .bss section is missing from the objfile, so we don't
- want to die here. Let the users of SECT_OFF_BSS deal with an
- uninitialized section index. */
+ want to die here. Let the users of SECT_OFF_BSS deal with an
+ uninitialized section index. */
#define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss
/* Answer whether there is more than one object file loaded. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* An observer is an entity who is interested in being notified when GDB
- reaches certain states, or certain events occur in GDB. The entity being
- observed is called the Subject. To receive notifications, the observer
- attaches a callback to the subject. One subject can have several
+ reaches certain states, or certain events occur in GDB. The entity being
+ observed is called the Subject. To receive notifications, the observer
+ attaches a callback to the subject. One subject can have several
observers.
This file implements an internal generic low-level event notification
for all possible notifications.
The current implementation of the generic observer provides support
- for contextual data. This contextual data is given to the subject
- when attaching the callback. In return, the subject will provide
+ for contextual data. This contextual data is given to the subject
+ when attaching the callback. In return, the subject will provide
this contextual data back to the observer as a parameter of the
callback.
FIXME: The current support for the contextual data is only partial,
as it lacks a mechanism that would deallocate this data when the
- callback is detached. This is not a problem so far, as this contextual
- data is only used internally to hold a function pointer. Later on,
+ callback is detached. This is not a problem so far, as this contextual
+ data is only used internally to hold a function pointer. Later on,
if a certain observer needs to provide support for user-level
contextual data, then the generic notification mechanism will need
need to be enhanced to allow the observer to provide a routine to
Therefore we evaluate it once using EVAL_AVOID_SIDE_EFFECTS. */
int oldpos = *pos;
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
+ EVAL_AVOID_SIDE_EFFECTS);
*pos = oldpos;
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
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 */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
}
\f
-/* Sniffer to find the OS ABI for a given file's architecture and flavour.
+/* Sniffer to find the OS ABI for a given file's architecture and flavour.
It is legal to have multiple sniffers for each arch/flavour pair, to
disambiguate one OS's a.out from another, for example. The first sniffer
to return something other than GDB_OSABI_UNKNOWN wins, so a sniffer should
- there are some problems with boolean types.
- Pascal type hexadecimal constants are not supported
because they conflict with the internal variables format.
- Probably also lots of other problems, less well defined PM */
+ Probably also lots of other problems, less well defined PM. */
%{
#include "defs.h"
#include "p-lang.h"
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */
#include "block.h"
#define parse_type builtin_type (parse_gdbarch)
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 pascal_maxdepth
#define yyparse pascal_parse
%token <sval> STRING
%token <sval> FIELDNAME
-%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
+%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
%token <tsym> TYPENAME
%type <sval> name
%type <ssym> name_not_typename
current_type, $4.ptr, 0); };
} ;
exp : exp '['
- /* We need to save the current_type value */
+ /* We need to save the current_type value. */
{ char *arrayname;
int arrayfieldindex;
arrayfieldindex = is_pascal_string_type (
exp : NAME_OR_INT
{ YYSTYPE val;
- parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val);
+ parse_number ($1.stoken.ptr,
+ $1.stoken.length, 0, &val);
write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (val.typed_val_int.type);
current_type = val.typed_val_int.type;
- write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
+ write_exp_elt_longcst ((LONGEST)
+ val.typed_val_int.val);
write_exp_elt_opcode (OP_LONG);
}
;
;
exp : VARIABLE
- /* Already written by write_dollar_variable. */
+ /* Already written by write_dollar_variable. */
;
exp : SIZEOF '(' type ')' %prec UNARY
an explicit null byte added at the end. Thus
the array upper bound is the string length.
There is no such thing in C as a completely empty
- string. */
+ string. */
char *sp = $1.ptr; int count = $1.length;
while (count-- > 0)
{
struct type * this_type;
write_exp_elt_opcode (OP_THIS);
write_exp_elt_opcode (OP_THIS);
- /* we need type of this */
+ /* We need type of this. */
this_val = value_of_this (0);
if (this_val)
this_type = value_type (this_val);
struct symtab *tem =
lookup_symtab (copy_name ($1.stoken));
if (tem)
- $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
+ $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem),
+ STATIC_BLOCK);
else
error ("No file or function \"%s\".",
copy_name ($1.stoken));
msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol != NULL)
write_exp_msymbol (msymbol);
- else if (!have_full_symbols () && !have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
+ else if (!have_full_symbols ()
+ && !have_partial_symbols ())
+ error ("No symbol table is loaded. "
+ "Use the \"file\" command.");
else
- error ("No symbol \"%s\" in current context.", name);
+ error ("No symbol \"%s\" in current context.",
+ name);
}
;
write_exp_elt_opcode (STRUCTOP_PTR);
write_exp_string ($1.stoken);
write_exp_elt_opcode (STRUCTOP_PTR);
- /* we need type of this */
+ /* We need type of this. */
this_val = value_of_this (0);
if (this_val)
this_type = value_type (this_val);
lookup_minimal_symbol (arg, NULL, NULL);
if (msymbol != NULL)
write_exp_msymbol (msymbol);
- else if (!have_full_symbols () && !have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
+ else if (!have_full_symbols ()
+ && !have_partial_symbols ())
+ error ("No symbol table is loaded. "
+ "Use the \"file\" command.");
else
error ("No symbol \"%s\" in current context.",
copy_name ($1.stoken));
return FLOAT;
}
- /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
+ /* Handle base-switching prefixes 0x, 0t, 0d, 0. */
if (p[0] == '0')
switch (p[1])
{
return ERROR; /* Char not a digit */
}
if (i >= base)
- return ERROR; /* Invalid digit in this base */
+ return ERROR; /* Invalid digit in this base. */
/* Portably test for overflow (only works for nonzero values, so make
a second check for zero). FIXME: Can't we just make n and prevn
unsigned and avoid this? */
if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
- unsigned_p = 1; /* Try something unsigned */
+ unsigned_p = 1; /* Try something unsigned. */
/* Portably test for unsigned overflow.
FIXME: This check is wrong; for example it doesn't find overflow
putithere->typed_val_int.val = n;
/* If the high bit of the worked out type is set then this number
- has to be unsigned. */
+ has to be unsigned. */
if (unsigned_p || (n & high_bit))
{
{":=", ASSIGN, BINOP_END},
{"::", COLONCOLON, BINOP_END} };
-/* Allocate uppercased var */
-/* make an uppercased copy of tokstart */
+/* Allocate uppercased var: */
+/* make an uppercased copy of tokstart. */
static char * uptok (tokstart, namelen)
char *tokstart;
int namelen;
for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
&& (!isalpha (tokentab3[i].operator[0]) || explen == 3
- || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
+ || (!isalpha (tokstart[3])
+ && !isdigit (tokstart[3]) && tokstart[3] != '_')))
{
lexptr += 3;
yylval.opcode = tokentab3[i].opcode;
for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
&& (!isalpha (tokentab2[i].operator[0]) || explen == 2
- || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
+ || (!isalpha (tokstart[2])
+ && !isdigit (tokstart[2]) && tokstart[2] != '_')))
{
lexptr += 2;
yylval.opcode = tokentab2[i].opcode;
case '\'':
/* We either have a character constant ('0' or '\177' for example)
or we have a quoted symbol reference ('foo(int,int)' in object pascal
- for example). */
+ for example). */
lexptr++;
c = *lexptr++;
if (c == '\\')
case '.':
/* Might be a floating point number. */
if (lexptr[1] < '0' || lexptr[1] > '9')
- goto symbol; /* Nope, must be a symbol. */
+ goto symbol; /* Nope, must be a symbol. */
/* FALL THRU into number case. */
case '0':
p += 2;
hex = 1;
}
- else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
+ else if (c == '0' && (p[1]=='t' || p[1]=='T'
+ || p[1]=='d' || p[1]=='D'))
{
p += 2;
hex = 0;
&& (*p < 'A' || *p > 'Z')))
break;
}
- toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
+ toktype = parse_number (tokstart,
+ p - tokstart, got_dot | got_e, &yylval);
if (toktype == ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
the buffer contains no embedded nulls. Gdb does not depend
upon the buffer being null byte terminated, it uses the length
string instead. This allows gdb to handle C strings (as well
- as strings in other languages) with embedded null bytes */
+ as strings in other languages) with embedded null bytes. */
tokptr = ++tokstart;
tempbufindex = 0;
do {
/* Grow the static temp buffer if necessary, including allocating
- the first one on demand. */
+ the first one on demand. */
if (tempbufindex + 1 >= tempbufsize)
{
tempbuf = (char *) realloc (tempbuf, tempbufsize += 64);
{
case '\0':
case '"':
- /* Do nothing, loop will terminate. */
+ /* Do nothing, loop will terminate. */
break;
case '\\':
tokptr++;
{
error ("Unterminated string in expression.");
}
- tempbuf[tempbufindex] = '\0'; /* See note above */
+ tempbuf[tempbufindex] = '\0'; /* See note above. */
yylval.sval.ptr = tempbuf;
yylval.sval.length = tempbufindex;
lexptr = tokptr;
break;
}
- /* do NOT uppercase internals because of registers !!! */
+ /* do NOT uppercase internals because of registers !!! */
c = tokstart[++namelen];
}
}
if (strcmp (uptokstart, "SELF") == 0)
{
- /* here we search for 'this' like
- inserted in FPC stabs debug info */
+ /* Here we search for 'this' like
+ inserted in FPC stabs debug info. */
static const char this_name[] = "this";
if (lookup_symbol (this_name, expression_context_block,
if (search_field && current_type)
- is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
+ is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
if (is_a_field)
sym = NULL;
else
tmp[i] -= ('a'-'A');
}
if (search_field && current_type)
- is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
+ is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
if (is_a_field)
sym = NULL;
else
tmp[i] -= ('A'-'a');
}
if (search_field && current_type)
- is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
+ is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
if (is_a_field)
sym = NULL;
else
}
free(uptokstart);
- /* Any other kind of symbol */
+ /* Any other kind of symbol. */
yylval.ssym.sym = sym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
return NAME;
/* All GPC versions until now (2007-09-27) also define a symbol called
- '_p_initialize'. Check for the presence of this symbol first. */
+ '_p_initialize'. Check for the presence of this symbol first. */
static const char GPC_P_INITIALIZE[] = "_p_initialize";
/* The name of the symbol that GPC uses as the name of the main
so that it finds the even if the program was compiled
without debugging information.
According to information supplied by Waldeck Hebisch,
- this should work for all versions posterior to June 2000. */
+ this should work for all versions posterior to June 2000. */
const char *
pascal_main_name (void)
*length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 1));
if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
- /* FIXME: how can I detect wide chars in GPC ?? */
+ /* FIXME: how can I detect wide chars in GPC ?? */
if (char_type)
{
*char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 2));
/* Print the character C on STREAM as part of the contents of a literal
string.
- In_quotes is reset to 0 if a char is written with #4 notation */
+ In_quotes is reset to 0 if a char is written with #4 notation. */
static void
pascal_one_char (int c, struct ui_file *stream, int *in_quotes)
/* Print the character C on STREAM as part of the contents of a literal
string whose delimiter is QUOTER. Note that that format for printing
- characters and strings is language specific. */
+ characters and strings is language specific. */
static void
pascal_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
pascal_type_print_base (type, stream, show, level);
/* For demangled function names, we have the arglist as part of the name,
- so don't print an additional pair of ()'s */
+ so don't print an additional pair of ()'s. */
demangled_args = varstring ? strchr (varstring, '(') != NULL : 0;
pascal_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
/* If TYPE is a derived type, then print out derivation information.
Print only the actual base classes of this type, not the base classes
- of the base classes. I.E. for the derivation hierarchy:
+ of the base classes. I.e. for the derivation hierarchy:
class A { int a; };
class B : public A {int b; };
}
In general, gdb should try to print the types as closely as possible to
- the form that they appear in the source code. */
+ the form that they appear in the source code. */
static void
pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
if (physname && (*physname != 0))
{
fputs_filtered (" (", stream);
- /* we must demangle this */
+ /* We must demangle this. */
while (isdigit (physname[0]))
{
int len = 0;
case TYPE_CODE_PTR:
fprintf_filtered (stream, "^");
pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
- break; /* pointer should be handled normally
- in pascal */
+ break; /* Pointer should be handled normally
+ in pascal. */
case TYPE_CODE_METHOD:
if (passed_a_ptr)
fputs_filtered (", ", stream);
wrap_here (" ");
}
- /* can we find if it is a var parameter ??
+ /* Can we find if it is a var parameter ??
if ( TYPE_FIELD(type, i) == )
{
fprintf_filtered (stream, "var ");
case TYPE_CODE_METHOD:
/*
pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
- only after args !! */
+ only after args !! */
break;
case TYPE_CODE_STRUCT:
if (TYPE_TAG_NAME (type) != NULL)
/* Start off with no specific section type, so we can print
one for the first field we find, and use that section type
- thereafter until we find another type. */
+ thereafter until we find another type. */
section_type = s_none;
continue;
/* If this is a pascal object or class we can print the
- various section labels. */
+ various section labels. */
if (HAVE_CPLUS_STRUCT (type))
{
fprintf_filtered (stream, ";\n");
}
- /* If there are both fields and methods, put a space between. */
+ /* If there are both fields and methods, put a space between. */
len = TYPE_NFN_FIELDS (type);
if (len && section_type != s_none)
fprintf_filtered (stream, "\n");
- /* Pbject pascal: print out the methods */
+ /* Object pascal: print out the methods. */
for (i = 0; i < len; i++)
{
/* this is GNU C++ specific
how can we know constructor/destructor?
- It might work for GNU pascal */
+ It might work for GNU pascal. */
for (j = 0; j < len2; j++)
{
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
{
fprintf_filtered (stream, "procedure ");
}
- /* this does not work, no idea why !! */
+ /* This does not work, no idea why !! */
pascal_type_print_method_args (physname,
method_name,
fputs_filtered (" ", stream);
}
/* enum is just defined by
- type enume_name = (enum_member1,enum_member2,...) */
+ type enume_name = (enum_member1,enum_member2,...) */
fprintf_filtered (stream, " = ");
wrap_here (" ");
if (show < 0)
fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
break;
- /* this probably does not work for enums */
+ /* this probably does not work for enums. */
case TYPE_CODE_RANGE:
{
struct type *target = TYPE_TARGET_TYPE (type);
/* Handle types not explicitly handled by the other cases,
such as fundamental types. For these, just print whatever
the type name is, as recorded in the type itself. If there
- is no type name, then complain. */
+ is no type name, then complain. */
if (TYPE_NAME (type) != NULL)
{
fputs_filtered (TYPE_NAME (type), stream);
{
unsigned int temp_len;
- /* Look for a NULL char. */
+ /* Look for a NULL char. */
for (temp_len = 0;
extract_unsigned_integer (valaddr + embedded_offset +
temp_len * eltlen, eltlen,
{
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if we ARE using
- -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
+ -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
/* Extract the address, assume that it is unsigned. */
addr = extract_unsigned_integer (valaddr + embedded_offset,
TYPE_LENGTH (type), byte_order);
&& (options->format == 0 || options->format == 's')
&& addr != 0)
{
- /* no wide string yet */
+ /* No wide string yet. */
i = val_print_string (elttype, NULL, addr, -1, stream, options);
}
- /* also for pointers to pascal strings */
+ /* Also for pointers to pascal strings. */
/* Note: this is Free Pascal specific:
as GDB does not recognize stabs pascal strings
Pascal strings are mapped to records
- with lowercase names PM */
+ with lowercase names PM. */
if (is_pascal_string_type (elttype, &length_pos, &length_size,
&string_pos, &char_type, NULL)
&& addr != 0)
}
else if (pascal_object_is_vtbl_member (type))
{
- /* print vtbl's nicely */
+ /* Print vtbl's nicely. */
CORE_ADDR vt_address = unpack_pointer (type,
valaddr + embedded_offset);
struct minimal_symbol *msymbol =
{
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if NOT using
- -fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
+ -fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
/* Extract the address, assume that it is unsigned. */
print_address_demangle
(gdbarch,
|| TYPE_CODE (type) == TYPE_CODE_REF)
{
/* Hack: remove (char *) for char strings. Their
- type is indicated by the quoted string anyway. */
+ type is indicated by the quoted string anyway. */
if (TYPE_CODE (type) == TYPE_CODE_PTR
&& TYPE_NAME (type) == NULL
&& TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
&& strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
{
- /* Print nothing */
+ /* Print nothing. */
}
else
{
if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
{
type = TYPE_TARGET_TYPE (type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* if not using
- thunks */
- || TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* If not using
+ thunks. */
+ || TYPE_CODE (type) == TYPE_CODE_PTR) /* If using thunks. */
{
/* Virtual functions tables are full of pointers
- to virtual functions. */
+ to virtual functions. */
return pascal_object_is_vtbl_ptr_type (type);
}
}
else if (field_is_static (&TYPE_FIELD (type, i)))
{
/* struct value *v = value_static_field (type, i);
- v4.17 specific */
+ v4.17 specific. */
struct value *v;
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
fputs_filtered ("> = ", stream);
/* The virtual base class pointer might have been clobbered by the
- user program. Make sure that it still points to a valid memory
+ user program. Make sure that it still points to a valid memory
location. */
if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type)))
{
- /* FIXME (alloc): not safe is baseclass is really really big. */
+ /* FIXME (alloc): not safe is baseclass is really really big. */
gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
base_valaddr = buf;
/* Add one element to the end of the expression. */
/* To avoid a bug in the Sun 4 compiler, we pass things that can fit into
- a register through here */
+ a register through here. */
void
write_exp_elt (union exp_element expelt)
that contains the length of the string, then stuffing the string
constant itself into however many expression elements are needed
to hold it, and then writing another expression element that contains
- the length of the string. I.E. an expression element at each end of
+ the length of the string. I.e. an expression element at each end of
the string records the string length, so you can skip over the
expression elements containing the actual string bytes from either
end of the string. Note that this also allows gdb to handle
actual length is recorded in expression elements at each end of the
string. The null byte is taken into consideration when computing how
many expression elements are required to hold the string constant, of
- course. */
+ course. */
void
/* Compute the number of expression elements required to hold the string
(including a null byte terminator), along with one expression element
at each end to record the actual string length (not including the
- null byte terminator). */
+ null byte terminator). */
lenelt = 2 + BYTES_TO_EXP_ELEM (len + 1);
/* Ensure that we have enough available expression elements to store
- everything. */
+ everything. */
if ((expout_ptr + lenelt) >= expout_size)
{
/* Write the leading length expression element (which advances the current
expression element index), then write the string constant followed by a
terminating null byte, and then write the trailing length expression
- element. */
+ element. */
write_exp_elt_longcst ((LONGEST) len);
strdata = (char *) &expout->elts[expout_ptr];
that contains the length of the bitstring (in bits), then stuffing the
bitstring constant itself into however many expression elements are
needed to hold it, and then writing another expression element that
- contains the length of the bitstring. I.E. an expression element at
+ contains the length of the bitstring. I.e. an expression element at
each end of the bitstring records the bitstring length, so you can skip
over the expression elements containing the actual bitstring bytes from
- either end of the bitstring. */
+ either end of the bitstring. */
void
write_exp_bitstring (struct stoken str)
/* Compute the number of expression elements required to hold the bitstring,
along with one expression element at each end to record the actual
- bitstring length in bits. */
+ bitstring length in bits. */
lenelt = 2 + BYTES_TO_EXP_ELEM (len);
/* Ensure that we have enough available expression elements to store
- everything. */
+ everything. */
if ((expout_ptr + lenelt) >= expout_size)
{
/* Write the leading length expression element (which advances the current
expression element index), then write the bitstring constant, and then
- write the trailing length expression element. */
+ write the trailing length expression element. */
write_exp_elt_longcst ((LONGEST) bits);
strdata = (char *) &expout->elts[expout_ptr];
from the first value which has index 1.
$$digits Value history with index <digits> relative
- to the last value. I.E. $$0 is the last
+ to the last value. I.e. $$0 is the last
value, $$1 is the one previous to that, $$2
is the one previous to $$1, etc.
$ | $0 | $$0 The last value in the value history.
$$ An abbreviation for the second to the last
- value in the value history, I.E. $$1
-
- */
+ value in the value history, I.e. $$1 */
void
write_dollar_variable (struct stoken str)
struct internalvar *isym = NULL;
/* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
- and $$digits (equivalent to $<-digits> if you could type that). */
+ and $$digits (equivalent to $<-digits> if you could type that). */
int negate = 0;
int i = 1;
}
if (i == str.length)
{
- /* Just dollars (one or two) */
+ /* Just dollars (one or two). */
i = -negate;
goto handle_last;
}
}
/* On some systems, such as HP-UX and hppa-linux, certain system routines
- have names beginning with $ or $$. Check for those, first. */
+ have names beginning with $ or $$. Check for those, first. */
sym = lookup_symbol (copy_name (str), (struct block *) NULL,
VAR_DOMAIN, (int *) NULL);
case '\"':
case '{':
case '}':
- /* In future, may want to allow these?? */
+ /* In future, may want to allow these?? */
return 0;
case '<':
depth++; /* start nested template */
args = 1;
break;
- case OP_OBJC_MSGCALL: /* Objective C message (method) call */
+ case OP_OBJC_MSGCALL: /* Objective C message (method) call. */
oplen = 4;
args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
break;
case OP_M2_STRING:
case OP_STRING:
case OP_OBJC_NSSTRING: /* Objective C Foundation Class
- NSString constant */
- case OP_OBJC_SELECTOR: /* Objective C "@selector" pseudo-op */
+ NSString constant. */
+ case OP_OBJC_SELECTOR: /* Objective C "@selector" pseudo-op. */
case OP_NAME:
oplen = longest_to_int (expr->elts[endpos - 2].longconst);
oplen = 4 + BYTES_TO_EXP_ELEM (oplen + 1);
startup phase to re-parse breakpoint expressions after
a new shared library has been loaded. The language associated
to the current frame at this moment is not relevant for
- the breakpoint. Using it would therefore be silly, so it seems
+ the breakpoint. Using it would therefore be silly, so it seems
better to rely on the current language rather than relying on
- the current frame language to parse the expression. That's why
+ the current frame language to parse the expression. That's why
we do the following language detection only if the context block
has been specifically provided. */
struct symbol *func = block_linkage_function (block);
/* Record the actual number of expression elements, and then
reallocate the expression memory so that we free up any
- excess elements. */
+ excess elements. */
expout->nelts = expout_ptr;
expout = (struct expression *)
sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_ptr));;
/* Convert expression from postfix form as generated by yacc
- parser, to a prefix form. */
+ parser, to a prefix form. */
if (expressiondebug)
dump_raw_expression (expout, gdb_stdlog,
return value_type (val);
}
-/* A post-parser that does nothing */
+/* A post-parser that does nothing. */
void
null_post_parser (struct expression **exp, int void_context_p)
extern CORE_ADDR expression_context_pc;
/* The innermost context required by the stack and register variables
- we've encountered so far. */
+ we've encountered so far. */
extern struct block *innermost_block;
/* The block in which the most recently discovered symbol was found.
extern int arglist_len;
/* A string token, either a char-string or bit-string. Char-strings are
- used, for example, for the names of symbols. */
+ used, for example, for the names of symbols. */
struct stoken
{
- /* Pointer to first byte of char-string or first bit of bit-string */
+ /* Pointer to first byte of char-string or first bit of bit-string. */
char *ptr;
- /* Length of string in bytes for char-string or bits for bit-string */
+ /* Length of string in bytes for char-string or bits for bit-string. */
int length;
};
{
/* A language-specific type field. */
int type;
- /* Pointer to first byte of char-string or first bit of bit-string */
+ /* Pointer to first byte of char-string or first bit of bit-string. */
char *ptr;
- /* Length of string in bytes for char-string or bits for bit-string */
+ /* Length of string in bytes for char-string or bits for bit-string. */
int length;
};
extern char *lexptr;
-/* After a token has been recognized, this variable points to it.
+/* After a token has been recognized, this variable points to it.
Currently used only for error reporting. */
extern char *prev_lexptr;
enum precedence precedence;
/* For a binary operator: 1 iff right associate.
- For a unary operator: 1 iff postfix. */
+ For a unary operator: 1 iff postfix. */
int right_assoc;
};
/* The strerror() function can return NULL for errno values that are
out of range. Provide a "safe" version that always returns a
- printable string. */
+ printable string. */
char *
safe_strerror (int errnum)
#include <sys/procfs.h>
#include <sys/ptrace.h>
-/* Prototypes for supply_gregset etc. */
+/* Prototypes for supply_gregset etc. */
#include "gregset.h"
#include "ppc-tdep.h"
#include "ppc-linux-tdep.h"
struct ppc_debug_info
{
- uint32_t version; /* Only version 1 exists to date */
+ uint32_t version; /* Only version 1 exists to date. */
uint32_t num_instruction_bps;
uint32_t num_data_bps;
uint32_t num_condition_regs;
uint32_t data_bp_alignment;
- uint32_t sizeof_condition; /* size of the DVC register */
+ uint32_t sizeof_condition; /* size of the DVC register. */
uint64_t features;
};
There are 32 vector registers 16 bytes longs, plus a VSCR register
which is only 4 bytes long, but is fetched as a 16 bytes
- quantity. Up to here we have the elf_vrregset_t structure.
+ quantity. Up to here we have the elf_vrregset_t structure.
Appended to this there is space for the VRSAVE register: 4 bytes.
Even though this vrsave register is not included in the regset
typedef, it is handled by the ptrace requests.
PT_R8, PT_R9, PT_R10, PT_R11, PT_R12, PT_R13, PT_R14, PT_R15,
PT_R16, PT_R17, PT_R18, PT_R19, PT_R20, PT_R21, PT_R22, PT_R23,
PT_R24, PT_R25, PT_R26, PT_R27, PT_R28, PT_R29, PT_R30, PT_R31,
-PT_FPR0, PT_FPR0 + 2, PT_FPR0 + 4, PT_FPR0 + 6, PT_FPR0 + 8, PT_FPR0 + 10, PT_FPR0 + 12, PT_FPR0 + 14,
-PT_FPR0 + 16, PT_FPR0 + 18, PT_FPR0 + 20, PT_FPR0 + 22, PT_FPR0 + 24, PT_FPR0 + 26, PT_FPR0 + 28, PT_FPR0 + 30,
-PT_FPR0 + 32, PT_FPR0 + 34, PT_FPR0 + 36, PT_FPR0 + 38, PT_FPR0 + 40, PT_FPR0 + 42, PT_FPR0 + 44, PT_FPR0 + 46,
-PT_FPR0 + 48, PT_FPR0 + 50, PT_FPR0 + 52, PT_FPR0 + 54, PT_FPR0 + 56, PT_FPR0 + 58, PT_FPR0 + 60, PT_FPR0 + 62,
+PT_FPR0, PT_FPR0 + 2, PT_FPR0 + 4, PT_FPR0 + 6,
+PT_FPR0 + 8, PT_FPR0 + 10, PT_FPR0 + 12, PT_FPR0 + 14,
+PT_FPR0 + 16, PT_FPR0 + 18, PT_FPR0 + 20, PT_FPR0 + 22,
+PT_FPR0 + 24, PT_FPR0 + 26, PT_FPR0 + 28, PT_FPR0 + 30,
+PT_FPR0 + 32, PT_FPR0 + 34, PT_FPR0 + 36, PT_FPR0 + 38,
+PT_FPR0 + 40, PT_FPR0 + 42, PT_FPR0 + 44, PT_FPR0 + 46,
+PT_FPR0 + 48, PT_FPR0 + 50, PT_FPR0 + 52, PT_FPR0 + 54,
+PT_FPR0 + 56, PT_FPR0 + 58, PT_FPR0 + 60, PT_FPR0 + 62,
PT_NIP, PT_MSR, PT_CCR, PT_LNK, PT_CTR, PT_XER, PT_MQ */
/* *INDENT_ON * */
interface, and not the wordsize of the program's ABI. */
int wordsize = sizeof (long);
- /* General purpose registers occupy 1 slot each in the buffer */
+ /* General purpose registers occupy 1 slot each in the buffer. */
if (regno >= tdep->ppc_gp0_regnum
&& regno < tdep->ppc_gp0_regnum + ppc_num_gprs)
u_addr = ((regno - tdep->ppc_gp0_regnum + PT_R0) * wordsize);
&& regno < tdep->ppc_fp0_regnum + ppc_num_fprs)
u_addr = (PT_FPR0 * wordsize) + ((regno - tdep->ppc_fp0_regnum) * 8);
- /* UISA special purpose registers: 1 slot each */
+ /* UISA special purpose registers: 1 slot each. */
if (regno == gdbarch_pc_regnum (gdbarch))
u_addr = PT_NIP * wordsize;
if (regno == tdep->ppc_lr_regnum)
offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
regcache_raw_supply (regcache, regno,
- regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
+ regs + (regno
+ - tdep->ppc_vr0_regnum) * vrregsize + offset);
}
/* Fetch the top 32 bits of TID's general-purpose registers and the
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno);
int bytes_transferred;
- unsigned int offset; /* Offset of registers within the u area. */
+ unsigned int offset; /* Offset of registers within the u area. */
char buf[MAX_REGISTER_SIZE];
if (altivec_register_p (gdbarch, regno))
ppc_linux_fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
- /* Overload thread id onto process id */
+ /* Overload thread id onto process id. */
int tid = TIDGET (inferior_ptid);
- /* No thread id, just use process id */
+ /* No thread id, just use process id. */
if (tid == 0)
tid = PIDGET (inferior_ptid);
fetch_register (regcache, tid, regno);
}
-/* Store one VSX register. */
+/* Store one VSX register. */
static void
store_vsx_register (const struct regcache *regcache, int tid, int regno)
{
perror_with_name (_("Unable to store VSX register"));
}
-/* Store one register. */
+/* Store one register. */
static void
store_altivec_register (const struct regcache *regcache, int tid, int regno)
{
offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
regcache_raw_collect (regcache, regno,
- regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
+ regs + (regno
+ - tdep->ppc_vr0_regnum) * vrregsize + offset);
ret = ptrace (PTRACE_SETVRREGS, tid, 0, ®s);
if (ret < 0)
{
have_ptrace_booke_interface = 1;
max_slots_number = booke_debug_info.num_instruction_bps
- + booke_debug_info.num_data_bps + booke_debug_info.num_condition_regs;
+ + booke_debug_info.num_data_bps
+ + booke_debug_info.num_condition_regs;
}
else
{
int tid;
ptid_t ptid = inferior_ptid;
- /* We need to know whether ptrace supports PTRACE_SET_DEBUGREG and whether
- the target has DABR. If either answer is no, the ptrace call will
- return -1. Fail in that case. */
+ /* We need to know whether ptrace supports PTRACE_SET_DEBUGREG
+ and whether the target has DABR. If either answer is no, the
+ ptrace call will return -1. Fail in that case. */
tid = TIDGET (ptid);
if (tid == 0)
tid = PIDGET (ptid);
if (alloc_new)
{
t = xmalloc (sizeof (struct thread_points));
- t->hw_breaks = xzalloc (max_slots_number * sizeof (struct hw_break_tuple));
+ t->hw_breaks
+ = xzalloc (max_slots_number * sizeof (struct hw_break_tuple));
t->tid = tid;
VEC_safe_push (thread_points_p, ppc_threads, t);
}
errno = 0;
if (ptrace (PPC_PTRACE_DELHWDEBUG, tid, 0, hw_breaks[i].slot) < 0)
if (errno != ENOENT)
- perror_with_name (_("Unexpected error deleting breakpoint or watchpoint"));
+ perror_with_name (_("Unexpected error deleting "
+ "breakpoint or watchpoint"));
xfree (hw_breaks[i].hw_break);
hw_breaks[i].hw_break = NULL;
*condition_mode = PPC_BREAKPOINT_CONDITION_AND;
for (i = 0; i < num_byte_enable; i++)
- *condition_mode |= PPC_BREAKPOINT_CONDITION_BE (i + rightmost_enabled_byte);
+ *condition_mode
+ |= PPC_BREAKPOINT_CONDITION_BE (i + rightmost_enabled_byte);
/* Now we need to match the position within the DVC of the comparison
value with where the watch region is relative to the window
if (!value_lazy (v))
found_memory_cnt++;
}
- /* Other kinds of values are not fine. */
+ /* Other kinds of values are not fine. */
else
return -1;
}
if (VEC_empty (thread_points_p, ppc_threads))
return;
- /* Get a list of breakpoints from any thread. */
+ /* Get a list of breakpoints from any thread. */
p = VEC_last (thread_points_p, ppc_threads);
hw_breaks = p->hw_breaks;
- /* Copy that thread's breakpoints and watchpoints to the new thread. */
+ /* Copy that thread's breakpoints and watchpoints to the new thread. */
for (i = 0; i < max_slots_number; i++)
if (hw_breaks[i].hw_break)
booke_insert_point (hw_breaks[i].hw_break, tid);
addr &= ~mask;
- /* Check whether [start, start+length-1] intersects [addr, addr+mask]. */
+ /* Check whether [start, start+length-1] intersects [addr, addr+mask]. */
return start <= addr + mask && start + length - 1 >= addr;
}
ppc_linux_store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
- /* Overload thread id onto process id */
+ /* Overload thread id onto process id. */
int tid = TIDGET (inferior_ptid);
- /* No thread id, just use process id */
+ /* No thread id, just use process id. */
if (tid == 0)
tid = PIDGET (inferior_ptid);
/* Functions for transferring registers between a gregset_t or fpregset_t
(see sys/ucontext.h) and gdb's regcache. The word size is that used
- by the ptrace interface, not the current program's ABI. eg. If a
+ by the ptrace interface, not the current program's ABI. Eg. if a
powerpc64-linux gdb is being used to debug a powerpc32-linux app, we
read or write 64-bit gregsets. This is to suit the host libthread_db. */
}
/* Power ISA 2.05 (implemented by Power 6 and newer processors) increases
- the FPSCR from 32 bits to 64 bits. Even though Power 7 supports this
+ the FPSCR from 32 bits to 64 bits. Even though Power 7 supports this
ISA version, it doesn't have PPC_FEATURE_ARCH_2_05 set, only
PPC_FEATURE_ARCH_2_06. Since for now the only bits used in the higher
half of the register are for Decimal Floating Point, we check if that
else if (vsx)
return isa205? tdesc_powerpc_isa205_vsx64l : tdesc_powerpc_vsx64l;
else if (altivec)
- return isa205? tdesc_powerpc_isa205_altivec64l : tdesc_powerpc_altivec64l;
+ return isa205
+ ? tdesc_powerpc_isa205_altivec64l : tdesc_powerpc_altivec64l;
return isa205? tdesc_powerpc_isa205_64l : tdesc_powerpc_64l;
}
t->to_stopped_by_watchpoint = ppc_linux_stopped_by_watchpoint;
t->to_stopped_data_address = ppc_linux_stopped_data_address;
t->to_watchpoint_addr_within_range = ppc_linux_watchpoint_addr_within_range;
- t->to_can_accel_watchpoint_condition = ppc_linux_can_accel_watchpoint_condition;
+ t->to_can_accel_watchpoint_condition
+ = ppc_linux_can_accel_watchpoint_condition;
t->to_read_description = ppc_linux_read_description;
t->to_auxv_parse = ppc_linux_auxv_parse;
Now we've hit the breakpoint at shr1. (The breakpoint was
reset from the PLT entry to the actual shr1 function after the
shared library was loaded.) Note that the PLT entry has been
- resolved to contain a branch that takes us directly to shr1.
+ resolved to contain a branch that takes us directly to shr1.
(The real one, not the PLT entry.)
(gdb) x/2i 0x100409d4
changed twice.
Now the problem should be obvious. GDB places a breakpoint (a
- trap instruction) on the zero value of the PLT entry for shr1.
+ trap instruction) on the zero value of the PLT entry for shr1.
Later on, after the shared library had been loaded and the PLT
initialized, GDB gets a signal indicating this fact and attempts
(as it always does when it stops) to remove all the breakpoints.
that the latter does not is check to make sure that the breakpoint
location actually contains a breakpoint (trap instruction) prior
to attempting to write back the old contents. If it does contain
- a trap instruction, we allow the old contents to be written back.
+ a trap instruction, we allow the old contents to be written back.
Otherwise, we silently do nothing.
The big question is whether memory_remove_breakpoint () should be
/* If our breakpoint is no longer at the address, this means that the
program modified the code on us, so it is wrong to put back the
- old value */
+ old value. */
if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
val = target_write_memory (addr, bp_tgt->shadow_contents, bplen);
/* An instruction to match. */
struct insn_pattern
{
- unsigned int mask; /* mask the insn with this... */
- unsigned int data; /* ...and see if it matches this. */
+ unsigned int mask; /* mask the insn with this... */
+ unsigned int data; /* ...and see if it matches this. */
int optional; /* If non-zero, this insn may be absent. */
};
for (i = 0; i < 32; i++)
{
int regnum = i + tdep->ppc_gp0_regnum;
- trad_frame_set_reg_addr (this_cache, regnum, gpregs + i * tdep->wordsize);
+ trad_frame_set_reg_addr (this_cache,
+ regnum, gpregs + i * tdep->wordsize);
}
trad_frame_set_reg_addr (this_cache,
gdbarch_pc_regnum (gdbarch),
set_xml_syscall_file_name (XML_SYSCALL_FILENAME_PPC);
/* Trampolines. */
- tramp_frame_prepend_unwinder (gdbarch, &ppc32_linux_sigaction_tramp_frame);
- tramp_frame_prepend_unwinder (gdbarch, &ppc32_linux_sighandler_tramp_frame);
+ tramp_frame_prepend_unwinder (gdbarch,
+ &ppc32_linux_sigaction_tramp_frame);
+ tramp_frame_prepend_unwinder (gdbarch,
+ &ppc32_linux_sighandler_tramp_frame);
/* BFD target for core files. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
set_xml_syscall_file_name (XML_SYSCALL_FILENAME_PPC64);
/* Trampolines. */
- tramp_frame_prepend_unwinder (gdbarch, &ppc64_linux_sigaction_tramp_frame);
- tramp_frame_prepend_unwinder (gdbarch, &ppc64_linux_sighandler_tramp_frame);
+ tramp_frame_prepend_unwinder (gdbarch,
+ &ppc64_linux_sigaction_tramp_frame);
+ tramp_frame_prepend_unwinder (gdbarch,
+ &ppc64_linux_sighandler_tramp_frame);
/* BFD target for core files. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
set_gdbarch_core_regset_sections (gdbarch,
ppc64_linux_fp_regset_sections);
}
- set_gdbarch_regset_from_core_section (gdbarch, ppc_linux_regset_from_core_section);
+ set_gdbarch_regset_from_core_section (gdbarch,
+ ppc_linux_regset_from_core_section);
set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);
/* Enable TLS support. */
struct regset;
-/* From ppc-linux-tdep.c ... */
+/* From ppc-linux-tdep.c ... */
const struct regset *ppc_linux_gregset (int);
const struct regset *ppc_linux_fpregset (void);
#include "objfiles.h"
#include "infcall.h"
-/* Pass the arguments in either registers, or in the stack. Using the
+/* Pass the arguments in either registers, or in the stack. Using the
ppc sysv ABI, the first eight words of the argument list (that might
be less than eight parameters if some parameters occupy more than one
word) are passed in r3..r10 registers. float and double parameters are
- passed in fpr's, in addition to that. Rest of the parameters if any
- are passed in user stack.
+ passed in fpr's, in addition to that. Rest of the parameters if any
+ are passed in user stack.
If the function is returning a structure, then the return address is passed
in r3, then the first 7 words of the parametes can be passed in registers,
- starting from r4. */
+ starting from r4. */
CORE_ADDR
ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|| TYPE_CODE (type) == TYPE_CODE_UNION)
{
/* Structs and large values are put in an
- aligned stack slot ... */
+ aligned stack slot ... */
if (TYPE_CODE (type) == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& len >= 16)
/* The psABI says that "A caller of a function that takes a
variable argument list shall set condition register bit 6 to
1 if it passes one or more arguments in the floating-point
- registers. It is strongly recommended that the caller set the
+ registers. It is strongly recommended that the caller set the
bit to 0 otherwise..." Doing this for normal functions too
shouldn't hurt. */
if (write_pass)
if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16
&& !tdep->soft_float
- && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
+ && (gdbarch_long_double_format (gdbarch)
+ == floatformats_ibm_long_double))
{
/* IBM long double stored in f1 and f2. */
if (readbuf)
}
if (TYPE_LENGTH (type) == 16
&& ((TYPE_CODE (type) == TYPE_CODE_FLT
- && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
+ && (gdbarch_long_double_format (gdbarch)
+ == floatformats_ibm_long_double))
|| (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && tdep->soft_float)))
{
/* Soft-float IBM long double or _Decimal128 stored in r3, r4,
return 1;
}
-/* Pass the arguments in either registers, or in the stack. Using the
+/* Pass the arguments in either registers, or in the stack. Using the
ppc 64 bit SysV ABI.
This implements a dumbed down version of the ABI. It always writes
values to memory, GPR and FPR, even when not necessary. Doing this
- greatly simplifies the logic. */
+ greatly simplifies the logic. */
CORE_ADDR
-ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
+ struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
in the for-loop below. */
LONGEST gparam_size = 0;
/* Kevin writes ... I don't mind seeing tdep->wordsize used in the
- calls to align_up(), align_down(), etc. because this makes it
+ calls to align_up(), align_down(), etc. because this makes it
easier to reuse this code (in a copy/paste sense) in the future,
but it is a 64-bit ABI and asserting that the wordsize is 8 bytes
at some point makes it easier to verify that this function is
if (readbuf)
regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf);
if (writebuf)
- regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, writebuf);
+ regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2,
+ writebuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
}
struct regcache;
struct type;
-/* From ppc-sysv-tdep.c ... */
+/* From ppc-sysv-tdep.c ... */
enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch,
struct type *func_type,
struct type *valtype,
gdb_byte *readbuf,
const gdb_byte *writebuf);
-/* From rs6000-tdep.c... */
+/* From rs6000-tdep.c... */
int altivec_register_p (struct gdbarch *gdbarch, int regno);
int vsx_register_p (struct gdbarch *gdbarch, int regno);
int spe_register_p (struct gdbarch *gdbarch, int regno);
int regnum, const void *vsxregs, size_t len);
/* Collect register REGNUM in the general-purpose register set
- REGSET. from register cache REGCACHE into the buffer specified by
+ REGSET, from register cache REGCACHE into the buffer specified by
GREGS and LEN. If REGNUM is -1, do this for all registers in
REGSET. */
int regnum, void *gregs, size_t len);
/* Collect register REGNUM in the floating-point register set
- REGSET. from register cache REGCACHE into the buffer specified by
+ REGSET, from register cache REGCACHE into the buffer specified by
FPREGS and LEN. If REGNUM is -1, do this for all registers in
REGSET. */
const struct regcache *regcache,
int regnum, void *vsxregs, size_t len);
-/* Private data that this module attaches to struct gdbarch. */
+/* Private data that this module attaches to struct gdbarch. */
/* Vector ABI used by the inferior. */
enum powerpc_vector_abi
is not present in this variant. */
/* Floating-point registers. */
- int ppc_fp0_regnum; /* floating-point register 0 */
- int ppc_fpscr_regnum; /* fp status and condition register */
+ int ppc_fp0_regnum; /* Floating-point register 0. */
+ int ppc_fpscr_regnum; /* fp status and condition register. */
/* Multiplier-Quotient Register (older POWER architectures only). */
int ppc_mq_regnum;
int ppc_efpr0_regnum; /* First Extended FP register. */
/* Altivec registers. */
- int ppc_vr0_regnum; /* First AltiVec register */
- int ppc_vrsave_regnum; /* Last AltiVec register */
+ int ppc_vr0_regnum; /* First AltiVec register. */
+ int ppc_vrsave_regnum; /* Last AltiVec register. */
/* SPE registers. */
- int ppc_ev0_upper_regnum; /* First GPR upper half register */
- int ppc_ev0_regnum; /* First ev register */
- int ppc_acc_regnum; /* SPE 'acc' register */
- int ppc_spefscr_regnum; /* SPE 'spefscr' register */
+ int ppc_ev0_upper_regnum; /* First GPR upper half register. */
+ int ppc_ev0_regnum; /* First ev register. */
+ int ppc_acc_regnum; /* SPE 'acc' register. */
+ int ppc_spefscr_regnum; /* SPE 'spefscr' register. */
/* Decimal 128 registers. */
int ppc_dl0_regnum; /* First Decimal128 argument register pair. */
}
/*
- * 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".
+ * registers either. So, typing "info reg sp" becomes an "A7".
*/
static char *ppcbug_regnames[] =
};
/*
- * Define the monitor command strings. Since these are passed directly
+ * Define the monitor command strings. Since these are passed directly
* through to a printf style function, we need can include formatting
- * strings. We also need a CR or LF on the end.
+ * strings. We also need a CR or LF on the end.
*/
static struct target_ops ppcbug_ops0;
OPS->getreg.resp_delim = "="; /* getreg.resp_delim */
OPS->getreg.term = NULL; /* getreg.term */
OPS->getreg.term_cmd = NULL; /* getreg.term_cmd */
- OPS->register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
+ /* register_pattern */
+ OPS->register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)";
OPS->supply_register = ppcbug_supply_register;
OPS->dump_registers = "rd\r"; /* dump all registers */
OPS->load_routine = NULL; /* load_routine (defaults to SRECs) */
/* NetBSD is confused. It appears that 1.5 was using the correct SVR4
convention but, 1.6 switched to the below broken convention. For
- the moment use the broken convention. Ulgh!. */
+ the moment use the broken convention. Ulgh! */
static enum return_value_convention
ppcnbsd_return_value (struct gdbarch *gdbarch, struct type *func_type,
trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, addr);
addr += tdep->wordsize;
trad_frame_set_reg_addr (this_cache, gdbarch_pc_regnum (gdbarch),
- addr); /* SRR0? */
+ addr); /* SRR0? */
addr += tdep->wordsize;
/* Construct the frame ID using the function start. */
}
/* Collect register REGNUM in the general-purpose register set
- REGSET. from register cache REGCACHE into the buffer specified by
+ REGSET, from register cache REGCACHE into the buffer specified by
GREGS and LEN. If REGNUM is -1, do this for all registers in
REGSET. */
trad_frame_set_reg_addr (cache, tdep->ppc_ctr_regnum, addr);
addr += tdep->wordsize;
trad_frame_set_reg_addr (cache, gdbarch_pc_regnum (gdbarch), addr);
- /* SRR0? */
+ /* SRR0? */
addr += tdep->wordsize;
/* Construct the frame ID using the function start. */
const void *gregs, size_t len);
/* Collect register REGNUM in the general-purpose register set
- REGSET. from register cache REGCACHE into the buffer specified by
+ REGSET, from register cache REGCACHE into the buffer specified by
GREGS and LEN. If REGNUM is -1, do this for all registers in
REGSET. */
#include "arch-utils.h"
#ifdef TUI
-#include "tui/tui.h" /* For tui_active et.al. */
+#include "tui/tui.h" /* For tui_active et al. */
#endif
#if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG)
# define USE_PRINTF_I64 0
#endif
-extern int asm_demangle; /* Whether to demangle syms in asm printouts */
+extern int asm_demangle; /* Whether to demangle syms in asm
+ printouts. */
struct format_data
{
/* Program space associated with `block'. */
struct program_space *pspace;
- /* Innermost block required by this expression when evaluated */
+ /* Innermost block required by this expression when evaluated. */
struct block *block;
- /* Status of this display (enabled or disabled) */
+ /* Status of this display (enabled or disabled). */
int enabled_p;
};
static int display_number;
-/* Prototypes for exported functions. */
+/* Prototypes for exported functions. */
void output_command (char *, int);
void _initialize_printcmd (void);
-/* Prototypes for local functions. */
+/* Prototypes for local functions. */
static void do_one_display (struct display *);
\f
}
/* Given an address ADDR return all the elements needed to print the
- address in a symbolic form. NAME can be mangled or not depending
+ address in a symbolic form. NAME can be mangled or not depending
on DO_DEMANGLE (and also on the asm_demangle global variable,
- manipulated via ''set print asm-demangle''). Return 0 in case of
- success, when all the info in the OUT paramters is valid. Return 1
- otherwise. */
+ manipulated via ''set print asm-demangle''). Return 0 in case of
+ success, when all the info in the OUT paramters is valid. Return 1
+ otherwise. */
int
build_address_symbolic (struct gdbarch *gdbarch,
CORE_ADDR addr, /* IN */
else
{
if (size != '\0' && size != 'b')
- warning (_("Unable to display strings with size '%c', using 'b' \
-instead."), size);
+ warning (_("Unable to display strings with "
+ "size '%c', using 'b' instead."), size);
size = 'b';
val_type = builtin_type (next_gdbarch)->builtin_int8;
}
the address stored in LAST_EXAMINE_VALUE. FIXME: Should
the disassembler be modified so that LAST_EXAMINE_VALUE
is left with the byte sequence from the last complete
- instruction fetched from memory? */
+ instruction fetched from memory? */
last_examine_value = value_at_lazy (val_type, next_address);
if (last_examine_value)
struct obj_section *section;
CORE_ADDR load_addr, context_pc = 0;
int is_a_field_of_this; /* C++: lookup_symbol sets this to nonzero
- if exp is a field of `this'. */
+ if exp is a field of `this'. */
if (exp == 0)
error (_("Argument required."));
last_size = fmt.size;
last_format = fmt.format;
- /* Set a couple of internal variables if appropriate. */
+ /* Set a couple of internal variables if appropriate. */
if (last_examine_value)
{
/* Make last address examined available to the user as $_. Use
/* Display a single auto-display.
Do nothing if the display cannot be printed in the current context,
- or if the display is disabled. */
+ or if the display is disabled. */
static void
do_one_display (struct display *d)
if (s == 0)
error_no_arg (_("format-control string and values to print"));
- /* Skip white space before format string */
+ /* Skip white space before format string. */
while (*s == ' ' || *s == '\t')
s++;
*f++ = '"';
break;
default:
- /* ??? TODO: handle other escape sequences */
+ /* ??? TODO: handle other escape sequences. */
error (_("Unrecognized escape character \\%c in format string."),
c);
}
\nWith a subcommand, this command modifies parts of the gdb environment.\n\
You can see these environment settings with the \"show\" command."));
- /* "call" is the same as "set", but handy for dbx users to call fns. */
+ /* "call" is the same as "set", but handy for dbx users to call fns. */
c = add_com ("call", class_vars, call_command, _("\
Call a function in the program.\n\
The argument is the function name and arguments, in the notation of the\n\
#ifdef HAVE_SYS_USER_H
#include <sys/user.h> /* for struct user */
#endif
-#include <fcntl.h> /* for O_RDWR etc. */
+#include <fcntl.h> /* for O_RDWR etc. */
#include "gdb_wait.h"
#include "proc-utils.h"
/* Much of the information used in the /proc interface, particularly for
printing status information, is kept as tables of structures of the
following form. These tables can be used to map numeric values to
- their symbolic names and to a string that describes their specific use. */
+ their symbolic names and to a string that describes their specific use. */
struct trans {
long value; /* The numeric value */
/* Much of the information used in the /proc interface, particularly for
printing status information, is kept as tables of structures of the
following form. These tables can be used to map numeric values to
- their symbolic names and to a string that describes their specific use. */
+ their symbolic names and to a string that describes their specific use. */
struct trans {
int value; /* The numeric value */
};
/* Translate bits in the pr_flags member of the prstatus structure,
- into the names and desc information. */
+ into the names and desc information. */
static struct trans pr_flag_table[] =
{
proc_prettyfprint_status (X, Y, Z, T)
/* Define the type (and more importantly the width) of the control
- word used to write to the /proc/PID/ctl file. */
+ word used to write to the /proc/PID/ctl file. */
#if defined (PROC_CTL_WORD_TYPE)
typedef PROC_CTL_WORD_TYPE procfs_ctl_t;
#else
#include "inf-child.h"
#if defined (NEW_PROC_API)
-#define _STRUCTURED_PROC 1 /* Should be done by configure script. */
+#define _STRUCTURED_PROC 1 /* Should be done by configure script. */
#endif
#include <sys/procfs.h>
There will be a separate procinfo structure for use by the (not yet
implemented) "info proc" command, so that we can print useful
information about any random process without interfering with the
- inferior's procinfo information. */
+ inferior's procinfo information. */
#ifdef NEW_PROC_API
/* format strings for /proc paths */
# define STATUS_PROC_NAME_FMT "/proc/%05d"
# define MAX_PROC_NAME_SIZE sizeof("/proc/ttttppppp")
# endif
-/* the name of the proc status struct depends on the implementation */
+/* The name of the proc status struct depends on the implementation. */
typedef prstatus_t gdb_prstatus_t;
typedef prstatus_t gdb_lwpstatus_t;
#endif /* NEW_PROC_API */
These do not even have their own independent file descriptor.
All operations are carried out on the file descriptor of the
parent process. Therefore we just call open again for each
- thread, getting a new handle for the same 'file'.
- */
+ thread, getting a new handle for the same 'file'. */
#ifdef NEW_PROC_API
/* In this case, there are several different file descriptors that
needed. */
strcpy (tmp, pi->pathname);
- switch (which) { /* which file descriptor to open? */
+ switch (which) { /* Which file descriptor to open? */
case FD_CTL:
if (pi->tid)
strcat (tmp, "/lwpctl");
break;
case FD_AS:
if (pi->tid)
- return 0; /* there is no 'as' file descriptor for an lwp */
+ return 0; /* There is no 'as' file descriptor for an lwp. */
strcat (tmp, "/as");
fd = open_with_retry (tmp, O_RDWR);
if (fd <= 0)
#ifdef PIOCTSTATUS /* OSF */
- /* Only one FD; just open it. */
+ /* Only one FD; just open it. */
if ((fd = open_with_retry (pi->pathname, O_RDWR)) == 0)
return 0;
-#else /* Sol 2.5, Irix, other? */
+#else /* Sol 2.5, Irix, other? */
if (pi->tid == 0) /* Master procinfo for the process */
{
fd = open_with_retry (pi->pathname, O_RDWR);
procinfo *process;
int lwpid = pi->tid;
- /* Find the procinfo for the entire process. */
+ /* Find the procinfo for the entire process. */
if ((process = find_procinfo (pi->pid, 0)) == NULL)
return 0; /* fail */
- /* Now obtain the file descriptor for the LWP. */
+ /* Now obtain the file descriptor for the LWP. */
if ((fd = ioctl (process->ctl_fd, PIOCOPENLWP, &lwpid)) <= 0)
return 0; /* fail */
-#else /* Irix, other? */
- return 0; /* Don't know how to open threads */
+#else /* Irix, other? */
+ return 0; /* Don't know how to open threads. */
#endif /* Sol 2.5 PIOCOPENLWP */
}
#endif /* OSF PIOCTSTATUS */
procinfo *pi, *parent = NULL;
if ((pi = find_procinfo (pid, tid)))
- return pi; /* Already exists, nothing to do. */
+ return pi; /* Already exists, nothing to do. */
- /* find parent before doing malloc, to save having to cleanup */
+ /* Find parent before doing malloc, to save having to cleanup. */
if (tid != 0)
parent = find_procinfo_or_die (pid, 0); /* FIXME: should I
create it if it
- doesn't exist yet? */
+ doesn't exist yet? */
pi = (procinfo *) xmalloc (sizeof (procinfo));
memset (pi, 0, sizeof (procinfo));
{
procinfo *tmp;
- if (pi->tid != 0) /* destroy a thread procinfo */
+ if (pi->tid != 0) /* Destroy a thread procinfo. */
{
- tmp = find_procinfo (pi->pid, 0); /* find the parent process */
+ tmp = find_procinfo (pi->pid, 0); /* Find the parent process. */
destroy_one_procinfo (&tmp->thread_list, pi);
}
- else /* destroy a process procinfo and all its threads */
+ else /* Destroy a process procinfo and all its threads. */
{
/* First destroy the children, if any; */
while (pi->thread_list != NULL)
/* Extract syscall numbers and names from /proc/<pid>/sysent. Initialize
pi->num_syscalls with the number of syscalls and pi->syscall_names
with the names. (Certain numbers may be skipped in which case the
- names for these numbers will be left as NULL.) */
+ names for these numbers will be left as NULL.) */
#define MAX_SYSCALL_NAME_LENGTH 256
#define MAX_SYSCALLS 65536
/* Find maximum syscall number. This may not be the same as
pr_nsyscalls since that value refers to the number of entries
in the table. (Also, the docs indicate that some system
- call numbers may be skipped.) */
+ call numbers may be skipped.) */
maxcall = syscalls[0].pr_number;
if (pi->syscall_names[callnum] != NULL)
{
- /* FIXME: Generate warning */
+ /* FIXME: Generate warning. */
continue;
}
int
proc_get_status (procinfo *pi)
{
- /* Status file descriptor is opened "lazily" */
+ /* Status file descriptor is opened "lazily". */
if (pi->status_fd == 0 &&
open_procinfo_files (pi, FD_STATUS) == 0)
{
else
{
/* Sigh... I have to read a different data structure,
- depending on whether this is a main process or an LWP. */
+ depending on whether this is a main process or an LWP. */
if (pi->tid)
pi->status_valid = (read (pi->status_fd,
(char *) &pi->prstatus.pr_lwp,
if (pi->status_valid &&
(pi->prstatus.pr_lwp.pr_flags & PR_ISTOP) &&
pi->prstatus.pr_lwp.pr_why == PR_REQUESTED)
- /* Unixware peculiarity -- read the damn thing again! */
+ /* Unixware peculiarity -- read the damn thing again! */
pi->status_valid = (read (pi->status_fd,
(char *) &pi->prstatus,
sizeof (gdb_prstatus_t))
#ifdef PIOCTSTATUS /* osf */
if (pi->tid == 0) /* main process */
{
- /* Just read the danged status. Now isn't that simple? */
+ /* Just read the danged status. Now isn't that simple? */
pi->status_valid =
(ioctl (pi->status_fd, PIOCSTATUS, &pi->prstatus) >= 0);
}
{
if (!pi->status_valid)
if (!proc_get_status (pi))
- return 0; /* FIXME: not a good failure value (but what is?) */
+ return 0; /* FIXME: not a good failure value (but what is?) */
#ifdef NEW_PROC_API
# ifdef UNIXWARE
{
if (!pi->status_valid)
if (!proc_get_status (pi))
- return 0; /* FIXME: not a good failure value (but what is?) */
+ return 0; /* FIXME: not a good failure value (but what is?) */
#ifdef NEW_PROC_API
return pi->prstatus.pr_lwp.pr_why;
{
if (!pi->status_valid)
if (!proc_get_status (pi))
- return 0; /* FIXME: not a good failure value (but what is?) */
+ return 0; /* FIXME: not a good failure value (but what is?) */
#ifdef NEW_PROC_API
return pi->prstatus.pr_lwp.pr_what;
{
if (!pi->status_valid)
if (!proc_get_status (pi))
- return 0; /* FIXME: not a good failure value (but what is?) */
+ return 0; /* FIXME: not a good failure value (but what is?) */
#ifdef NEW_PROC_API
return pi->prstatus.pr_lwp.pr_cursig;
if (pi->pid != 0)
pi = find_procinfo_or_die (pi->pid, 0);
-#ifdef NEW_PROC_API /* Newest method: UnixWare and newer Solarii */
+#ifdef NEW_PROC_API /* Newest method: UnixWare and newer Solarii. */
/* First normalize the PCUNSET/PCRESET command opcode
(which for no obvious reason has a different definition
from one operating system to the next...) */
{
procfs_ctl_t arg[2];
- if (mode == FLAG_SET) /* Set the flag (RLC, FORK, or ASYNC) */
+ if (mode == FLAG_SET) /* Set the flag (RLC, FORK, or ASYNC). */
arg[0] = PCSET;
- else /* Reset the flag */
+ else /* Reset the flag. */
arg[0] = GDBRESET;
arg[1] = flag;
}
#else
#ifdef PIOCSET /* Irix/Sol5 method */
- if (mode == FLAG_SET) /* Set the flag (hopefully RLC, FORK, or ASYNC) */
+ if (mode == FLAG_SET) /* Set the flag (hopefully RLC, FORK, or ASYNC). */
{
win = (ioctl (pi->ctl_fd, PIOCSET, &flag) >= 0);
}
- else /* Reset the flag */
+ else /* Reset the flag. */
{
win = (ioctl (pi->ctl_fd, PIOCRESET, &flag) >= 0);
}
}
break;
default:
- win = 0; /* fail -- unknown flag (can't do PR_ASYNC) */
+ win = 0; /* Fail -- unknown flag (can't do PR_ASYNC). */
break;
}
#endif
return 0;
}
- runflags = PRCFAULT; /* always clear current fault */
+ runflags = PRCFAULT; /* Always clear current fault. */
if (step)
runflags |= PRSTEP;
if (signo == 0)
runflags |= PRCSIG;
- else if (signo != -1) /* -1 means do nothing W.R.T. signals */
+ else if (signo != -1) /* -1 means do nothing W.R.T. signals. */
proc_set_current_signal (pi, signo);
#ifdef NEW_PROC_API
#else /* ioctl method */
win = (ioctl (pi->ctl_fd, PIOCSTRACE, sigset) >= 0);
#endif
- /* The above operation renders the procinfo's cached pstatus obsolete. */
+ /* The above operation renders the procinfo's cached pstatus obsolete. */
pi->status_valid = 0;
if (!win)
#else /* ioctl method */
win = (ioctl (pi->ctl_fd, PIOCSFAULT, fltset) >= 0);
#endif
- /* The above operation renders the procinfo's cached pstatus obsolete. */
+ /* The above operation renders the procinfo's cached pstatus obsolete. */
pi->status_valid = 0;
return win;
bug. */
if (signo > 0 &&
signo == proc_cursig (pi))
- return 1; /* I assume this is a success? */
+ return 1; /* I assume this is a success? */
#endif
/* The pointer is just a type alias. */
win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd));
#else /* ioctl method */
/* FIXME: do I need the Alpha OSF fixups present in
- procfs.c/unconditionally_kill_inferior? Perhaps only for SIGKILL? */
+ procfs.c/unconditionally_kill_inferior? Perhaps only for SIGKILL? */
win = (ioctl (pi->ctl_fd, PIOCKILL, &signo) >= 0);
#endif
}
systems. */
return 0;
#else
-/* Horrible hack! Detect Solaris 2.5, because this doesn't work on 2.5 */
-#if defined (PIOCOPENLWP) || defined (UNIXWARE) /* Solaris 2.5: bail out */
+/* Horrible hack! Detect Solaris 2.5, because this doesn't work on 2.5. */
+#if defined (PIOCOPENLWP) || defined (UNIXWARE) /* Solaris 2.5: bail out. */
return 0;
#else
struct {
proc_warn (pi, "proc_get_LDT_entry (open)", __LINE__);
return NULL;
}
- /* Make sure it gets closed again! */
+ /* Make sure it gets closed again! */
old_chain = make_cleanup_close (fd);
/* Now 'read' thru the table, find a match and return it. */
ldt_entry->acc1 == 0 &&
ldt_entry->acc2 == 0)
break; /* end of table */
- /* If key matches, return this entry. */
+ /* If key matches, return this entry. */
if (ldt_entry->sel == key)
return ldt_entry;
}
- /* Loop ended, match not found. */
+ /* Loop ended, match not found. */
return NULL;
#else
int nldt, i;
return NULL;
}
- /* Allocate space for the number of LDT entries. */
- /* This alloc has to persist, 'cause we return a pointer to it. */
+ /* Allocate space for the number of LDT entries. */
+ /* This alloc has to persist, 'cause we return a pointer to it. */
if (nldt > nalloc)
{
ldt_entry = (struct ssd *)
return NULL;
}
- /* Search the table and return the (first) entry matching 'key'. */
+ /* Search the table and return the (first) entry matching 'key'. */
for (i = 0; i < nldt; i++)
if (ldt_entry[i].sel == key)
return &ldt_entry[i];
- /* Loop ended, match not found. */
+ /* Loop ended, match not found. */
return NULL;
#endif
}
int key;
procinfo *pi;
- /* Find procinfo for the lwp. */
+ /* Find procinfo for the lwp. */
if ((pi = find_procinfo (PIDGET (ptid), TIDGET (ptid))) == NULL)
{
warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."),
PIDGET (ptid), TIDGET (ptid));
return NULL;
}
- /* get its general registers. */
+ /* get its general registers. */
if ((gregs = proc_get_gregs (pi)) == NULL)
{
warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."),
PIDGET (ptid), TIDGET (ptid));
return NULL;
}
- /* Now extract the GS register's lower 16 bits. */
+ /* Now extract the GS register's lower 16 bits. */
key = (*gregs)[GS] & 0xffff;
- /* Find the matching entry and return it. */
+ /* Find the matching entry and return it. */
return proc_get_LDT_entry (pi, key);
}
/* NEW_PROC_API: only works for the process procinfo, because the
LWP procinfos do not get prstatus filled in. */
#ifdef NEW_PROC_API
- if (pi->tid != 0) /* find the parent process procinfo */
+ if (pi->tid != 0) /* Find the parent process procinfo. */
pi = find_procinfo_or_die (pi->pid, 0);
#endif
return pi->prstatus.pr_nlwp;
int
proc_get_current_thread (procinfo *pi)
{
-#if 0 /* FIXME: not ready for prime time? */
+#if 0 /* FIXME: not ready for prime time? */
return pi->prstatus.pr_tid;
#else
return 0;
}
#else
#ifdef NEW_PROC_API
-/* Unixware and Solaris 6 (and later) version */
+/* Unixware and Solaris 6 (and later) version. */
static void
do_closedir_cleanup (void *dir)
{
nthreads = proc_get_nthreads (pi);
if (nthreads < 2)
- return 0; /* nothing to do for 1 or fewer threads */
+ return 0; /* Nothing to do for 1 or fewer threads. */
threads = xmalloc (nthreads * sizeof (tid_t));
for (thread = pi->thread_list; thread != NULL; thread = next)
{
- next = thread->next; /* in case thread is destroyed */
+ next = thread->next; /* In case thread is destroyed. */
if ((retval = (*func) (pi, thread, ptr)) != 0)
break;
}
#ifdef PROCFS_DONT_TRACE_FAULTS
/* On some systems (OSF), we don't trace hardware faults.
Apparently it's enough that we catch them as signals.
- Wonder why we don't just do that in general? */
- premptyset (&traced_faults); /* don't trace faults. */
+ Wonder why we don't just do that in general? */
+ premptyset (&traced_faults); /* don't trace faults. */
#else
- /* Register to trace hardware faults in the child. */
- prfillset (&traced_faults); /* trace all faults... */
+ /* Register to trace hardware faults in the child. */
+ prfillset (&traced_faults); /* trace all faults... */
gdb_prdelset (&traced_faults, FLTPAGE); /* except page fault. */
#endif
if (!proc_set_traced_faults (pi, &traced_faults))
return __LINE__;
- /* Register to trace selected signals in the child. */
+ /* Register to trace selected signals in the child. */
premptyset (&traced_signals);
if (!register_gdb_signals (pi, &traced_signals))
return __LINE__;
gdb_praddsysset (traced_syscall_entries, SYS_exit);
#endif
#ifdef SYS_lwpexit
- gdb_praddsysset (traced_syscall_entries, SYS_lwpexit); /* And _lwp_exit... */
+ gdb_praddsysset (traced_syscall_entries, SYS_lwpexit);/* And _lwp_exit... */
#endif
#ifdef SYS_lwp_exit
gdb_praddsysset (traced_syscall_entries, SYS_lwp_exit);
/* OSF method for tracing exec syscalls. Quoting:
Under Alpha OSF/1 we have to use a PIOCSSPCACT ioctl to trace
exits from exec system calls because of the user level loader. */
- /* FIXME: make nice and maybe move into an access function. */
+ /* FIXME: make nice and maybe move into an access function. */
{
int prfs_flags;
return __LINE__;
}
#else /* not PRFS_STOPEXEC */
- /* Everyone else's (except OSF) method for tracing exec syscalls */
+ /* Everyone else's (except OSF) method for tracing exec syscalls. */
/* GW: Rationale...
Not all systems with /proc have all the exec* syscalls with the same
names. On the SGI, for example, there is no SYS_exec, but there
- *is* a SYS_execv. So, we try to account for that. */
+ *is* a SYS_execv. So, we try to account for that. */
traced_syscall_exits = sysset_t_alloc (pi);
gdb_premptysysset (traced_syscall_exits);
gdb_praddsysset (traced_syscall_exits, SYS_lwpexit);
#endif
-#ifdef SYS_lwp_create /* FIXME: once only, please */
+#ifdef SYS_lwp_create /* FIXME: once only, please. */
gdb_praddsysset (traced_syscall_exits, SYS_lwp_create);
gdb_praddsysset (traced_syscall_exits, SYS_lwp_exit);
#endif
if (!proc_set_run_on_last_close (pi))
dead_procinfo (pi, "do_attach: couldn't set RLC.", NOKILL);
- /* Now stop the process. */
+ /* Now stop the process. */
if (!proc_stop_process (pi))
dead_procinfo (pi, "do_attach: couldn't stop the process.", NOKILL);
pi->ignore_next_sigstop = 1;
{
procinfo *pi;
- /* Find procinfo for the main process */
+ /* Find procinfo for the main process. */
pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0); /* FIXME: threads */
if (signo)
if (!proc_set_current_signal (pi, signo))
}
/* Search the symbol table of the file referenced by FD for a symbol
- named __dbx_link(). If found, then insert a breakpoint at this location,
+ named __dbx_link(). If found, then insert a breakpoint at this location,
and return nonzero. Return zero otherwise. */
static int
procfs_wait (struct target_ops *ops,
ptid_t ptid, struct target_waitstatus *status, int options)
{
- /* First cut: loosely based on original version 2.1 */
+ /* First cut: loosely based on original version 2.1. */
procinfo *pi;
int wstat;
int temp_tid;
wstat = 0;
retval = pid_to_ptid (-1);
- /* Find procinfo for main process */
+ /* Find procinfo for main process. */
pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0);
if (pi)
{
- /* We must assume that the status is stale now... */
+ /* We must assume that the status is stale now... */
pi->status_valid = 0;
pi->gregs_valid = 0;
pi->fpregs_valid = 0;
-#if 0 /* just try this out... */
+#if 0 /* just try this out... */
flags = proc_flags (pi);
why = proc_why (pi);
if ((flags & PR_STOPPED) && (why == PR_REQUESTED))
- pi->status_valid = 0; /* re-read again, IMMEDIATELY... */
+ pi->status_valid = 0; /* re-read again, IMMEDIATELY... */
#endif
/* If child is not stopped, wait for it to stop. */
if (!(proc_flags (pi) & (PR_STOPPED | PR_ISTOP)) &&
!proc_wait_for_stop (pi))
{
- /* wait_for_stop failed: has the child terminated? */
+ /* wait_for_stop failed: has the child terminated? */
if (errno == ENOENT)
{
int wait_retval;
- /* /proc file not found; presumably child has terminated. */
- wait_retval = wait (&wstat); /* "wait" for the child's exit */
+ /* /proc file not found; presumably child has terminated. */
+ wait_retval = wait (&wstat); /* "wait" for the child's exit. */
- if (wait_retval != PIDGET (inferior_ptid)) /* wrong child? */
+ if (wait_retval != PIDGET (inferior_ptid)) /* wrong child? */
error (_("procfs: couldn't stop "
"process %d: wait returned %d."),
PIDGET (inferior_ptid), wait_retval);
/* FIXME: might I not just use waitpid?
- Or try find_procinfo to see if I know about this child? */
+ Or try find_procinfo to see if I know about this child? */
retval = pid_to_ptid (wait_retval);
}
else if (errno == EINTR)
goto wait_again;
else
{
- /* Unknown error from wait_for_stop. */
+ /* Unknown error from wait_for_stop. */
proc_error (pi, "target_wait (wait_for_stop)", __LINE__);
}
}
{
struct inferior *inf;
- /* Handle SYS_exit call only */
+ /* Handle SYS_exit call only. */
/* Stopped at entry to SYS_exit.
Make it runnable, resume it, then use
the wait system call to get its exit code.
somehow, I could get its termination event
here. */
- /* If wait returns -1, that's what we return to GDB. */
+ /* If wait returns -1, that's what we return
+ to GDB. */
if (temp < 0)
retval = pid_to_ptid (temp);
}
#endif
if (status)
{
- /* How to exit gracefully, returning "unknown event" */
+ /* How to exit gracefully, returning "unknown
+ event". */
status->kind = TARGET_WAITKIND_SPURIOUS;
return inferior_ptid;
}
/* Hopefully this is our own "fork-child" execing
the real child. Hoax this event into a trap, and
GDB will see the child about to execute its start
- address. */
+ address. */
wstat = (SIGTRAP << 8) | 0177;
}
#ifdef SYS_syssgi
if (!in_thread_list (temp_ptid))
add_thread (temp_ptid);
- /* Return to WFI, but tell it to immediately resume. */
+ /* Return to WFI, but tell it to immediately resume. */
status->kind = TARGET_WAITKIND_SPURIOUS;
return inferior_ptid;
}
wstat = (SIGTRAP << 8) | 0177;
break;
#endif
- /* FIXME: use si_signo where possible. */
+ /* FIXME: use si_signo where possible. */
case FLTPRIV:
-#if (FLTILL != FLTPRIV) /* avoid "duplicate case" error */
+#if (FLTILL != FLTPRIV) /* Avoid "duplicate case" error. */
case FLTILL:
#endif
wstat = (SIGILL << 8) | 0177;
break;
case FLTBPT:
-#if (FLTTRACE != FLTBPT) /* avoid "duplicate case" error */
+#if (FLTTRACE != FLTBPT) /* Avoid "duplicate case" error. */
case FLTTRACE:
#endif
/* If we hit our __dbx_link() internal breakpoint,
break;
case FLTSTACK:
case FLTACCESS:
-#if (FLTBOUNDS != FLTSTACK) /* avoid "duplicate case" error */
+#if (FLTBOUNDS != FLTSTACK) /* Avoid "duplicate case" error. */
case FLTBOUNDS:
#endif
wstat = (SIGSEGV << 8) | 0177;
break;
case FLTIOVF:
case FLTIZDIV:
-#if (FLTFPE != FLTIOVF) /* avoid "duplicate case" error */
+#if (FLTFPE != FLTIOVF) /* Avoid "duplicate case" error. */
case FLTFPE:
#endif
wstat = (SIGFPE << 8) | 0177;
break;
case FLTPAGE: /* Recoverable page fault */
- default: /* FIXME: use si_signo if possible for fault */
+ default: /* FIXME: use si_signo if possible for
+ fault. */
retval = pid_to_ptid (-1);
printf_filtered ("procfs:%d -- ", __LINE__);
printf_filtered (_("child stopped for unknown reason:\n"));
create_procinfo (PIDGET (retval), TIDGET (retval));
}
}
- else /* flags do not indicate STOPPED */
+ else /* Flags do not indicate STOPPED. */
{
- /* surely this can't happen... */
+ /* surely this can't happen... */
printf_filtered ("procfs:%d -- process not stopped.\n",
__LINE__);
proc_prettyprint_flags (flags, 1);
transferred. Otherwise, it will be a positive value which
indicates the number of bytes transferred between gdb and the
target. (Note that the interface also makes provisions for
- negative values, but this capability isn't implemented here.) */
+ negative values, but this capability isn't implemented here.) */
static int
procfs_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int dowrite,
procinfo *pi;
int nbytes = 0;
- /* Find procinfo for main process */
+ /* Find procinfo for main process. */
pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0);
if (pi->as_fd == 0 &&
open_procinfo_files (pi, FD_AS) == 0)
So basically PR_STEP is the sole argument that must be passed
to proc_run_process (for use in the prrun struct by ioctl). */
- /* Find procinfo for main process */
+ /* Find procinfo for main process. */
pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0);
/* First cut: ignore pid argument. */
make_signal_thread_runnable,
NULL);
#endif
- pi = thread; /* substitute the thread's procinfo for run */
+ pi = thread; /* Substitute the thread's procinfo
+ for run. */
}
}
}
parent_pid = proc_parent_pid (pi);
#ifdef PROCFS_NEED_CLEAR_CURSIG_FOR_KILL
- /* FIXME: use access functions */
+ /* FIXME: use access functions. */
/* Alpha OSF/1-3.x procfs needs a clear of the current signal
before the PIOCKILL, otherwise it might generate a corrupted core
file for the inferior. */
newsiginfo.si_errno = 0;
newsiginfo.si_pid = getpid ();
newsiginfo.si_uid = getuid ();
- /* FIXME: use proc_set_current_signal */
+ /* FIXME: use proc_set_current_signal. */
ioctl (pi->ctl_fd, PIOCSSIG, &newsiginfo);
}
#else /* PROCFS_NEED_PIOCSSIG_FOR_KILL */
{
if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */
{
- /* Find procinfo for main process */
+ /* Find procinfo for main process. */
procinfo *pi = find_procinfo (PIDGET (inferior_ptid), 0);
if (pi)
if (!ptid_equal (inferior_ptid, null_ptid))
{
- /* Find procinfo for main process */
+ /* Find procinfo for main process. */
pi = find_procinfo (PIDGET (inferior_ptid), 0);
if (pi)
destroy_procinfo (pi);
/* Save some of the /proc state to be restored if we detach. */
/* FIXME: Why? In case another debugger was debugging it?
- We're it's parent, for Ghu's sake! */
+ We're it's parent, for Ghu's sake! */
if (!proc_get_traced_signals (pi, &pi->saved_sigset))
proc_error (pi, "init_inferior, get_traced_signals", __LINE__);
if (!proc_get_held_signals (pi, &pi->saved_sighold))
So what we need to do is to insert a breakpoint in the runtime
loader (rld), more precisely in __dbx_link(). This procedure is
called by rld once all shared libraries have been mapped, but before
- the -init code is executed. Unfortuantely, this is not straightforward,
+ the -init code is executed. Unfortuantely, this is not straightforward,
as rld is not part of the executable we are running, and thus we need
the inferior to run until rld itself has been mapped in memory.
}
#endif /* PRFS_STOPEXEC */
- /* FIXME: should this be done in the parent instead? */
+ /* FIXME: should this be done in the parent instead? */
/* Turn off inherit on fork flag so that all grand-children
of gdb start with tracing flags cleared. */
if (!proc_unset_inherit_on_fork (pi))
proc_warn (pi, "set_exec_trap, unset_RLC", __LINE__);
/* FIXME: No need to destroy the procinfo --
- we have our own address space, and we're about to do an exec! */
+ we have our own address space, and we're about to do an exec! */
/*destroy_procinfo (pi);*/
}
{
procinfo *pi;
- /* Find procinfo for main process */
+ /* Find procinfo for main process. */
pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0);
proc_update_threads (pi);
proc_iterate_over_threads (pi, procfs_notice_thread, NULL);
proc = PIDGET (ptid);
thread = TIDGET (ptid);
- /* If I don't know it, it ain't alive! */
+ /* If I don't know it, it ain't alive! */
if ((pi = find_procinfo (proc, thread)) == NULL)
return 0;
pi = find_procinfo_or_die (PIDGET (ptid) == -1 ?
PIDGET (inferior_ptid) : PIDGET (ptid), 0);
- /* Translate from GDB's flags to /proc's */
- if (len > 0) /* len == 0 means delete watchpoint */
+ /* Translate from GDB's flags to /proc's. */
+ if (len > 0) /* len == 0 means delete watchpoint. */
{
- switch (rwflag) { /* FIXME: need an enum! */
+ switch (rwflag) { /* FIXME: need an enum! */
case hw_write: /* default watchpoint (write) */
pflags = WRITE_WATCHFLAG;
break;
case hw_execute: /* execution HW breakpoint */
pflags = EXEC_WATCHFLAG;
break;
- default: /* Something weird. Return error. */
+ default: /* Something weird. Return error. */
return -1;
}
- if (after) /* Stop after r/w access is completed. */
+ if (after) /* Stop after r/w access is completed. */
pflags |= AFTER_WATCHFLAG;
}
if (!proc_set_watchpoint (pi, addr, len, pflags))
{
- if (errno == E2BIG) /* Typical error for no resources */
+ if (errno == E2BIG) /* Typical error for no resources. */
return -1; /* fail */
/* GDB may try to remove the same watchpoint twice.
If a remove request returns no match, don't error. */
/* Get the number of mappings, allocate space,
and read the mappings into prmaps. */
#ifdef NEW_PROC_API
- /* Open map fd. */
+ /* Open map fd. */
sprintf (pathname, "/proc/%d/map", pi->pid);
if ((map_fd = open (pathname, O_RDONLY)) < 0)
proc_error (pi, "iterate_over_mappings (open)", __LINE__);
- /* Make sure it gets closed again. */
+ /* Make sure it gets closed again. */
make_cleanup_close (map_fd);
/* Use stat to determine the file size, and compute
info_proc_mappings (procinfo *pi, int summary)
{
if (summary)
- return; /* No output for summary mode. */
+ return; /* No output for summary mode. */
printf_filtered (_("Mapped address spaces:\n\n"));
if (gdbarch_ptr_bit (target_gdbarch) == 32)
else
{
/* Have pid, will travel.
- First see if it's a process we're already debugging. */
+ First see if it's a process we're already debugging. */
process = find_procinfo (pid, 0);
if (process == NULL)
{
the set of syscalls that are currently traced/debugged.
If ENTRY_OR_EXIT is set to PR_SYSENTRY, then the entry syscalls set
- will be updated. Otherwise, the exit syscalls set will be updated.
+ will be updated. Otherwise, the exit syscalls set will be updated.
- If MODE is FLAG_SET, then traces will be enabled. Otherwise, they
+ If MODE is FLAG_SET, then traces will be enabled. Otherwise, they
will be disabled. */
static void
/* This part is the old method for fetching registers.
It should be replaced by the newer one using regsets
once it is implemented in this platform:
- gdbarch_regset_from_core_section() and regset->collect_regset(). */
+ gdbarch_regset_from_core_section() and regset->collect_regset(). */
old_chain = save_inferior_ptid ();
inferior_ptid = ptid;
struct objfile *symfile_object_file;
/* All known objfiles are kept in a linked list. This points to
- the head of this list. */
+ the head of this list. */
struct objfile *objfiles;
/* The set of target sections matching the sections mapped into
#define symfile_objfile current_program_space->symfile_object_file
/* All known objfiles are kept in a linked list. This points to the
- root of this list. */
+ root of this list. */
#define object_files current_program_space->objfiles
/* The set of target sections matching the sections mapped into the
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/>. */
#include "defs.h"
#include "gdb_string.h"
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 PROLOGUE_VALUE_H
#define PROLOGUE_VALUE_H
normal symtab once the partial_symtab has been referenced. */
/* This structure is space critical. See space comments at the top of
- symtab.h. */
+ symtab.h. */
struct partial_symbol
{
- /* The general symbol info required for all types of symbols. */
+ /* The general symbol info required for all types of symbols. */
struct general_symbol_info ginfo;
ENUM_BITFIELD(domain_enum_tag) domain : 6;
- /* Address class (for info_symbols) */
+ /* Address class (for info_symbols). */
ENUM_BITFIELD(address_class) aclass : 6;
struct partial_symtab *next;
- /* Name of the source file which this partial_symtab defines */
+ /* Name of the source file which this partial_symtab defines. */
const char *filename;
struct section_offsets *section_offsets;
/* Range of text addresses covered by this file; texthigh is the
- beginning of the next section. */
+ beginning of the next section. */
CORE_ADDR textlow;
CORE_ADDR texthigh;
/* Global symbol list. This list will be sorted after readin to
improve access. Binary search will be the usual method of
- finding a symbol within it. globals_offset is an integer offset
+ finding a symbol within it. globals_offset is an integer offset
within global_psymbols[]. */
int globals_offset;
}
}
- /* Now, search for a matching tail (only if name doesn't have any dirs) */
+ /* Now, search for a matching tail (only if name doesn't have any dirs). */
if (lbasename (name) == name)
ALL_OBJFILE_PSYMTABS (objfile, pst)
we want the partial symbol table that contains the
function containing the PC. */
if (!(objfile->flags & OBJF_REORDERED) &&
- section == 0) /* can't validate section this way */
+ section == 0) /* Can't validate section this way. */
return pst;
if (msymbol == NULL)
/* The code range of partial symtabs sometimes overlap, so, in
the loop below, we need to check all partial symtabs and
- find the one that fits better for the given PC address. We
+ find the one that fits better for the given PC address. We
select the partial symtab that contains a symbol whose
address is closest to the PC address. By closest we mean
that find_pc_sect_symbol returns the symbol with address
necessarily lower or equal to PC, the symbol closer
to PC is the symbol which address is the highest.
This way we return the psymtab which contains such
- best match symbol. This can help in cases where the
+ best match symbol. This can help in cases where the
symbol information/debuginfo is not complete, like
for instance on IRIX6 with gcc, where no debug info
- is emitted for statics. (See also the nodebug.exp
- testcase.) */
+ is emitted for statics. (See also the nodebug.exp
+ testcase.) */
if (this_addr > best_addr)
{
best_addr = this_addr;
gdb_assert (psymtab != NULL);
- /* Cope with programs that start at address 0 */
+ /* Cope with programs that start at address 0. */
best_pc = (psymtab->textlow != 0) ? psymtab->textlow - 1 : 0;
/* Search the global symbols as well as the static symbols, so that
|| (psymtab->textlow == 0
&& best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
{
- if (section) /* match on a specific section */
+ if (section) /* Match on a specific section. */
{
fixup_psymbol_section (p, psymtab->objfile);
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
|| (psymtab->textlow == 0
&& best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
{
- if (section) /* match on a specific section */
+ if (section) /* Match on a specific section. */
{
fixup_psymbol_section (p, psymtab->objfile);
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
pst->objfile->global_psymbols.list + pst->globals_offset :
pst->objfile->static_psymbols.list + pst->statics_offset);
- if (global) /* This means we can use a binary search. */
+ if (global) /* This means we can use a binary search. */
{
do_linear_search = 0;
static struct symtab *
psymtab_to_symtab (struct partial_symtab *pst)
{
- /* If it's been looked up before, return it. */
+ /* If it's been looked up before, return it. */
if (pst->symtab)
return pst->symtab;
fputs_filtered ("undefined domain, ", outfile);
break;
case VAR_DOMAIN:
- /* This is the usual thing -- don't print it */
+ /* This is the usual thing -- don't print it. */
break;
case STRUCT_DOMAIN:
fputs_filtered ("struct domain, ", outfile);
}
/* Look through the partial symtabs for all symbols which begin
- by matching FUNC_NAME. Make sure we read that symbol table in. */
+ by matching FUNC_NAME. Make sure we read that symbol table in. */
static void
read_symtabs_for_function (struct objfile *objfile, const char *func_name)
+ ps->n_global_syms);
psym++)
{
- /* If interrupted, then quit. */
+ /* If interrupted, then quit. */
QUIT;
(*fun) (SYMBOL_NATURAL_NAME (*psym), data);
}
return NULL;
/* Don't check ps->fullname here, the file could have been
- deleted/moved/..., look for it again */
+ deleted/moved/..., look for it again. */
r = find_and_open_source (ps->filename, ps->dirname, &ps->fullname);
if (r >= 0)
bound = gbound;
/* Go through all of the symbols stored in a partial
- symtab in one loop. */
+ symtab in one loop. */
psym = objfile->global_psymbols.list + ps->globals_offset;
while (keep_going)
{
void
sort_pst_symbols (struct partial_symtab *pst)
{
- /* Sort the global list; don't sort the static list */
+ /* Sort the global list; don't sort the static list. */
qsort (pst->objfile->global_psymbols.list + pst->globals_offset,
pst->n_global_syms, sizeof (struct partial_symbol *),
/* Allocate and partially fill a partial symtab. It will be
completely filled at the end of the symbol list.
- FILENAME is the name of the symbol-file we are reading from. */
+ FILENAME is the name of the symbol-file we are reading from. */
struct partial_symtab *
start_psymtab_common (struct objfile *objfile,
/* Calculate a hash code for the given partial symbol. The hash is
calculated using the symbol's value, language, domain, class
- and name. These are the values which are set by
+ and name. These are the values which are set by
add_psymbol_to_bcache. */
static unsigned long
xfree (bcache);
}
-/* Return the internal bcache of the psymbol_bcache BCACHE*/
+/* Return the internal bcache of the psymbol_bcache BCACHE. */
struct bcache *
psymbol_bcache_get_bcache (struct psymbol_bcache *bcache)
entire field. */
memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value));
- /* val and coreaddr are mutually exclusive, one of them *will* be zero */
+ /* val and coreaddr are mutually exclusive, one of them *will* be zero. */
if (val != 0)
{
SYMBOL_VALUE (&psymbol) = val;
SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
- /* Stash the partial symbol away in the cache */
+ /* Stash the partial symbol away in the cache. */
return psymbol_bcache_full (&psymbol,
objfile->psymbol_cache,
added);
}
/* Increase the space allocated for LISTP, which is probably
- global_psymbols or static_psymbols. This space will eventually
+ global_psymbols or static_psymbols. This space will eventually
be freed in free_objfile(). */
static void
new_size * sizeof (struct partial_symbol *));
}
/* Next assumes we only went one over. Should be good if
- program works correctly */
+ program works correctly. */
listp->next = listp->list + listp->size;
listp->size = new_size;
}
int added;
- /* Stash the partial symbol away in the cache */
+ /* Stash the partial symbol away in the cache. */
psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class,
val, coreaddr, language, objfile, &added);
&& !added)
return psym;
- /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
+ /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
append_psymbol_to_list (list, psym, objfile);
return psym;
}
/* Current best guess is that approximately a twentieth
of the total symbols (in a debugging file) are global or static
- oriented symbols */
+ oriented symbols. */
objfile->global_psymbols.size = total_symbols / 10;
objfile->static_psymbols.size = total_symbols / 10;
/* Prepend it to the psymtab list for the objfile it belongs to.
Psymtabs are searched in most recent inserted -> least recent
- inserted order. */
+ inserted order. */
psymtab->objfile = objfile;
psymtab->next = objfile->psymtabs;
nothing else is not empty, but we don't realize that. Fixing
that without slowing things down might be tricky. */
- /* First, snip it out of the psymtab chain */
+ /* First, snip it out of the psymtab chain. */
prev_pst = &(pst->objfile->psymtabs);
while ((*prev_pst) != pst)
prev_pst = &((*prev_pst)->next);
(*prev_pst) = pst->next;
- /* Next, put it on a free list for recycling */
+ /* Next, put it on a free list for recycling. */
pst->next = pst->objfile->free_psymtabs;
pst->objfile->free_psymtabs = pst;
if (argv[0] != NULL)
{
filename = argv[0];
- /* If a second arg is supplied, it is a source file name to match on */
+ /* If a second arg is supplied, it is a source file name to match on. */
if (argv[1] != NULL)
{
symname = argv[1];
static void ravenscar_sparc_prepare_to_store (struct regcache *regcache);
/* Register offsets from a referenced address (exempli gratia the
- Thread_Descriptor). The referenced address depends on the register
- number. The Thread_Descriptor layout and the stack layout are documented
+ Thread_Descriptor). The referenced address depends on the register
+ number. The Thread_Descriptor layout and the stack layout are documented
in the GNAT sources, in sparc-bb.h. */
static const int sparc_register_offsets[] =
static const char known_tasks_name[] = "system__tasking__debug__known_tasks";
-static const char ravenscar_runtime_initializer[] = "system__bb__threads__initialize";
+static const char ravenscar_runtime_initializer[] =
+ "system__bb__threads__initialize";
static struct observer *update_target_observer = NULL;
architectures, just like in remote-wtx-hw.c. However, for now the
only Ravenscar run-time for bare board that is implemented in
GNAT is for only one architecture: erc32-elf. So no need to care about
- that for now...*/
+ that for now... */
current_arch_ops = ops;
}
to_prepare_to_store and to_fetch_registers when the inferior_ptid
is different from the running thread. In that case, the registers
are saved in a architecture-specific location. */
-/* FIXME: only one architecture can be registered for now. See
+/* FIXME: only one architecture can be registered for now. See
implementation. */
extern void ravenscar_register_arch_ops (struct ravenscar_arch_ops *ops);
"record list.\n",
paddress (target_gdbarch, addr), len);
- if (!addr) /* FIXME: Why? Some arch must permit it... */
+ if (!addr) /* FIXME: Why? Some arch must permit it... */
return 0;
rec = record_mem_alloc (addr, len);
*/
/* Per-architecture object describing the layout of a register cache.
- Computed once when the architecture is created */
+ Computed once when the architecture is created. */
struct gdbarch_data *regcache_descr_handle;
current_thread_ptid = null_ptid;
current_thread_arch = NULL;
- /* Need to forget about any frames we have cached, too. */
+ /* Need to forget about any frames we have cached, too. */
reinit_frame_cache ();
/* Force cleanup of any alloca areas if using C alloca instead of
return;
/* If we have a valid copy of the register, and new value == old
- value, then don't bother doing the actual store. */
+ value, then don't bother doing the actual store. */
if (regcache_valid_p (regcache, regnum)
&& (memcmp (register_buffer (regcache, regnum), buf,
regcache->descr->sizeof_register[regnum]) == 0))
/* Something to do? */
if (offset + len == 0)
return;
- /* Read (when needed) ... */
+ /* Read (when needed) ... */
if (in != NULL
|| offset > 0
|| offset + len < descr->sizeof_register[regnum])
gdb_assert (read != NULL);
read (regcache, regnum, reg);
}
- /* ... modify ... */
+ /* ... modify ... */
if (in != NULL)
memcpy (in, reg + offset, len);
if (out != NULL)
extern struct address_space *get_regcache_aspace (const struct regcache *);
/* Transfer a raw register [0..NUM_REGS) between core-gdb and the
- regcache. */
+ regcache. */
void regcache_raw_read (struct regcache *regcache, int rawnum, gdb_byte *buf);
void regcache_raw_write (struct regcache *regcache, int rawnum,
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* See the GDB User Guide for details of the GDB remote protocol. */
+/* See the GDB User Guide for details of the GDB remote protocol. */
#include "defs.h"
#include "gdb_string.h"
if (flags & FILEIO_O_RDWR)
hflags |= O_RDWR;
/* On systems supporting binary and text mode, always open files in
- binary mode. */
+ binary mode. */
#ifdef O_BINARY
hflags |= O_BINARY;
#endif
return 0;
}
-/* Convert to big endian */
+/* Convert to big endian. */
static void
remote_fileio_to_be (LONGEST num, char *buf, int bytes)
{
{
LONGEST blksize;
- /* `st_dev' is set in the calling function */
+ /* `st_dev' is set in the calling function. */
remote_fileio_to_fio_uint ((long) st->st_ino, fst->fst_ino);
remote_fileio_to_fio_mode (st->st_mode, fst->fst_mode);
remote_fileio_to_fio_uint ((long) st->st_nlink, fst->fst_nlink);
/* Wrapper function for remote_write_bytes() which has the disadvantage to
write only one packet, regardless of the requested number of bytes to
- transfer. This wrapper calls remote_write_bytes() as often as needed. */
+ transfer. This wrapper calls remote_write_bytes() as often as needed. */
static int
remote_fileio_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
char *pathname;
struct stat st;
- /* 1. Parameter: Ptr to pathname / length incl. trailing zero */
+ /* 1. Parameter: Ptr to pathname / length incl. trailing zero. */
if (remote_fileio_extract_ptr_w_len (&buf, &ptrval, &length))
{
remote_fileio_ioerror ();
}
mode = remote_fileio_mode_to_host (num, 1);
- /* Request pathname using 'm' packet */
+ /* Request pathname using 'm' packet. */
pathname = alloca (length);
retlength = remote_read_bytes (ptrval, (gdb_byte *) pathname, length);
if (retlength != length)
/* Check if pathname exists and is not a regular file or directory. If so,
return an appropriate error code. Same for trying to open directories
- for writing. */
+ for writing. */
if (!stat (pathname, &st))
{
if (!S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode))
{
new_offset = lseek (fd, 0, SEEK_CUR);
/* If some data has been read, return the number of bytes read.
- The Ctrl-C flag is set in remote_fileio_reply() anyway */
+ The Ctrl-C flag is set in remote_fileio_reply() anyway. */
if (old_offset != new_offset)
ret = new_offset - old_offset;
}
retlength = remote_fileio_write_bytes (ptrval, buffer, ret);
if (retlength != ret)
ret = -1; /* errno has been set to EIO in
- remote_fileio_write_bytes() */
+ remote_fileio_write_bytes(). */
}
if (ret < 0)
ret = write (fd, buffer, length);
if (ret < 0 && errno == EACCES)
errno = EBADF; /* Cygwin returns EACCESS when writing to a
- R/O file.*/
+ R/O file. */
break;
}
return;
}
- /* Only operate on regular files and directories */
+ /* Only operate on regular files and directories. */
of = stat (oldpath, &ost);
nf = stat (newpath, &nst);
if ((!of && !S_ISREG (ost.st_mode) && !S_ISDIR (ost.st_mode))
{
/* Special case: newpath is a non-empty directory. Some systems
return ENOTEMPTY, some return EEXIST. We coerce that to be
- always EEXIST. */
+ always EEXIST. */
if (errno == ENOTEMPTY)
errno = EEXIST;
#ifdef __CYGWIN__
- /* Workaround some Cygwin problems with correct errnos. */
+ /* Workaround some Cygwin problems with correct errnos. */
if (errno == EACCES)
{
if (!of && !nf && S_ISDIR (nst.st_mode))
}
/* Only operate on regular files (and directories, which allows to return
- the correct return code) */
+ the correct return code). */
if (!stat (pathname, &st) && !S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode))
{
remote_fileio_reply (-1, FILEIO_ENODEV);
remote_fileio_return_errno (-1);
return;
}
- /* Only operate on regular files and directories */
+ /* Only operate on regular files and directories. */
if (!ret && !S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode))
{
remote_fileio_reply (-1, FILEIO_EACCES);
return;
}
ptrval = (CORE_ADDR) lnum;
- /* 2. Parameter: some pointer value... */
+ /* 2. Parameter: some pointer value... */
if (remote_fileio_extract_long (&buf, &lnum))
{
remote_fileio_ioerror ();
return;
}
- /* ...which has to be NULL */
+ /* ...which has to be NULL. */
if (lnum)
{
remote_fileio_reply (-1, FILEIO_EINVAL);
for (idx = 0; remote_fio_func_map[idx].name; ++idx)
if (!strcmp (remote_fio_func_map[idx].name, buf))
break;
- if (!remote_fio_func_map[idx].name) /* ERROR: No such function. */
+ if (!remote_fio_func_map[idx].name) /* ERROR: No such function. */
return RETURN_ERROR;
remote_fio_func_map[idx].func (c);
return 0;
}
}
-/* Handle a file I/O request. BUF points to the packet containing the
- request. CTRLC_PENDING_P should be nonzero if the target has not
+/* Handle a file I/O request. BUF points to the packet containing the
+ request. CTRLC_PENDING_P should be nonzero if the target has not
acknowledged the Ctrl-C sent asynchronously earlier. */
void
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* See the GDB User Guide for details of the GDB remote protocol. */
+/* See the GDB User Guide for details of the GDB remote protocol. */
#ifndef REMOTE_FILEIO_H
#define REMOTE_FILEIO_H
struct cmd_list_element;
/* Unified interface to remote fileio, called in remote.c from
- remote_wait () and remote_async_wait () */
+ remote_wait () and remote_async_wait (). */
extern void remote_fileio_request (char *buf, int ctrlc_pending_p);
/* Cleanup any remote fileio state. */
extern void remote_fileio_reset (void);
-/* Called from _initialize_remote () */
+/* Called from _initialize_remote (). */
extern void initialize_remote_fileio (
struct cmd_list_element *remote_set_cmdlist,
struct cmd_list_element *remote_show_cmdlist);
#define SDI_REG_ACC1L 35
-/* Low level communication functions */
+/* Low level communication functions. */
-/* Check an ack packet from the target */
+/* Check an ack packet from the target. */
static int
get_ack (void)
{
return 0;
}
-/* Send data to the target and check an ack packet */
+/* Send data to the target and check an ack packet. */
static int
send_data (void *buf, int len)
{
return len;
}
-/* Receive data from the target */
+/* Receive data from the target. */
static int
recv_data (void *buf, int len)
{
return len;
}
-/* Store unsigned long parameter on packet */
+/* Store unsigned long parameter on packet. */
static void
store_long_parameter (void *buf, long val)
{
}
-/* Check if MMU is on */
+/* Check if MMU is on. */
static void
check_mmu_status (void)
{
unsigned long val;
- /* Read PC address */
+ /* Read PC address. */
if (send_one_arg_cmd (SDI_READ_CPU_REG, SDI_REG_BPC) == -1)
return;
val = recv_long_data ();
return;
}
- /* Read EVB address */
+ /* Read EVB address. */
if (send_one_arg_cmd (SDI_READ_CPU_REG, SDI_REG_EVB) == -1)
return;
val = recv_long_data ();
if (send_cmd (SDI_OPEN) == -1)
error (_("Cannot connect to SDI target."));
- /* Get maximum number of ib breakpoints */
+ /* Get maximum number of ib breakpoints. */
send_one_arg_cmd (SDI_GET_ATTR, SDI_ATTR_BRK);
max_ib_breakpoints = recv_char_data ();
if (remote_debug)
printf_filtered ("Max IB Breakpoints = %d\n", max_ib_breakpoints);
- /* Initialize breakpoints. */
+ /* Initialize breakpoints. */
for (i = 0; i < MAX_BREAKPOINTS; i++)
bp_address[i] = 0xffffffff;
- /* Get maximum number of access breaks. */
+ /* Get maximum number of access breaks. */
send_one_arg_cmd (SDI_GET_ATTR, SDI_ATTR_ABRK);
max_access_breaks = recv_char_data ();
if (remote_debug)
printf_filtered ("Max Access Breaks = %d\n", max_access_breaks);
- /* Initialize access breask. */
+ /* Initialize access breask. */
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
ab_address[i] = 0x00000000;
check_mmu_status ();
- /* Get the name of chip on target board. */
+ /* Get the name of chip on target board. */
send_one_arg_cmd (SDI_GET_ATTR, SDI_ATTR_NAME);
recv_data (chip_name, 64);
chip_name);
}
-/* Close out all files and local state before this target loses control. */
+/* Close out all files and local state before this target loses control. */
static void
m32r_close (int quitting)
fprintf_unfiltered (gdb_stdlog, "pc <= 0x%lx\n", pc_addr);
/* At pc address there is a parallel instruction with +2 offset,
- so we have to make it a serial instruction or avoid it. */
+ so we have to make it a serial instruction or avoid it. */
if (pc_addr == last_pc_addr)
{
- /* Avoid a parallel nop. */
+ /* Avoid a parallel nop. */
if (last_pc_addr_data[0] == 0xf0 && last_pc_addr_data[1] == 0x00)
{
pc_addr += 2;
- /* Now we can forget this instruction. */
+ /* Now we can forget this instruction. */
last_pc_addr = 0xffffffff;
}
- /* Clear a parallel bit. */
+ /* Clear a parallel bit. */
else
{
buf[0] = SDI_WRITE_MEMORY;
}
}
- /* Set PC. */
+ /* Set PC. */
send_two_arg_cmd (SDI_WRITE_CPU_REG, SDI_REG_BPC, pc_addr);
- /* step mode. */
+ /* step mode. */
step_mode = step;
if (step)
{
- /* Set PBP. */
+ /* Set PBP. */
send_two_arg_cmd (SDI_WRITE_CPU_REG, SDI_REG_PBP, pc_addr | 1);
}
else
{
- /* Unset PBP. */
+ /* Unset PBP. */
send_two_arg_cmd (SDI_WRITE_CPU_REG, SDI_REG_PBP, 0x00000000);
}
else
ib_breakpoints = 0;
- /* Set ib breakpoints. */
+ /* Set ib breakpoints. */
for (i = 0; i < ib_breakpoints; i++)
{
bp_addr = bp_address[i];
if (bp_addr == 0xffffffff)
continue;
- /* Set PBP. */
+ /* Set PBP. */
if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8000 + 4 * i, 4,
0x00000006);
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8080 + 4 * i, 4, bp_addr);
}
- /* Set dbt breakpoints. */
+ /* Set dbt breakpoints. */
for (i = ib_breakpoints; i < MAX_BREAKPOINTS; i++)
{
bp_addr = bp_address[i];
if (!mmu_on)
bp_addr &= 0x7fffffff;
- /* Write DBT instruction. */
+ /* Write DBT instruction. */
buf[0] = SDI_WRITE_MEMORY;
store_long_parameter (buf + 1, (bp_addr & 0xfffffffc));
store_long_parameter (buf + 5, 4);
send_data (buf, 13);
}
- /* Set access breaks. */
+ /* Set access breaks. */
for (i = 0; i < max_access_breaks; i++)
{
ab_addr = ab_address[i];
if (ab_addr == 0x00000000)
continue;
- /* DBC register */
+ /* DBC register. */
if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
{
switch (ab_type[i])
}
}
- /* DBAH register */
+ /* DBAH register. */
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8180 + 4 * i, 4, ab_addr);
- /* DBAL register */
+ /* DBAL register. */
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8200 + 4 * i, 4,
0xffffffff);
- /* DBD register */
+ /* DBD register. */
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8280 + 4 * i, 4,
0x00000000);
- /* DBDM register */
+ /* DBDM register. */
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8300 + 4 * i, 4,
0x00000000);
}
- /* Resume program. */
+ /* Resume program. */
send_cmd (SDI_EXEC_CPU);
/* Without this, some commands which require an active target (such as kill)
interrupted = 0;
prev_sigint = signal (SIGINT, gdb_cntrl_c);
- /* Wait for ready */
+ /* Wait for ready. */
buf[0] = SDI_WAIT_FOR_READY;
if (serial_write (sdi_desc, buf, 1) != 0)
error (_("Remote connection closed"));
check_mmu_status ();
- /* Recover parallel bit. */
+ /* Recover parallel bit. */
if (last_pc_addr != 0xffffffff)
{
buf[0] = SDI_WRITE_MEMORY;
else
ib_breakpoints = 0;
- /* Set back pc by 2 if m32r is stopped with dbt. */
+ /* Set back pc by 2 if m32r is stopped with dbt. */
last_pc_addr = 0xffffffff;
send_one_arg_cmd (SDI_READ_CPU_REG, SDI_REG_BPC);
pc_addr = recv_long_data () - 2;
send_two_arg_cmd (SDI_WRITE_CPU_REG, SDI_REG_BPC, pc_addr);
/* If there is a parallel instruction with +2 offset at pc
- address, we have to take care of it later. */
+ address, we have to take care of it later. */
if ((pc_addr & 0x2) != 0)
{
if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
}
}
- /* Remove ib breakpoints. */
+ /* Remove ib breakpoints. */
for (i = 0; i < ib_breakpoints; i++)
{
if (bp_address[i] != 0xffffffff)
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8000 + 4 * i, 4,
0x00000000);
}
- /* Remove dbt breakpoints. */
+ /* Remove dbt breakpoints. */
for (i = ib_breakpoints; i < MAX_BREAKPOINTS; i++)
{
bp_addr = bp_address[i];
}
}
- /* Remove access breaks. */
+ /* Remove access breaks. */
hit_watchpoint_addr = 0;
for (i = 0; i < max_access_breaks; i++)
{
m32r_resume (ops, inferior_ptid, 0, TARGET_SIGNAL_0);
- /* calls m32r_close to do the real work */
+ /* Calls m32r_close to do the real work. */
pop_target ();
if (from_tty)
fprintf_unfiltered (gdb_stdlog, "Ending remote %s debugging\n",
target_shortname);
}
-/* Return the id of register number REGNO. */
+/* Return the id of register number REGNO. */
static int
get_reg_id (int regno)
static void
m32r_prepare_to_store (struct regcache *regcache)
{
- /* Do nothing, since we can store individual regs */
+ /* Do nothing, since we can store individual regs. */
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "m32r_prepare_to_store()\n");
}
int quiet;
int nostart;
struct timeval start_time, end_time;
- unsigned long data_count; /* Number of bytes transferred to memory */
+ unsigned long data_count; /* Number of bytes transferred to memory. */
int ret;
static RETSIGTYPE (*prev_sigint) ();
- /* for direct tcp connections, we can do a fast binary download */
+ /* for direct tcp connections, we can do a fast binary download. */
quiet = 0;
nostart = 0;
filename = NULL;
gettimeofday (&end_time, NULL);
- /* Make the PC point at the start address */
+ /* 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. */
delete_thread_silent (remote_m32r_ptid);
/* 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... */
+ and things would get horribly confused... */
clear_symtab_users (0);
/* Set a data watchpoint. ADDR and LEN should be obvious. TYPE is 0
for a write watchpoint, 1 for a read watchpoint, or 2 for a read/write
- watchpoint. */
+ watchpoint. */
static int
m32r_insert_watchpoint (CORE_ADDR addr, int len, int type,
return 1;
}
-/* Define the target subroutine names */
+/* Define the target subroutine names. */
struct target_ops m32r_ops;
init_m32r_ops ();
- /* Initialize breakpoints. */
+ /* Initialize breakpoints. */
for (i = 0; i < MAX_BREAKPOINTS; i++)
bp_address[i] = 0xffffffff;
- /* Initialize access breaks. */
+ /* Initialize access breaks. */
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
ab_address[i] = 0x00000000;
/* IDT/SIM monitor being used: */
MON_IDT,
/* PMON monitor being used: */
- MON_PMON, /* 3.0.83 [COGENT,EB,FP,NET] Algorithmics Ltd. Nov 9 1995 17:19:50 */
- MON_DDB, /* 2.7.473 [DDBVR4300,EL,FP,NET] Risq Modular Systems, Thu Jun 6 09:28:40 PDT 1996 */
- MON_LSI, /* 4.3.12 [EB,FP], LSI LOGIC Corp. Tue Feb 25 13:22:14 1997 */
+ MON_PMON, /* 3.0.83 [COGENT,EB,FP,NET]
+ Algorithmics Ltd. Nov 9 1995 17:19:50 */
+ MON_DDB, /* 2.7.473 [DDBVR4300,EL,FP,NET]
+ Risq Modular Systems,
+ Thu Jun 6 09:28:40 PDT 1996 */
+ MON_LSI, /* 4.3.12 [EB,FP],
+ LSI LOGIC Corp. Tue Feb 25 13:22:14 1997 */
MON_ROCKHOPPER,
- /* Last and unused value, for sizing vectors, etc. */
+ /* Last and unused value, for sizing vectors, etc. */
MON_LAST
};
static enum mips_monitor_type mips_monitor = MON_LAST;
/* Set to 1 if the target is open. */
static int mips_is_open;
-/* Currently active target description (if mips_is_open == 1) */
+/* Currently active target description (if mips_is_open == 1). */
static struct target_ops *current_ops;
/* Set to 1 while the connection is being initialized. */
via ^C. */
static int interrupt_count;
-/* If non-zero, means that the target is running. */
+/* If non-zero, means that the target is running. */
static int mips_wait_flag = 0;
-/* If non-zero, monitor supports breakpoint commands. */
+/* If non-zero, monitor supports breakpoint commands. */
static int monitor_supports_breakpoints = 0;
/* Data cache header. */
-#if 0 /* not used (yet?) */
+#if 0 /* not used (yet?) */
static DCACHE *mips_dcache;
#endif
-/* Non-zero means that we've just hit a read or write watchpoint */
+/* Non-zero means that we've just hit a read or write watchpoint. */
static int hit_watchpoint;
/* Table of breakpoints/watchpoints (used only on LSI PMON target).
The table is indexed by a breakpoint number, which is an integer
- from 0 to 255 returned by the LSI PMON when a breakpoint is set.
- */
+ from 0 to 255 returned by the LSI PMON when a breakpoint is set. */
+
#define MAX_LSI_BREAKPOINTS 256
struct lsi_breakpoint_info
{
/* Error/warning codes returned by LSI PMON for breakpoint commands.
Warning values may be ORed together; error values may not. */
-#define W_WARN 0x100 /* This bit is set if the error code is a warning */
-#define W_MSK 0x101 /* warning: Range feature is supported via mask */
-#define W_VAL 0x102 /* warning: Value check is not supported in hardware */
-#define W_QAL 0x104 /* warning: Requested qualifiers are not supported in hardware */
-
-#define E_ERR 0x200 /* This bit is set if the error code is an error */
+#define W_WARN 0x100 /* This bit is set if the error code
+ is a warning */
+#define W_MSK 0x101 /* warning: Range feature is supported
+ via mask */
+#define W_VAL 0x102 /* warning: Value check is not
+ supported in hardware */
+#define W_QAL 0x104 /* warning: Requested qualifiers are
+ not supported in hardware */
+
+#define E_ERR 0x200 /* This bit is set if the error code
+ is an error */
#define E_BPT 0x200 /* error: No such breakpoint number */
#define E_RGE 0x201 /* error: Range is not supported */
-#define E_QAL 0x202 /* error: The requested qualifiers can not be used */
+#define E_QAL 0x202 /* error: The requested qualifiers can
+ not be used */
#define E_OUT 0x203 /* error: Out of hardware resources */
#define E_NON 0x204 /* error: Hardware breakpoint not supported */
va_start (args, string);
target_terminal_ours ();
- wrap_here (""); /* Force out any buffered output */
+ wrap_here (""); /* Force out any buffered output. */
gdb_flush (gdb_stdout);
if (error_pre_print)
fputs_filtered (error_pre_print, gdb_stderr);
/* Wait until STRING shows up in mips_desc. Returns 1 if successful, else 0 if
- timed out. TIMEOUT specifies timeout value in seconds.
- */
+ timed out. TIMEOUT specifies timeout value in seconds. */
static int
mips_expect_timeout (const char *string, int timeout)
int c;
/* Must use serial_readchar() here cuz mips_readchar would get
- confused if we were waiting for the mips_monitor_prompt... */
+ confused if we were waiting for the mips_monitor_prompt... */
c = serial_readchar (mips_desc, timeout);
/* Wait until STRING shows up in mips_desc. Returns 1 if successful, else 0 if
timed out. The timeout value is hard-coded to 2 seconds. Use
- mips_expect_timeout if a different timeout value is needed.
- */
+ mips_expect_timeout if a different timeout value is needed. */
static int
mips_expect (const char *string)
static int state = 0;
int mips_monitor_prompt_len = strlen (mips_monitor_prompt);
- { /* FIXME this whole block is dead code! */
+ { /* FIXME this whole block is dead code! */
int i;
i = timeout;
timeout = 1;
ch = serial_readchar (mips_desc, timeout);
- if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off */
+ if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off. */
{
target_mourn_inferior ();
error ("Watchdog has expired. Target detached.\n");
if (remote_debug > 0)
/* Don't use _filtered; we can't deal with a QUIT out of
target_wait, and I think this might be called from there. */
- fprintf_unfiltered (gdb_stdlog, "Reinitializing MIPS debugging mode\n");
+ fprintf_unfiltered (gdb_stdlog,
+ "Reinitializing MIPS debugging mode\n");
mips_need_reply = 0;
mips_initialize ();
state = 0;
/* At this point, about the only thing we can do is abort the command
- in progress and get back to command level as quickly as possible. */
+ in progress and get back to command level as quickly as possible. */
error ("Remote board reset, debug protocol re-initialized.");
}
what the program is outputting, if the debugging is
being done on the console port. Don't use _filtered:
we can't deal with a QUIT out of target_wait and
- buffered target output confuses the user. */
+ buffered target output confuses the user. */
if (!mips_initializing || remote_debug > 0)
{
if (isprint (ch) || isspace (ch))
gdb_flush (gdb_stdtarg);
}
- /* Only count unprintable characters. */
+ /* Only count unprintable characters. */
if (! (isprint (ch) || isspace (ch)))
(*pgarbage) += 1;
if (mips_syn_garbage > 0
&& *pgarbage > mips_syn_garbage)
- mips_error ("Debug protocol failure: more than %d characters before a sync.",
+ mips_error ("Debug protocol failure: more "
+ "than %d characters before a sync.",
mips_syn_garbage);
}
}
for success, -1 for timeout, -2 for error. */
static int
-mips_receive_trailer (unsigned char *trlr, int *pgarbage, int *pch, int timeout)
+mips_receive_trailer (unsigned char *trlr, int *pgarbage,
+ int *pch, int timeout)
{
int i;
int ch;
int i;
/* Ignore any errors raised whilst attempting to ignore
- packet. */
+ packet. */
len = HDR_GET_LEN (hdr);
}
if (rch == SERIAL_TIMEOUT)
break;
- /* ignore the character */
+ /* Ignore the character. */
}
if (i == len)
remote_timeout);
/* We don't bother checking the checksum, or providing an
- ACK to the packet. */
+ ACK to the packet. */
continue;
}
if (len == 0)
{
/* Ignore the error condition, since we are going to
- ignore the packet anyway. */
+ ignore the packet anyway. */
(void) mips_receive_trailer (trlr, &garbage, &ch, timeout);
}
/* Don't use _filtered; we can't deal with a QUIT out of
{
if (mips_need_reply)
internal_error (__FILE__, __LINE__,
- _("mips_request: Trying to send command before reply"));
+ _("mips_request: Trying to send "
+ "command before reply"));
/* 'T' sets a register to a 64-bit value, so make sure we use
the right conversion function. */
if (cmd == 'T')
if (mips_monitor != MON_IDT)
mips_send_command ("debug\r", 0);
- else /* assume IDT monitor by default */
+ else /* Assume IDT monitor by default. */
mips_send_command ("db tty0\r", 0);
sleep (1);
/* We don't need to absorb any spurious characters here, since the
mips_receive_header will eat up a reasonable number of characters
whilst looking for the SYN, however this avoids the "garbage"
- being displayed to the user. */
+ being displayed to the user. */
if (mips_monitor != MON_IDT)
mips_expect ("\r");
/* Force the system into the monitor. After this we *should* be at
the mips_monitor_prompt. */
if (mips_monitor != MON_IDT)
- j = 0; /* start by checking if we are already at the prompt */
+ j = 0; /* Start by checking if we are already
+ at the prompt. */
else
- j = 1; /* start by sending a break */
+ j = 1; /* Start by sending a break. */
for (; j <= 4; j++)
{
switch (j)
{
- case 0: /* First, try sending a CR */
+ case 0: /* First, try sending a CR. */
serial_flush_input (mips_desc);
serial_write (mips_desc, "\r", 1);
break;
- case 1: /* First, try sending a break */
+ case 1: /* First, try sending a break. */
serial_send_break (mips_desc);
break;
- case 2: /* Then, try a ^C */
+ case 2: /* Then, try a ^C. */
serial_write (mips_desc, "\003", 1);
break;
- case 3: /* Then, try escaping from download */
+ case 3: /* Then, try escaping from download. */
{
if (mips_monitor != MON_IDT)
{
/* We shouldn't need to send multiple termination
sequences, since the target performs line (or
block) reads, and then processes those
- packets. In-case we were downloading a large packet
+ packets. In-case we were downloading a large packet
we flush the output buffer before inserting a
- termination sequence. */
+ termination sequence. */
serial_flush_output (mips_desc);
sprintf (tbuff, "\r/E/E\r");
serial_write (mips_desc, tbuff, 6);
out is to send enough termination packets (8 bytes)
to fill up and then overflow the largest size
S-record (255 bytes in this case). This amounts to
- 256/8 + 1 packets.
- */
+ 256/8 + 1 packets. */
mips_make_srec (srec, '7', 0, NULL, 0);
if (serial_readchar (mips_desc, 0) >= 0)
break; /* Break immediatly if we get something from
- the board. */
+ the board. */
}
}
}
/* Delete all the current breakpoints: */
mips_send_command ("db *\r", -1);
/* NOTE: PMON does not have breakpoint support through the
- "debug" mode, only at the monitor command-line. */
+ "debug" mode, only at the monitor command-line. */
}
mips_enter_debug ();
char **argv;
if (name == 0)
- error (
- "To open a MIPS remote debugging connection, you need to specify what serial\n\
-device is attached to the target board (e.g., /dev/ttya).\n"
- "If you want to use TFTP to download to the board, specify the name of a\n"
- "temporary file to be used by GDB for downloads as the second argument.\n"
- "This filename must be in the form host:filename, where host is the name\n"
- "of the host running the TFTP server, and the file must be readable by the\n"
- "world. If the local name of the temporary file differs from the name as\n"
- "seen from the board via TFTP, specify that name as the third parameter.\n");
+ error (_("\
+To open a MIPS remote debugging connection, you need to specify what\n\
+serial device is attached to the target board (e.g., /dev/ttya).\n\
+If you want to use TFTP to download to the board, specify the name of a\n\
+temporary file to be used by GDB for downloads as the second argument.\n\
+This filename must be in the form host:filename, where host is the name\n\
+of the host running the TFTP server, and the file must be readable by the\n\
+world. If the local name of the temporary file differs from the name as\n\
+seen from the board via TFTP, specify that name as the third parameter.\n"));
/* Parse the serial port name, the optional TFTP name, and the
optional local TFTP name. */
make_cleanup_freeargv (argv);
serial_port_name = xstrdup (argv[0]);
- if (argv[1]) /* remote TFTP name specified? */
+ if (argv[1]) /* Remote TFTP name specified? */
{
remote_name = argv[1];
- if (argv[2]) /* local TFTP filename specified? */
+ if (argv[2]) /* Local TFTP filename specified? */
local_name = argv[2];
}
xfree (tftp_localname);
if (local_name == NULL)
if ((local_name = strchr (remote_name, ':')) != NULL)
- local_name++; /* skip over the colon */
+ local_name++; /* Skip over the colon. */
if (local_name == NULL)
- local_name = remote_name; /* local name same as remote name */
+ local_name = remote_name; /* Local name same as remote name. */
tftp_name = xstrdup (remote_name);
tftp_localname = xstrdup (local_name);
tftp_in_use = 1;
/* On returning from a continue, the PMON monitor seems to start
echoing back the messages we send prior to sending back the
- ACK. The code can cope with this, but to try and avoid the
+ ACK. The code can cope with this, but to try and avoid the
unnecessary serial traffic, and "spurious" characters displayed
- to the user, we cheat and reset the debug protocol. The problems
+ to the user, we cheat and reset the debug protocol. The problems
seems to be caused by a check on the number of arguments, and the
command length, within the monitor causing it to echo the command
- as a bad packet. */
+ as a bad packet. */
if (mips_monitor == MON_PMON)
{
mips_exit_debug ();
mips_enter_debug ();
}
- /* See if we got back extended status. If so, pick out the pc, fp, sp, etc... */
+ /* See if we got back extended status. If so, pick out the pc, fp,
+ sp, etc... */
- nfields = sscanf (buff, "0x%*x %*c 0x%*x 0x%*x 0x%16s 0x%16s 0x%16s 0x%*x %s",
+ nfields = sscanf (buff,
+ "0x%*x %*c 0x%*x 0x%*x 0x%16s 0x%16s 0x%16s 0x%*x %s",
pc_string, fp_string, sp_string, flags);
if (nfields >= 3
&& read_hex_value (pc_string, &rpc)
if (strcmp (target_shortname, "lsi") == 0)
{
#if 0
- /* If this is an LSI PMON target, see if we just hit a hardrdware watchpoint.
- Right now, PMON doesn't give us enough information to determine which
- breakpoint we hit. So we have to look up the PC in our own table
- of breakpoints, and if found, assume it's just a normal instruction
- fetch breakpoint, not a data watchpoint. FIXME when PMON
- provides some way to tell us what type of breakpoint it is. */
+ /* If this is an LSI PMON target, see if we just hit a
+ hardrdware watchpoint. Right now, PMON doesn't give us
+ enough information to determine which breakpoint we hit. So
+ we have to look up the PC in our own table of breakpoints,
+ and if found, assume it's just a normal instruction fetch
+ breakpoint, not a data watchpoint. FIXME when PMON provides
+ some way to tell us what type of breakpoint it is. */
int i;
CORE_ADDR pc = regcache_read_pc (get_current_regcache ());
else
{
/* Unfortunately the PMON version in the Vr4300 board has been
- compiled without the 64bit register access commands. This
- means we cannot get hold of the full register width. */
+ compiled without the 64bit register access commands. This
+ means we cannot get hold of the full register width. */
if (mips_monitor == MON_DDB || mips_monitor == MON_ROCKHOPPER)
val = mips_request ('t', pmon_reg, 0,
&err, mips_receive_wait, NULL);
success. If OLD_CONTENTS is non-NULL, put the old contents of that
memory location there. */
-/* FIXME! make sure only 32-bit quantities get stored! */
+/* FIXME! make sure only 32-bit quantities get stored! */
static int
mips_store_word (CORE_ADDR addr, unsigned int val, int *old_contents)
{
int status;
/* PMON targets do not cope well with 64 bit addresses. Mask the
- value down to 32 bits. */
+ value down to 32 bits. */
if (mask_address_p)
memaddr &= (CORE_ADDR) 0xffffffff;
if (mips_fetch_word (addr + (count - 1) * 4, &val))
return 0;
- store_unsigned_integer (&buffer[(count - 1) * 4], 4, byte_order, val);
+ store_unsigned_integer (&buffer[(count - 1) * 4],
+ 4, byte_order, val);
}
- /* Copy data to be written over corresponding part of buffer */
+ /* Copy data to be written over corresponding part of buffer. */
memcpy ((char *) buffer + (memaddr & 3), myaddr, len);
word = extract_unsigned_integer (&buffer[i * 4], 4, byte_order);
status = mips_store_word (addr, word, NULL);
- /* Report each kilobyte (we download 32-bit words at a time) */
+ /* Report each kilobyte (we download 32-bit words at a time). */
if (i % 256 == 255)
{
printf_unfiltered ("*");
}
else
{
- /* Read all the longwords */
+ /* Read all the longwords. */
for (i = 0; i < count; i++, addr += 4)
{
unsigned int val;
if (query (_("Interrupted while waiting for the program.\n\
Give up (and stop debugging it)? ")))
{
- /* Clean up in such a way that mips_close won't try to talk to the
- board (it almost surely won't work since we weren't able to talk to
- it). */
+ /* Clean up in such a way that mips_close won't try to talk
+ to the board (it almost surely won't work since we
+ weren't able to talk to it). */
mips_wait_flag = 0;
close_ports ();
/* Set a data watchpoint. ADDR and LEN should be obvious. TYPE is 0
for a write watchpoint, 1 for a read watchpoint, or 2 for a read/write
- watchpoint. */
+ watchpoint. */
int
mips_insert_watchpoint (CORE_ADDR addr, int len, int type,
command. If there's no error, just return 0. If it's a warning,
print the warning text and return 0. If it's an error, print
the error text and return 1. <ADDR> is the address of the breakpoint
- that was being set. <RERRFLG> is the error code returned by PMON.
+ that was being set. <RERRFLG> is the error code returned by PMON.
This is a helper function for mips_common_breakpoint. */
static int
succesful completion, other values indicate various
errors and warnings.
- Possible return codes: OK, W_QAL, E_QAL, E_OUT, E_NON.
-
- */
+ Possible return codes: OK, W_QAL, E_QAL, E_OUT, E_NON. */
if (type == BREAK_FETCH) /* instruction breakpoint */
{
/* On non-LSI targets, the breakpoint command has this form:
0x0 <CMD> <ADDR> <MASK> <FLAGS>
<MASK> is a don't care mask for addresses.
- <FLAGS> is any combination of `r', `w', or `f' for read/write/fetch.
- */
+ <FLAGS> is any combination of `r', `w', or `f' for
+ read/write/fetch. */
+
unsigned long mask;
mask = calculate_mask (addr, len);
flags = "f";
break;
default:
- internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
+ internal_error (__FILE__, __LINE__,
+ _("failed internal consistency check"));
}
cmd = 'B';
case 0x6: /* ACK */
return;
case 0x15: /* NACK */
- fprintf_unfiltered (gdb_stderr, "Download got a NACK at byte %s! Retrying.\n",
+ fprintf_unfiltered (gdb_stderr,
+ "Download got a NACK at byte %s! Retrying.\n",
paddress (target_gdbarch, addr));
continue;
default:
}
}
-/* Download a binary file by converting it to S records. */
+/* Download a binary file by converting it to S records. */
static void
mips_load_srec (char *args)
{
unsigned int numbytes;
- /* FIXME! vma too small????? */
+ /* FIXME! vma too small????? */
printf_filtered ("%s\t: 0x%4lx .. 0x%4lx ", s->name,
(long) s->vma,
(long) (s->vma + bfd_get_section_size (s)));
}
/*
- * mips_make_srec -- make an srecord. This writes each line, one at a
+ * mips_make_srec -- make an srecord. This writes each line, one at a
* time, each with it's own header and trailer line.
* An srecord looks like this:
*
*
* Where
* - length
- * is the number of bytes following upto the checksum. Note that
+ * is the number of bytes following upto the checksum. Note that
* this is not the number of chars following, since it takes two
* chars to represent a byte.
* - type
unsigned char checksum;
int i;
- /* Create the header for the srec. addr_size is the number of bytes in the address,
- and 1 is the number of bytes in the count. */
+ /* Create the header for the srec. addr_size is the number of bytes
+ in the address, and 1 is the number of bytes in the count. */
- /* FIXME!! bigger buf required for 64-bit! */
+ /* FIXME!! bigger buf required for 64-bit! */
buf[0] = 'S';
buf[1] = type;
buf[2] = len + 4 + 1; /* len + 4 byte address + 1 byte checksum */
- /* This assumes S3 style downloads (4byte addresses). There should
+ /* This assumes S3 style downloads (4byte addresses). There should
probably be a check, or the code changed to make it more
- explicit. */
+ explicit. */
buf[3] = memaddr >> 24;
buf[4] = memaddr >> 16;
buf[5] = memaddr >> 8;
hexified data. It includes the length, address and the data
portions of the packet. */
checksum = 0;
- buf += 2; /* Point at length byte */
+ buf += 2; /* Point at length byte. */
for (i = 0; i < len + 4 + 1; i++)
checksum += *buf++;
}
/* The following manifest controls whether we enable the simple flow
- control support provided by the monitor. If enabled the code will
- wait for an affirmative ACK between transmitting packets. */
+ control support provided by the monitor. If enabled the code will
+ wait for an affirmative ACK between transmitting packets. */
#define DOETXACK (1)
/* The PMON fast-download uses an encoded packet format constructed of
'K' clear checksum
'C' compare checksum (12bit value, not included in checksum calculation)
- 'S' define symbol name (for addr) terminated with "," and padded to 4char boundary
+ 'S' define symbol name (for addr) terminated with ","
+ and padded to 4char boundary
'Z' zero fill multiple of 3bytes
'B' byte (12bit encoded value, of 8bit data)
'A' address (36bit encoded value)
The encoding of numbers is done in 6bit fields. The 6bit value is
used to index into this string to get the specific character
encoding for the value: */
-static char encoding[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.";
+static char encoding[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.";
/* Convert the number of bits required into an encoded number, 6bits
at a time (range 0..63). Keep a checksum if required (passed
- pointer non-NULL). The function returns the number of encoded
- characters written into the buffer. */
+ pointer non-NULL). The function returns the number of encoded
+ characters written into the buffer. */
static int
pmon_makeb64 (unsigned long v, char *p, int n, int *chksum)
if ((n % 12) != 0)
{
fprintf_unfiltered (gdb_stderr,
- "Fast encoding bitcount must be a multiple of 12bits: %dbit%s\n", n, (n == 1) ? "" : "s");
+ "Fast encoding bitcount must be a "
+ "multiple of 12bits: %dbit%s\n",
+ n, (n == 1) ? "" : "s");
return (0);
}
if (n > 36)
{
fprintf_unfiltered (gdb_stderr,
- "Fast encoding cannot process more than 36bits at the moment: %dbits\n", n);
+ "Fast encoding cannot process more "
+ "than 36bits at the moment: %dbits\n", n);
return (0);
}
}
/* Shorthand function (that could be in-lined) to output the zero-fill
- escape sequence into the data stream. */
+ escape sequence into the data stream. */
static int
pmon_zeroset (int recsize, char **buff, int *amount, unsigned int *chksum)
Return the total size of the record after adding the checksum escape,
the checksum itself, and the trailing newline.
- The checksum specified by *VALUE is zeroed out prior to returning.
+ The checksum specified by *VALUE is zeroed out prior to returning.
Additionally, *BUF is updated to refer to the location just beyond
the record elements added by this call. */
count = pmon_makeb64 (*value, (*buff + 2), 12, NULL);
*buff += (count + 2);
sprintf (*buff, "\n");
- *buff += 2; /* include zero terminator */
+ *buff += 2; /* Include zero terminator. */
/* Forcing a checksum validation clears the sum: */
*value = 0;
return (recsize + count + 3);
/* Amount of padding we leave after at the end of the output buffer,
for the checksum and line termination characters: */
#define CHECKSIZE (4 + 4 + 4 + 2)
-/* zero-fill, checksum, transfer end and line termination space. */
+/* zero-fill, checksum, transfer end and line termination space. */
/* The amount of binary data loaded from the object file in a single
operation: */
/* Maximum line of data accepted by the monitor: */
#define MAXRECSIZE (550)
-/* NOTE: This constant depends on the monitor being used. This value
- is for PMON 5.x on the Cogent Vr4300 board. */
+/* NOTE: This constant depends on the monitor being used. This value
+ is for PMON 5.x on the Cogent Vr4300 board. */
/* Create a FastLoad format record.
char *p = *outbuf;
/* This is a simple check to ensure that our data will fit within
- the maximum allowable record size. Each record output is 4bytes
- in length. We must allow space for a pending zero fill command,
- the record, and a checksum record. */
+ the maximum allowable record size. Each record output is 4bytes
+ in length. We must allow space for a pending zero fill command,
+ the record, and a checksum record. */
while ((*recsize < (MAXRECSIZE - CHECKSIZE)) && ((inamount - *inptr) > 0))
{
/* Process the binary data: */
}
else
{
- unsigned int value = ((inbuf[*inptr + 0] << 16) | (inbuf[*inptr + 1] << 8) | inbuf[*inptr + 2]);
+ unsigned int value = ((inbuf[*inptr + 0] << 16)
+ | (inbuf[*inptr + 1] << 8)
+ | (inbuf[*inptr + 2]));
- /* Simple check for zero data. TODO: A better check would be
+ /* Simple check for zero data. TODO: A better check would be
to check the last, and then the middle byte for being zero
- (if the first byte is not). We could then check for
+ (if the first byte is not). We could then check for
following runs of zeros, and if above a certain size it is
worth the 4 or 8 character hit of the byte insertions used
- to pad to the start of the zeroes. NOTE: This also depends
- on the alignment at the end of the zero run. */
+ to pad to the start of the zeroes. NOTE: This also depends
+ on the alignment at the end of the zero run. */
if (value == 0x00000000)
{
(*zerofill)++;
{
fprintf_unfiltered (gdb_stderr,
"Failed to receive valid ACK for %s\n", mesg);
- return (-1); /* terminate the download */
+ return (-1); /* Terminate the download. */
}
}
#endif /* DOETXACK */
{
fprintf_unfiltered (gdb_stderr, "Load did not complete successfully.\n");
if (tftp_in_use)
- remove (tftp_localname); /* Remove temporary file */
+ remove (tftp_localname); /* Remove temporary file. */
return 0;
}
else
static void
pmon_check_entry_address (char *entry_address, int final)
{
- char hexnumber[9]; /* includes '\0' space */
+ char hexnumber[9]; /* Includes '\0' space. */
mips_expect_timeout (entry_address, tftp_in_use ? 15 : remote_timeout);
sprintf (hexnumber, "%x", final);
static int
pmon_check_total (int bintotal)
{
- char hexnumber[9]; /* includes '\0' space */
+ char hexnumber[9]; /* Includes '\0' space. */
mips_expect ("\r\ntotal = 0x");
sprintf (hexnumber, "%x", bintotal);
static void
pmon_end_download (int final, int bintotal)
{
- char hexnumber[9]; /* includes '\0' space */
+ char hexnumber[9]; /* Includes '\0' space. */
if (tftp_in_use)
{
/* Wait for the stuff that PMON prints after the load has completed.
The timeout value for use in the tftp case (15 seconds) was picked
- arbitrarily but might be too small for really large downloads. FIXME. */
+ arbitrarily but might be too small for really large downloads. FIXME. */
switch (mips_monitor)
{
case MON_LSI:
}
if (tftp_in_use)
- remove (tftp_localname); /* Remove temporary file */
+ remove (tftp_localname); /* Remove temporary file. */
}
/* Write the buffer specified by BUFFER of length LENGTH to either
mips_send_command ("set dlproto etxack\r", -1);
mips_send_command ("set dlecho off\r", -1);
/* NOTE: We get a "cannot set variable" message if the variable is
- already defined to have the argument we give. The code doesn't
- care, since it just scans to the next prompt anyway. */
+ already defined to have the argument we give. The code doesn't
+ care, since it just scans to the next prompt anyway. */
/* Start the download: */
pmon_start_download ();
- /* Zero the checksum */
+ /* Zero the checksum. */
sprintf (buffer, "/Kxx\n");
reclen = strlen (buffer);
pmon_download (buffer, reclen);
finished = pmon_check_ack ("/Kxx");
for (s = abfd->sections; s && !finished; s = s->next)
- if (s->flags & SEC_LOAD) /* only deal with loadable sections */
+ if (s->flags & SEC_LOAD) /* Only deal with loadable sections. */
{
bintotal += bfd_get_section_size (s);
final = (s->vma + bfd_get_section_size (s));
- printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name, (unsigned int) s->vma,
+ printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name,
+ (unsigned int) s->vma,
(unsigned int) (s->vma + bfd_get_section_size (s)));
gdb_flush (gdb_stdout);
- /* Output the starting address */
+ /* Output the starting address. */
sprintf (buffer, "/A");
reclen = pmon_makeb64 (s->vma, &buffer[2], 36, &csum);
buffer[2 + reclen] = '\n';
buffer[3 + reclen] = '\0';
- reclen += 3; /* for the initial escape code and carriage return */
+ reclen += 3; /* For the initial escape code and carriage return. */
pmon_download (buffer, reclen);
finished = pmon_check_ack ("/A");
finished = pmon_check_ack ("data record");
if (finished)
{
- zerofill = 0; /* do not transmit pending zerofills */
+ zerofill = 0; /* Do not transmit pending
+ zerofills. */
break;
}
putchar_unfiltered ('\n');
}
- /* Terminate the transfer. We know that we have an empty output
- buffer at this point. */
- sprintf (buffer, "/E/E\n"); /* include dummy padding characters */
+ /* Terminate the transfer. We know that we have an empty output
+ buffer at this point. */
+ sprintf (buffer, "/E/E\n"); /* Include dummy padding characters. */
reclen = strlen (buffer);
pmon_download (buffer, reclen);
return;
}
-/* mips_load -- download a file. */
+/* mips_load -- download a file. */
static void
mips_load (char *file, int from_tty)
mips_initialize ();
- /* Finally, make the PC point at the start address */
+ /* Finally, make the PC point at the start address. */
regcache = get_current_regcache ();
if (mips_monitor != MON_IDT)
{
/* Work around problem where PMON monitor updates the PC after a load
- to a different value than GDB thinks it has. The following ensures
+ to a different value than GDB thinks it has. The following ensures
that the regcache_write_pc() WILL update the PC value: */
regcache_invalidate (regcache,
mips_regnum (get_regcache_arch (regcache))->pc);
printf_filtered ("Received packet: %s\n", buf);
}
\f
-extern initialize_file_ftype _initialize_remote_mips; /* -Wmissing-prototypes */
+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_remote_mips;
/* Initialize mips_ops, lsi_ops, ddb_ops, pmon_ops, and rockhopper_ops.
Create target specific commands and perform other initializations
static int gdb_os_poll_quit (host_callback *);
-/* printf_filtered is depreciated */
+/* printf_filtered is depreciated. */
static void gdb_os_printf_filtered (host_callback *, const char *, ...);
static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list);
&& nr_bytes != register_size (gdbarch, regno) && warn_user)
{
fprintf_unfiltered (gdb_stderr,
- "Size of register %s (%d/%d) incorrect (%d instead of %d))",
+ "Size of register %s (%d/%d) "
+ "incorrect (%d instead of %d))",
gdbarch_register_name (gdbarch, regno),
regno,
gdbarch_register_sim_regno
error (_("unable to load program"));
/* FIXME: If a load command should reset the targets registers then
- a call to sim_create_inferior() should go here. */
+ a call to sim_create_inferior() should go here. */
sim_data->program_loaded = 1;
}
inferior_appeared (current_inferior (), ptid_get_pid (inferior_ptid));
add_thread_silent (inferior_ptid);
- insert_breakpoints (); /* Needed to get correct instruction in cache */
+ insert_breakpoints (); /* Needed to get correct instruction
+ in cache. */
clear_proceed_status ();
}
/* The open routine takes the rest of the parameters from the command,
and (if successful) pushes a new target onto the stack.
Targets should supply this routine, if only to provide an error message. */
-/* Called when selecting the simulator. EG: (gdb) target sim name. */
+/* Called when selecting the simulator. E.g. (gdb) target sim name. */
static void
gdbsim_open (char *args, int from_tty)
arg_buf = (char *) alloca (len);
strcpy (arg_buf, "gdbsim"); /* 7 */
/* Specify the byte order for the target when it is explicitly
- specified by the user (not auto detected). */
+ specified by the user (not auto detected). */
switch (selected_byte_order ())
{
case BFD_ENDIAN_BIG:
/* Allocate the inferior data, but do not allocate a sim instance
since we've already just done that. */
- sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
+ sim_data = get_sim_inferior_data (current_inferior (),
+ SIM_INSTANCE_NOT_NEEDED);
sim_data->gdbsim_desc = gdbsim_desc;
set_inferior_data (inf, sim_inferior_data_key, NULL);
/* Having a ptid allocated and stored in remote_sim_ptid does
- not mean that a corresponding inferior was ever created.
+ not mean that a corresponding inferior was ever created.
Thus we need to verify the existence of an inferior using the
pid in question before setting inferior_ptid via
switch_to_thread() or mourning the inferior. */
always called just before a routine is popped off the target stack.
Closing file descriptors and freeing memory are typical things it should
do. */
-/* Close out all files and local state before this target loses control. */
+/* Close out all files and local state before this target loses control. */
static void
gdbsim_close (int quitting)
rd.siggnal = siggnal;
rd.step = step;
- /* We don't access any sim_data members within this function.
+ /* We don't access any sim_data members within this function.
What's of interest is whether or not the call to
get_sim_inferior_data_by_ptid(), above, is able to obtain a
non-NULL pointer. If it managed to obtain a non-NULL pointer, we
struct inferior *inf = find_inferior_pid (ptid_get_pid (ptid));
if (inf == NULL)
- error (_("Can't stop pid %d. No inferior found."), ptid_get_pid (ptid));
+ error (_("Can't stop pid %d. No inferior found."),
+ ptid_get_pid (ptid));
gdbsim_stop_inferior (inf, NULL);
}
/* Wait for inferior process to do something. Return pid of child,
or -1 in case of error; store status through argument pointer STATUS,
- just as `wait' would. */
+ just as `wait' would. */
static void
gdbsim_cntrl_c (int signo)
When ptid is minus_one_ptid, just use the current inferior. If we're
given an explicit pid, we'll try to find it and use that instead. */
if (ptid_equal (ptid, minus_one_ptid))
- sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
+ sim_data = get_sim_inferior_data (current_inferior (),
+ SIM_INSTANCE_NEEDED);
else
{
sim_data = get_sim_inferior_data_by_ptid (ptid, SIM_INSTANCE_NEEDED);
break;
case sim_running:
case sim_polling:
- /* FIXME: Is this correct? */
+ /* FIXME: Is this correct? */
break;
}
static void
gdbsim_prepare_to_store (struct regcache *regcache)
{
- /* Do nothing, since we can store individual regs */
+ /* Do nothing, since we can store individual regs. */
}
/* Transfer LEN bytes between GDB address MYADDR and target address
MEMADDR. If WRITE is non-zero, transfer them to the target,
otherwise transfer them from the target. TARGET is unused.
- Returns the number of bytes transferred. */
+ Returns the number of bytes transferred. */
static int
gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
if (remote_debug)
{
- /* FIXME: Send to something other than STDOUT? */
+ /* FIXME: Send to something other than STDOUT? */
printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
gdb_print_host_address (myaddr, gdb_stdout);
printf_filtered (", memaddr %s, len %d, write %d\n",
/* PREVIOUSLY: The user may give a command before the simulator
is opened. [...] (??? assuming of course one wishes to
continue to allow commands to be sent to unopened simulators,
- which isn't entirely unreasonable). */
+ which isn't entirely unreasonable). */
/* The simulator is a builtin abstraction of a remote target.
Consistent with that model, access to the simulator, via sim
commands, is restricted to the period when the channel to the
- simulator is open. */
+ simulator is open. */
error (_("Not connected to the simulator target"));
}
sim_do_command (sim_data->gdbsim_desc, args);
/* Invalidate the register cache, in case the simulator command does
- something funny. */
+ something funny. */
registers_changed ();
}
return 1;
}
-/* Define the target subroutine names */
+/* Define the target subroutine names. */
struct target_ops gdbsim_ops;
#include "ax.h"
#include "ax-gdb.h"
-/* temp hacks for tracepoint encoding migration */
+/* Temp hacks for tracepoint encoding migration. */
static char *target_buf;
static long target_buf_size;
/*static*/ void
{
char *buf;
- QUIT; /* allow user to bail out with ^C */
+ QUIT; /* Allow user to bail out with ^C. */
getpkt (buf_p, sizeof_buf, 0);
buf = *buf_p;
if (buf[0] == 'E')
else if (buf[0] == 'O' && buf[1] != 'K')
remote_console_output (buf + 1); /* 'O' message from stub */
else
- return buf; /* here's the actual reply */
+ return buf; /* Here's the actual reply. */
}
while (1);
}
to be smaller. */
rsa->sizeof_g_packet = offset;
- /* Default maximum number of characters in a packet body. Many
+ /* Default maximum number of characters in a packet body. Many
remote stubs have a hardwired buffer size of 400 bytes
(c.f. BUFMAX in m68k-stub.c and i386-stub.c). BUFMAX-1 is used
as the maximum packet-size to ensure that the packet and an extra
rsa->actual_register_packet_size = 0;
/* Should rsa->sizeof_g_packet needs more space than the
- default, adjust the size accordingly. Remember that each byte is
- encoded as two characters. 32 is the overhead for the packet
- header / footer. NOTE: cagney/1999-10-26: I suspect that 8
+ default, adjust the size accordingly. Remember that each byte is
+ encoded as two characters. 32 is the overhead for the packet
+ header / footer. NOTE: cagney/1999-10-26: I suspect that 8
(``$NN:G...#NN'') is a better guess, the below has been padded a
little. */
if (rsa->sizeof_g_packet > ((rsa->remote_packet_size - 32) / 2))
/* This variable sets the number of bits in an address that are to be
sent in a memory ("M" or "m") packet. Normally, after stripping
- leading zeros, the entire address would be sent. This variable
+ leading zeros, the entire address would be sent. This variable
restricts the address to REMOTE_ADDRESS_SIZE bits. HISTORY: The
initial implementation of remote.c restricted the address sent in
memory packets to ``host::sizeof long'' bytes - (typically 32
return what_they_get;
}
-/* Update the size of a read/write packet. If they user wants
+/* Update the size of a read/write packet. If they user wants
something really big then do a sanity check. */
static void
\f
/* Generic configuration support for packets the stub optionally
- supports. Allows the user to specify the use of the packet as well
+ supports. Allows the user to specify the use of the packet as well
as allowing GDB to auto-detect support in the remote stub. */
enum packet_support
/* Call this function as a result of
1) A halt indication (T packet) containing a thread id
2) A direct query of currthread
- 3) Successful execution of set thread
- */
+ 3) Successful execution of set thread */
static void
record_currthread (ptid_t currthread)
typedef unsigned char threadref[OPAQUETHREADBYTES];
/* WARNING: This threadref data structure comes from the remote O.S.,
- libstub protocol encoding, and remote.c. it is not particularly
+ libstub protocol encoding, and remote.c. It is not particularly
changable. */
/* Right now, the internal structure is int. We want it to be bigger.
- Plan to fix this.
- */
+ Plan to fix this. */
typedef int gdb_threadref; /* Internal GDB thread reference. */
/* The volume of remote transfers can be limited by submitting
a mask containing bits specifying the desired information.
Use a union of these values as the 'selection' parameter to
- get_thread_info. FIXME: Make these TAG names more thread specific.
- */
+ get_thread_info. FIXME: Make these TAG names more thread specific. */
#define TAG_THREADID 1
#define TAG_EXISTS 2
}
/* Externally, threadrefs are 64 bits but internally, they are still
- ints. This is due to a mismatch of specifications. We would like
+ ints. This is due to a mismatch of specifications. We would like
to use 64bit thread references internally. This is an adapter
function. */
/* FIXME: cagney/1999-09-23: During the initial connection it is
assumed that the target is already ready and able to respond to
- requests. Unfortunately remote_start_remote() eventually calls
+ requests. Unfortunately remote_start_remote() eventually calls
wait_for_inferior() with no timeout. wait_forever_enabled_p gets
- around this. Eventually a mechanism that allows
+ around this. Eventually a mechanism that allows
wait_for_inferior() to expect/get timeouts will be
implemented. */
wait_forever_enabled_p = 0;
done:
/* We are about to start executing the inferior, let's register it
- with the event loop. NOTE: this is the one place where all the
- execution commands end up. We could alternatively do this in each
+ with the event loop. NOTE: this is the one place where all the
+ execution commands end up. We could alternatively do this in each
of the execution commands in infcmd.c. */
/* FIXME: ezannoni 1999-09-28: We may need to move this out of here
into infcmd.c in order to allow inferior function calls to work
target_stop (inferior_ptid);
}
-/* Perform interrupt, if the first attempt did not succeed. Just give
+/* Perform interrupt, if the first attempt did not succeed. Just give
up on the target alltogether. */
void
async_remote_interrupt_twice (gdb_client_data arg)
packet. */
static void (*ofunc) (int);
-/* The command line interface's stop routine. This function is installed
- as a signal handler for SIGINT. The first time a user requests a
- stop, we call remote_stop to send a break or ^C. If there is no
+/* The command line interface's stop routine. This function is installed
+ as a signal handler for SIGINT. The first time a user requests a
+ stop, we call remote_stop to send a break or ^C. If there is no
response from the target (it didn't stop when the user requested it),
we ask the user if he'd like to detach from the target. */
static void
send_interrupt_sequence ();
}
-/* This is the generic stop called via the target vector. When a target
+/* This is the generic stop called via the target vector. When a target
interrupt is requested, either by the command line or the GUI, we
will eventually end up here. */
/* For now, don't complain if we have no way to write the
register. GDB loses track of unavailable registers too
easily. Some day, this may be an error. We don't have
- any way to read the register, either... */
+ any way to read the register, either... */
if (!reg->in_g_packet)
return;
remote_write_bytes.
NOTE: This can still lose if the serial line is not eight-bit
- clean. In cases like this, the user should clear "remote
+ clean. In cases like this, the user should clear "remote
X-packet". */
static void
rs->buf[0] = '\0';
/* Compute the size of the actual payload by subtracting out the
- packet header and footer overhead: "$M<memaddr>,<len>:...#nn".
- */
+ packet header and footer overhead: "$M<memaddr>,<len>:...#nn". */
+
payload_size -= strlen ("$,:#NN");
if (!use_length)
- /* The comma won't be used. */
+ /* The comma won't be used. */
payload_size += 1;
header_length = strlen (header);
payload_size -= header_length;
int todo;
int i;
- todo = min (len, max_buf_size / 2); /* num bytes that will fit */
+ todo = min (len, max_buf_size / 2); /* num bytes that will fit. */
/* construct "m"<memaddr>","<len>" */
/* sprintf (rs->buf, "m%lx,%x", (unsigned long) memaddr, todo); */
for (s = exec_bfd->sections; s; s = s->next)
{
if (!(s->flags & SEC_LOAD))
- continue; /* skip non-loadable section */
+ continue; /* Skip non-loadable section. */
size = bfd_get_section_size (s);
if (size == 0)
- continue; /* skip zero-length section */
+ continue; /* Skip zero-length section. */
sectname = bfd_get_section_name (exec_bfd, s);
if (args && strcmp (args, sectname) != 0)
- continue; /* not the section selected by user */
+ continue; /* Not the section selected by user. */
- matched = 1; /* do this section */
+ matched = 1; /* Do this section. */
lma = s->lma;
sectdata = xmalloc (size);
return -1;
}
- /* Handle SPU memory using qxfer packets. */
+ /* Handle SPU memory using qxfer packets. */
if (object == TARGET_OBJECT_SPU)
{
if (readbuf)
buffer size. */
if (offset == 0 && len == 0)
return (get_remote_packet_size ());
- /* Minimum outbuf size is get_remote_packet_size (). If LEN is not
+ /* Minimum outbuf size is get_remote_packet_size (). If LEN is not
large enough let the caller deal with it. */
if (len < get_remote_packet_size ())
return -1;
int max_size = get_memory_write_packet_size ();
struct packet_config *packet =
&remote_protocol_packets[PACKET_qSearch_memory];
- /* number of packet bytes used to encode the pattern,
- this could be more than PATTERN_LEN due to escape characters */
+ /* Number of packet bytes used to encode the pattern;
+ this could be more than PATTERN_LEN due to escape characters. */
int escaped_pattern_len;
- /* amount of pattern that was encodable in the packet */
+ /* Amount of pattern that was encodable in the packet. */
int used_pattern_len;
int i;
int found;
for (cmd = cmds; cmd; cmd = cmd->next)
{
- QUIT; /* allow user to bail out with ^C */
+ QUIT; /* Allow user to bail out with ^C. */
strcpy (rs->buf, "QTDPsrc:");
encode_source_string (num, addr, "cmd", cmd->line,
rs->buf + strlen (rs->buf),
{
remote_download_command_source (num, addr, *cmd->body_list);
- QUIT; /* allow user to bail out with ^C */
+ QUIT; /* Allow user to bail out with ^C. */
strcpy (rs->buf, "QTDPsrc:");
encode_source_string (num, addr, "cmd", "end",
rs->buf + strlen (rs->buf),
{
for (ndx = 0; tdp_actions[ndx]; ndx++)
{
- QUIT; /* allow user to bail out with ^C */
+ QUIT; /* Allow user to bail out with ^C. */
sprintf (buf, "QTDP:-%x:%s:%s%c",
t->number, addrbuf, /* address */
tdp_actions[ndx],
{
for (ndx = 0; stepping_actions[ndx]; ndx++)
{
- QUIT; /* allow user to bail out with ^C */
+ QUIT; /* Allow user to bail out with ^C. */
sprintf (buf, "QTDP:-%x:%s:%s%s%s",
t->number, addrbuf, /* address */
((ndx == 0) ? "S" : ""),
char tmp1[40], tmp2[40];
if ((s->flags & SEC_LOAD) == 0 ||
- /* (s->flags & SEC_CODE) == 0 || */
+ /* (s->flags & SEC_CODE) == 0 || */
(s->flags & SEC_READONLY) == 0)
continue;
remote_get_trace_status (struct trace_status *ts)
{
char *p;
- /* FIXME we need to get register block size some other way */
+ /* FIXME we need to get register block size some other way. */
extern int trace_regblock_size;
trace_regblock_size = get_remote_arch_state ()->sizeof_g_packet;
of the packet is in BUF. The string in BUF can be at most PBUFSIZ
- 5 to account for the $, # and checksum, and for a possible /0 if
we are debugging (remote_debug) and want to print the sent packet
- as a string */
+ as a string. */
extern int putpkt (char *buf);
#include "exceptions.h"
/* Hook for determining the TOC address when calling functions in the
- inferior under AIX. The initialization code in rs6000-nat.c sets
+ inferior under AIX. The initialization code in rs6000-nat.c sets
this hook to point to find_toc_address. */
CORE_ADDR (*rs6000_find_toc_address_hook) (CORE_ADDR) = NULL;
/* If the kernel has to deliver a signal, it pushes a sigcontext
structure on the stack and then calls the signal handler, passing
- the address of the sigcontext in an argument register. Usually
+ the address of the sigcontext in an argument register. Usually
the signal handler doesn't save this register, so we have to
access the sigcontext structure via an offset from the signal handler
frame.
}
/* Collect register REGNUM in the general-purpose register set
- REGSET. from register cache REGCACHE into the buffer specified by
+ REGSET, from register cache REGCACHE into the buffer specified by
GREGS and LEN. If REGNUM is -1, do this for all registers in
REGSET. */
}
-/* Pass the arguments in either registers, or in the stack. In RS/6000,
+/* Pass the arguments in either registers, or in the stack. In RS/6000,
the first eight words of the argument list (that might be less than
eight parameters if some parameters occupy more than one word) are
- passed in r3..r10 registers. float and double parameters are
+ passed in r3..r10 registers. Float and double parameters are
passed in fpr's, in addition to that. Rest of the parameters if any
are passed in user stack. There might be cases in which half of the
parameter is copied into registers, the other half is pushed into
ii++;
}
-/*
- effectively indirect call... gcc does...
+/* effectively indirect call... gcc does...
return_val example( float, int);
offset of stack on overflow different
both:
return in r3 or f0. If no float, must study how gcc emulates floats;
- pay attention to arg promotion.
+ pay attention to arg promotion.
User may have to cast\args to handle promotion correctly
- since gdb won't know if prototype supplied or not.
- */
+ since gdb won't know if prototype supplied or not. */
for (argno = 0, argbytes = 0; argno < nargs && ii < 8; ++ii)
{
{
/* Floating point arguments are passed in fpr's, as well as gpr's.
- There are 13 fpr's reserved for passing parameters. At this point
+ There are 13 fpr's reserved for passing parameters. At this point
there is no way we would run out of them. */
gdb_assert (len <= 8);
sp -= space;
/* This is another instance we need to be concerned about
- securing our stack space. If we write anything underneath %sp
+ securing our stack space. If we write anything underneath %sp
(r1), we might conflict with the kernel who thinks he is free
to use this area. So, update %sp first before doing anything
else. */
/* If the called subprogram returns an aggregate, there exists an
implicit first argument, whose value is the address of a caller-
allocated buffer into which the callee is assumed to store its
- return value. All explicit parameters are appropriately
+ return value. All explicit parameters are appropriately
relabeled. */
if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
|| TYPE_CODE (valtype) == TYPE_CODE_UNION
/* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG).
Usually a function pointer's representation is simply the address
- of the function. On the RS/6000 however, a function pointer is
- represented by a pointer to an OPD entry. This OPD entry contains
+ of the function. On the RS/6000 however, a function pointer is
+ represented by a pointer to an OPD entry. This OPD entry contains
three words, the first word is the address of the function, the
second word is the TOC pointer (r2), and the third word is the
static chain value. Throughout GDB it is currently assumed that a
else if (ext_op == 528) /* br cond to count reg */
{
- dest = get_frame_register_unsigned (frame, tdep->ppc_ctr_regnum) & ~3;
+ dest = get_frame_register_unsigned (frame,
+ tdep->ppc_ctr_regnum) & ~3;
/* If we are about to execute a system call, dest is something
like 0x22fc or 0x3b00. Upon completion the system call
will return to the address in the link register. */
if (dest < AIX_TEXT_SEGMENT_BASE)
- dest = get_frame_register_unsigned (frame, tdep->ppc_lr_regnum) & ~3;
+ dest = get_frame_register_unsigned (frame,
+ tdep->ppc_lr_regnum) & ~3;
}
else
return -1;
opcode = insn >> 26;
breaks[1] = branch_dest (frame, opcode, insn, loc, breaks[0]);
- /* Don't put two breakpoints on the same address. */
+ /* Don't put two breakpoints on the same address. */
if (breaks[1] == breaks[0])
breaks[1] = -1;
for (ii = 0; ii < 2; ++ii)
{
- /* ignore invalid breakpoint. */
+ /* ignore invalid breakpoint. */
if (breaks[ii] == -1)
continue;
insert_single_step_breakpoint (gdbarch, aspace, breaks[ii]);
}
- errno = 0; /* FIXME, don't ignore errors! */
+ errno = 0; /* FIXME, don't ignore errors! */
/* What errors? {read,write}_memory call error(). */
return 1;
}
/* On AIX4.3+, sys/ldr.h provides different versions of struct ld_info for
debugging 32-bit and 64-bit processes. Define a typedef and macros for
- accessing fields in the appropriate structures. */
+ accessing fields in the appropriate structures. */
/* In 32-bit compilation mode (which is the only mode from which ptrace()
- works on 4.3), __ld_info32 is #defined as equivalent to ld_info. */
+ works on 4.3), __ld_info32 is #defined as equivalent to ld_info. */
#ifdef __ld_info32
# define ARCH3264
#endif
-/* Return whether the current architecture is 64-bit. */
+/* Return whether the current architecture is 64-bit. */
#ifndef ARCH3264
# define ARCH64() 0
# define ARCH64() (register_size (target_gdbarch, 0) == 8)
#endif
-/* Union of 32-bit and 64-bit versions of ld_info. */
+/* Union of 32-bit and 64-bit versions of ld_info. */
typedef union {
#ifndef ARCH3264
/* If compiling with 32-bit and 64-bit debugging capability (e.g. AIX 4.x),
declare and initialize a variable named VAR suitable for use as the arch64
- parameter to the various LDI_*() macros. */
+ parameter to the various LDI_*() macros. */
#ifndef ARCH3264
# define ARCH64_DECL(var)
/* Return LDI's FIELD for a 64-bit process if ARCH64 and for a 32-bit process
otherwise. This technique only works for FIELDs with the same data type in
- 32-bit and 64-bit versions of ld_info. */
+ 32-bit and 64-bit versions of ld_info. */
#ifndef ARCH3264
# define LDI_FIELD(ldi, arch64, field) (ldi)->l32.ldinfo_##field
#endif
/* Return various LDI fields for a 64-bit process if ARCH64 and for a 32-bit
- process otherwise. */
+ process otherwise. */
#define LDI_NEXT(ldi, arch64) LDI_FIELD(ldi, arch64, next)
#define LDI_FD(ldi, arch64) LDI_FIELD(ldi, arch64, fd)
return -1;
}
-/* Call ptrace(REQ, ID, ADDR, DATA, BUF). */
+/* Call ptrace(REQ, ID, ADDR, DATA, BUF). */
static int
rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf)
return ret;
}
-/* Call ptracex(REQ, ID, ADDR, DATA, BUF). */
+/* Call ptracex(REQ, ID, ADDR, DATA, BUF). */
static int
rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
return ret;
}
-/* Fetch register REGNO from the inferior. */
+/* Fetch register REGNO from the inferior. */
static void
fetch_register (struct regcache *regcache, int regno)
int addr[MAX_REGISTER_SIZE];
int nr, isfloat;
- /* Retrieved values may be -1, so infer errors from errno. */
+ /* Retrieved values may be -1, so infer errors from errno. */
errno = 0;
nr = regmap (gdbarch, regno, &isfloat);
- /* Floating-point registers. */
+ /* Floating-point registers. */
if (isfloat)
rs6000_ptrace32 (PT_READ_FPR, PIDGET (inferior_ptid), addr, nr, 0);
- /* Bogus register number. */
+ /* Bogus register number. */
else if (nr < 0)
{
if (regno >= gdbarch_num_regs (gdbarch))
return;
}
- /* Fixed-point registers. */
+ /* Fixed-point registers. */
else
{
if (!ARCH64 ())
- *addr = rs6000_ptrace32 (PT_READ_GPR, PIDGET (inferior_ptid), (int *)nr, 0, 0);
+ *addr = rs6000_ptrace32 (PT_READ_GPR, PIDGET (inferior_ptid),
+ (int *) nr, 0, 0);
else
{
/* PT_READ_GPR requires the buffer parameter to point to long long,
- even if the register is really only 32 bits. */
+ even if the register is really only 32 bits. */
long long buf;
rs6000_ptrace64 (PT_READ_GPR, PIDGET (inferior_ptid), nr, 0, &buf);
if (register_size (gdbarch, regno) == 8)
else
{
#if 0
- /* FIXME: this happens 3 times at the start of each 64-bit program. */
+ /* FIXME: this happens 3 times at the start of each 64-bit program. */
perror ("ptrace read");
#endif
errno = 0;
}
}
-/* Store register REGNO back into the inferior. */
+/* Store register REGNO back into the inferior. */
static void
store_register (struct regcache *regcache, int regno)
/* Fetch the register's value from the register cache. */
regcache_raw_collect (regcache, regno, addr);
- /* -1 can be a successful return value, so infer errors from errno. */
+ /* -1 can be a successful return value, so infer errors from errno. */
errno = 0;
nr = regmap (gdbarch, regno, &isfloat);
- /* Floating-point registers. */
+ /* Floating-point registers. */
if (isfloat)
rs6000_ptrace32 (PT_WRITE_FPR, PIDGET (inferior_ptid), addr, nr, 0);
- /* Bogus register number. */
+ /* Bogus register number. */
else if (nr < 0)
{
if (regno >= gdbarch_num_regs (gdbarch))
regno);
}
- /* Fixed-point registers. */
+ /* Fixed-point registers. */
else
{
if (regno == gdbarch_sp_regnum (gdbarch))
process to give kernel a chance to do internal housekeeping.
Otherwise the following ptrace(2) calls will mess up user stack
since kernel will get confused about the bottom of the stack
- (%sp). */
+ (%sp). */
exec_one_dummy_insn (regcache);
/* The PT_WRITE_GPR operation is rather odd. For 32-bit inferiors,
the register's value is passed by value, but for 64-bit inferiors,
the address of a buffer containing the value is passed. */
if (!ARCH64 ())
- rs6000_ptrace32 (PT_WRITE_GPR, PIDGET (inferior_ptid), (int *)nr, *addr, 0);
+ rs6000_ptrace32 (PT_WRITE_GPR, PIDGET (inferior_ptid),
+ (int *) nr, *addr, 0);
else
{
/* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
- area, even if the register is really only 32 bits. */
+ area, even if the register is really only 32 bits. */
long long buf;
if (register_size (gdbarch, regno) == 8)
memcpy (&buf, addr, 8);
}
/* Read from the inferior all registers if REGNO == -1 and just register
- REGNO otherwise. */
+ REGNO otherwise. */
static void
rs6000_fetch_inferior_registers (struct target_ops *ops,
rounded_offset, 0, NULL);
else
buffer.word = rs6000_ptrace32 (PT_READ_I, pid,
- (int *)(uintptr_t)rounded_offset,
+ (int *) (uintptr_t)
+ rounded_offset,
0, NULL);
}
rounded_offset, buffer.word, NULL);
else
rs6000_ptrace32 (PT_WRITE_D, pid,
- (int *)(uintptr_t)rounded_offset, buffer.word, NULL);
+ (int *) (uintptr_t) rounded_offset,
+ buffer.word, NULL);
if (errno)
return 0;
}
/* stop after load" status. */
if (status == 0x57c)
ourstatus->kind = TARGET_WAITKIND_LOADED;
- /* signal 0. I have no idea why wait(2) returns with this status word. */
+ /* signal 0. I have no idea why wait(2) returns with this status word. */
else if (status == 0x7f)
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
/* A normal waitstatus. Let the usual macros deal with it. */
/* Execute one dummy breakpoint instruction. This way we give the kernel
a chance to do some housekeeping and update inferior's internal data,
- including u_area. */
+ including u_area. */
static void
exec_one_dummy_insn (struct regcache *regcache)
CORE_ADDR prev_pc;
void *bp;
- /* We plant one dummy breakpoint into DUMMY_INSN_ADDR address. We
+ /* We plant one dummy breakpoint into DUMMY_INSN_ADDR address. We
assume that this address will never be executed again by the real
- code. */
+ code. */
bp = deprecated_insert_raw_breakpoint (gdbarch, NULL, DUMMY_INSN_ADDR);
if (ARCH64 ())
ret = rs6000_ptrace64 (PT_CONTINUE, PIDGET (inferior_ptid), 1, 0, NULL);
else
- ret = rs6000_ptrace32 (PT_CONTINUE, PIDGET (inferior_ptid), (int *)1, 0, NULL);
+ ret = rs6000_ptrace32 (PT_CONTINUE, PIDGET (inferior_ptid),
+ (int *) 1, 0, NULL);
if (ret != 0)
perror ("pt_continue");
\f
/* Copy information about text and data sections from LDI to VP for a 64-bit
- process if ARCH64 and for a 32-bit process otherwise. */
+ process if ARCH64 and for a 32-bit process otherwise. */
static void
vmap_secs (struct vmap *vp, LdInfo *ldi, int arch64)
vp->tstart += vp->toffs;
}
-/* handle symbol translation on vmapping */
+/* Handle symbol translation on vmapping. */
static void
vmap_symtab (struct vmap *vp)
objfile = symfile_objfile;
}
else if (!vp->loaded)
- /* If symbols are not yet loaded, offsets are not yet valid. */
+ /* If symbols are not yet loaded, offsets are not yet valid. */
return;
new_offsets =
ARCH64_DECL (arch64);
/* This ldi structure was allocated using alloca() in
- xcoff_relocate_symtab(). Now we need to have persistent object
- and member names, so we should save them. */
+ xcoff_relocate_symtab(). Now we need to have persistent object
+ and member names, so we should save them. */
filename = LDI_FILENAME (ldi, arch64);
mem = filename + strlen (filename) + 1;
return NULL;
}
- /* make sure we have an object file */
+ /* Make sure we have an object file. */
if (bfd_check_format (abfd, bfd_object))
vp = map_vmap (abfd, 0);
else if (bfd_check_format (abfd, bfd_archive))
{
last = 0;
- /* FIXME??? am I tossing BFDs? bfd? */
+ /* FIXME??? am I tossing BFDs? bfd? */
while ((last = bfd_openr_next_archived_file (abfd, last)))
if (strcmp (mem, last->filename) == 0)
break;
if (fstat (fd, &ii) < 0)
{
/* The kernel sets ld_info to -1, if the process is still using the
- object, and the object is removed. Keep the symbol info for the
+ object, and the object is removed. Keep the symbol info for the
removed object and issue a warning. */
warning (_("%s (fd=%d) has disappeared, keeping its symbols"),
name, fd);
struct objfile *objfile;
/* First try to find a `vp', which is the same as in ldinfo.
- If not the same, just continue and grep the next `vp'. If same,
- relocate its tstart, tend, dstart, dend values. If no such `vp'
+ If not the same, just continue and grep the next `vp'. If same,
+ relocate its tstart, tend, dstart, dend values. If no such `vp'
found, get out of this for loop, add this ldi entry as a new vmap
- (add_vmap) and come back, find its `vp' and so on... */
+ (add_vmap) and come back, find its `vp' and so on... */
- /* The filenames are not always sufficient to match on. */
+ /* The filenames are not always sufficient to match on. */
if ((name[0] == '/' && strcmp (name, vp->name) != 0)
|| (memb[0] && strcmp (memb, vp->member) != 0))
if (vp->objfile == NULL)
got_exec_file = 1;
- /* relocate symbol table(s). */
+ /* relocate symbol table(s). */
vmap_symtab (vp);
/* Announce new object files. Doing this after symbol relocation
/* There may be more, so we don't break out of the loop. */
}
- /* if there was no matching *vp, we must perforce create the sucker(s) */
+ /* If there was no matching *vp, we must perforce create the
+ sucker(s). */
if (!got_one && !retried)
{
add_vmap (ldi);
breakpoint_re_set ();
}
\f
-/* As well as symbol tables, exec_sections need relocation. After
+/* As well as symbol tables, exec_sections need relocation. After
the inferior process' termination, there will be a relocated symbol
- table exist with no corresponding inferior process. At that time, we
+ table exist with no corresponding inferior process. At that time, we
need to use `exec' bfd, rather than the inferior process's memory space
to look up symbols.
`exec_sections' need to be relocated only once, as long as the exec
- file remains unchanged.
- */
+ file remains unchanged. */
static void
vmap_exec (void)
}
/* Set the current architecture from the host running GDB. Called when
- starting a child process. */
+ starting a child process. */
static void (*super_create_inferior) (struct target_ops *,char *exec_file,
char *allargs, char **env, int from_tty);
if (!gdbarch_update_p (info))
internal_error (__FILE__, __LINE__,
- _("rs6000_create_inferior: failed to select architecture"));
+ _("rs6000_create_inferior: failed "
+ "to select architecture"));
}
\f
#if 0
/* According to my humble theory, AIX has some timing problems and
when the user stack grows, kernel doesn't update stack info in time
- and ptrace calls step on user stack. That is why we sleep here a
- little, and give kernel to update its internals. */
+ and ptrace calls step on user stack. That is why we sleep here a
+ little, and give kernel to update its internals. */
usleep (36000);
#endif
else
{
vmap_ldinfo (ldi);
- vmap_exec (); /* relocate the exec and core sections as well. */
+ vmap_exec (); /* relocate the exec and core sections as well. */
}
} while (rc == -1);
if (ldi)
struct vmap *vp;
int arch64 = ARCH64 ();
- /* Size of a struct ld_info except for the variable-length filename. */
+ /* Size of a struct ld_info except for the variable-length filename. */
int nonfilesz = (int)LDI_FILENAME ((LdInfo *)0, arch64);
/* Allocated size of buffer. */
else
vp = add_vmap (ldi);
- /* Process next shared library upon error. */
+ /* Process next shared library upon error. */
offset += LDI_NEXT (ldi, arch64);
if (vp == NULL)
continue;
static enum powerpc_vector_abi powerpc_vector_abi_global = POWERPC_VEC_AUTO;
static const char *powerpc_vector_abi_string = "auto";
-/* To be used by skip_prologue. */
+/* To be used by skip_prologue. */
struct rs6000_framedata
{
int saved_vr; /* smallest # of saved vr */
int saved_ev; /* smallest # of saved ev */
int alloca_reg; /* alloca register number (frame ptr) */
- char frameless; /* true if frameless functions. */
- char nosavedpc; /* true if pc not saved. */
+ char frameless; /* true if frameless functions. */
+ char nosavedpc; /* true if pc not saved. */
char used_bl; /* true if link register clobbered */
int gpr_offset; /* offset of saved gprs from prev sp */
int fpr_offset; /* offset of saved fprs from prev sp */
paddress (gdbarch, insn), paddress (gdbarch, current_pc),
paddress (gdbarch, from + offset));
- regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch),
+ regcache_cooked_write_unsigned (regs,
+ gdbarch_pc_regnum (gdbarch),
from + offset);
}
}
return 0;
}
-/* Masks for decoding a branch-and-link (bl) instruction.
+/* Masks for decoding a branch-and-link (bl) instruction.
BL_MASK and BL_INSTRUCTION are used in combination with each other.
The former is anded with the opcode in question; if the result of
/* First possible sequence: A small number of probes.
stw 0, -<some immediate>(1)
- [repeat this instruction any (small) number of times]
- */
+ [repeat this instruction any (small) number of times]. */
if ((op & 0xffff0000) == 0x90010000)
{
addi 12,12,-<some immediate>
stw 0,0(12)
b <disp>
- [possibly one last probe: stw 0,<some immediate>(12)]
- */
+ [possibly one last probe: stw 0,<some immediate>(12)]. */
while (1)
{
if ((op & 0xfc000001) != 0x48000000)
break;
- /* [possibly one last probe: stw 0,<some immediate>(12)] */
+ /* [possibly one last probe: stw 0,<some immediate>(12)]. */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xffff0000) == 0x900c0000)
- ev_offset is the offset of the first saved ev from the previous frame.
- lr_offset is the offset of the saved lr
- cr_offset is the offset of the saved cr
- - vrsave_offset is the offset of the saved vrsave register
- */
+ - vrsave_offset is the offset of the saved vrsave register. */
static CORE_ADDR
skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* Sometimes it isn't clear if an instruction is a prologue
instruction or not. When we encounter one of these ambiguous
cases, we'll set prev_insn_was_prologue_insn to 0 (false).
- Otherwise, we'll assume that it really is a prologue instruction. */
+ Otherwise, we'll assume that it really is a prologue instruction. */
if (prev_insn_was_prologue_insn)
last_prologue_pc = pc;
/* nop */
/* Allow nops in the prologue, but do not consider them to
be part of the prologue unless followed by other prologue
- instructions. */
+ instructions. */
prev_insn_was_prologue_insn = 0;
continue;
}
else if ((op & 0xfc000001) == 0x48000001)
{ /* bl foo,
- to save fprs??? */
+ to save fprs??? */
fdata->frameless = 0;
struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
struct symtab_and_line this_sal = find_pc_line (pc, 0);
- if ((prologue_sal.line == 0) || (prologue_sal.line != this_sal.line))
+ if ((prologue_sal.line == 0)
+ || (prologue_sal.line != this_sal.line))
break;
}
/* At this point, make sure this is not a trampoline
function (a function that simply calls another functions,
and nothing else). If the next is not a nop, this branch
- was part of the function prologue. */
+ was part of the function prologue. */
if (op == 0x4def7b82 || op == 0) /* crorc 15, 15, 15 */
- break; /* don't skip over
- this branch */
+ break; /* Don't skip over
+ this branch. */
fdata->used_bl = 1;
continue;
}
else if ((op & 0xfc1f016a) == 0x7c01016e)
{ /* stwux rX,r1,rY */
- /* no way to figure out what r1 is going to be */
+ /* No way to figure out what r1 is going to be. */
fdata->frameless = 0;
offset = fdata->offset;
continue;
}
else if ((op & 0xfc1f016a) == 0x7c01016a)
{ /* stdux rX,r1,rY */
- /* no way to figure out what r1 is going to be */
+ /* No way to figure out what r1 is going to be. */
fdata->frameless = 0;
offset = fdata->offset;
continue;
}
/* Load up minimal toc pointer. Do not treat an epilogue restore
of r31 as a minimal TOC load. */
- else if (((op >> 22) == 0x20f || /* l r31,... or l r30,... */
- (op >> 22) == 0x3af) /* ld r31,... or ld r30,... */
+ else if (((op >> 22) == 0x20f || /* l r31,... or l r30,... */
+ (op >> 22) == 0x3af) /* ld r31,... or ld r30,... */
&& !framep
&& !minimal_toc_loaded)
{
else if ((op & 0xfc0007fe) == 0x7c000378 && /* mr(.) Rx,Ry */
(((op >> 21) & 31) >= 3) && /* R3 >= Ry >= R10 */
(((op >> 21) & 31) <= 10) &&
- ((long) ((op >> 16) & 31) >= fdata->saved_gpr)) /* Rx: local var reg */
+ ((long) ((op >> 16) & 31)
+ >= fdata->saved_gpr)) /* Rx: local var reg */
{
continue;
vr_saved_offset = SIGNED_SHORT (op);
/* This insn by itself is not part of the prologue, unless
- if part of the pair of insns mentioned above. So do not
+ if part of the pair of insns mentioned above. So do not
record this insn as part of the prologue yet. */
prev_insn_was_prologue_insn = 0;
}
#if 0
/* I have problems with skipping over __main() that I need to address
- * sometime. Previously, I used to use misc_function_vector which
+ * sometime. Previously, I used to use misc_function_vector which
* didn't work as well as I wanted to be. -MGO */
/* If the first thing after skipping a prolog is a branch to a function,
if ((op & 0xfc000001) == 0x48000001)
- { /* bl foo, an initializer function? */
+ { /* bl foo, an initializer function? */
op = read_memory_integer (pc + 4, 4, byte_order);
if (op == 0x4def7b82)
if (op != trampoline_code[ii])
return 0;
}
- ii = get_frame_register_unsigned (frame, 11); /* r11 holds destination addr */
+ ii = get_frame_register_unsigned (frame, 11); /* r11 holds destination
+ addr. */
pc = read_memory_unsigned_integer (ii, tdep->wordsize, byte_order);
return pc;
}
}
static void
-rs6000_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+rs6000_pseudo_register_read (struct gdbarch *gdbarch,
+ struct regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
struct gdbarch *regcache_arch = get_regcache_arch (regcache);
}
/* if != -1, fdata.saved_ev is the smallest number of saved_ev.
- All vr's from saved_ev to ev31 are saved. ????? */
+ All vr's from saved_ev to ev31 are saved. ????? */
if (tdep->ppc_ev0_regnum != -1)
{
if (fdata.saved_ev >= 0)
/* If != 0, fdata.cr_offset is the offset from the frame that
holds the CR. */
if (fdata.cr_offset != 0)
- cache->saved_regs[tdep->ppc_cr_regnum].addr = cache->base + fdata.cr_offset;
+ cache->saved_regs[tdep->ppc_cr_regnum].addr
+ = cache->base + fdata.cr_offset;
/* If != 0, fdata.lr_offset is the offset from the frame that
holds the LR. */
if (fdata.lr_offset != 0)
- cache->saved_regs[tdep->ppc_lr_regnum].addr = cache->base + fdata.lr_offset;
+ cache->saved_regs[tdep->ppc_lr_regnum].addr
+ = cache->base + fdata.lr_offset;
else if (fdata.lr_register != -1)
cache->saved_regs[tdep->ppc_lr_regnum].realreg = fdata.lr_register;
/* The PC is found in the link register. */
/* If != 0, fdata.vrsave_offset is the offset from the frame that
holds the VRSAVE. */
if (fdata.vrsave_offset != 0)
- cache->saved_regs[tdep->ppc_vrsave_regnum].addr = cache->base + fdata.vrsave_offset;
+ cache->saved_regs[tdep->ppc_vrsave_regnum].addr
+ = cache->base + fdata.vrsave_offset;
if (fdata.alloca_reg < 0)
/* If no alloca register used, then fi->frame is the value of the
if (have_spe || have_dfp || have_vsx)
{
set_gdbarch_pseudo_register_read (gdbarch, rs6000_pseudo_register_read);
- set_gdbarch_pseudo_register_write (gdbarch, rs6000_pseudo_register_write);
+ set_gdbarch_pseudo_register_write (gdbarch,
+ rs6000_pseudo_register_write);
}
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
set_gdbarch_breakpoint_from_pc (gdbarch, rs6000_breakpoint_from_pc);
/* The value of symbols of type N_SO and N_FUN maybe null when
- it shouldn't be. */
+ it shouldn't be. */
set_gdbarch_sofun_address_maybe_missing (gdbarch, 1);
/* Handles single stepping of atomic sequences. */
set_gdbarch_software_single_step (gdbarch, ppc_deal_with_atomic_sequence);
- /* Not sure on this. FIXMEmgo */
+ /* Not sure on this. FIXMEmgo */
set_gdbarch_frame_args_skip (gdbarch, 8);
/* Helpers for function argument information. */
/* Initialization code. */
-extern initialize_file_ftype _initialize_rs6000_tdep; /* -Wmissing-prototypes */
+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_rs6000_tdep;
void
_initialize_rs6000_tdep (void)