/* C preprocessor macro tables for GDB.
- Copyright (C) 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2007, 2008, 2009, 2010, 2011
+ Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
else
{
void *copy = xmalloc (len);
+
memcpy (copy, addr, len);
return copy;
}
struct macro_table *table;
/* The name of the macro. This is in the table's bcache, if it has
- one. */
+ one. */
const char *name;
/* The source file and line number where the definition's scope
const char *name, struct macro_source_file *file, int line)
{
int names = strcmp (key->name, name);
+
if (names)
return names;
First, squawk. */
complaint (&symfile_complaints,
- _("both `%s' and `%s' allegedly #included at %s:%d"), included,
- (*link)->filename, source->filename, line);
+ _("both `%s' and `%s' allegedly #included at %s:%d"),
+ included, (*link)->filename, source->filename, line);
/* Now, choose a new, unoccupied line number for this
#inclusion, after the alleged #inclusion line. */
if (! same)
{
complaint (&symfile_complaints,
- _("macro `%s' redefined at %s:%d; original definition at %s:%d"),
+ _("macro `%s' redefined at %s:%d; "
+ "original definition at %s:%d"),
name, source->filename, line,
found_key->start_file->filename, found_key->start_line);
}
if (n)
{
struct macro_key *key = (struct macro_key *) n->key;
+
*definition_line = key->start_line;
return key->start_file;
}
struct macro_for_each_data *datum = (struct macro_for_each_data *) arg;
struct macro_key *key = (struct macro_key *) node->key;
struct macro_definition *def = (struct macro_definition *) node->value;
+
(*datum->fn) (key->name, def, datum->user_data);
return 0;
}
void *user_data)
{
struct macro_for_each_data datum;
+
datum.fn = fn;
datum.user_data = user_data;
datum.file = NULL;
macro_callback_fn fn, void *user_data)
{
struct macro_for_each_data datum;
+
datum.fn = fn;
datum.user_data = user_data;
datum.file = file;