Make process_lookup_symbol() return a string. Delete

2006-08-20  Soren Sandmann  <sandmann@daimi.au.dk>

	* process.h: Make process_lookup_symbol() return a string. Delete
	process_lookup_symbol_with_filename().

	* process.c (struct Process): Make "undefined" a string
	(lookup_kernel_symbol): Return a string
	(process_lookup_symbol): Return a string, not a symbol

	* collector.c (unique_dup): Take a string instead of a
	Symbol.
	(lookup_symbol): Make sym a string instead of a Symbol.

	* binfile.c (bin_symbol_get_name): New function.

	* binfile.[ch] (struct BinSymbol): Rename Symbol to BinSymbol and
	make it an opaque structure.

	* binfile.[ch]: Remove unused symbol operations
This commit is contained in:
Soren Sandmann
2006-08-21 02:33:38 +00:00
committed by Søren Sandmann Pedersen
parent 7d8f3c232d
commit a880ee7f60
6 changed files with 67 additions and 105 deletions

View File

@ -57,8 +57,8 @@ struct Process
GList *bad_pages;
int pid;
Symbol undefined;
const char *undefined;
};
static void
@ -152,8 +152,7 @@ create_process (const char *cmdline, int pid)
p->bad_pages = NULL;
p->maps = NULL;
p->pid = pid;
p->undefined.name = NULL;
p->undefined.address = 0x00;
p->undefined = NULL;
g_assert (!g_hash_table_lookup (processes_by_pid, GINT_TO_POINTER (pid)));
g_assert (!g_hash_table_lookup (processes_by_cmdline, cmdline));
@ -532,24 +531,27 @@ get_kernel_symbols (void)
return NULL;
}
static const Symbol *
static const char *
lookup_kernel_symbol (gulong address)
{
static Symbol kernel;
static const char *const kernel = "In kernel";
#if 0
g_print ("kernel binary: %s\n", find_kernel_binary ());
#endif
return kernel; /* Can we just return "In kernel"? */
#if 0
kernel.name = "In kernel";
kernel.address = 0x00001337;
return &kernel;
#endif
}
const Symbol *
const char *
process_lookup_symbol (Process *process, gulong address)
{
const Symbol *result;
const BinSymbol *result;
Map *map = process_locate_map (process, address);
/* g_print ("addr: %x\n", address); */
@ -562,14 +564,13 @@ process_lookup_symbol (Process *process, gulong address)
}
else if (!map)
{
if (!process->undefined.name)
if (!process->undefined)
{
process->undefined.name =
g_strdup_printf ("(??? %s)", process->cmdline);
process->undefined.address = 0xBABE0001;
process->undefined =
g_strdup_printf ("No map (%s)", process->cmdline);
}
return &process->undefined;
return process->undefined;
}
address -= map->start;
@ -599,7 +600,7 @@ process_lookup_symbol (Process *process, gulong address)
/* g_print ("(%x) %x %x name; %s\n", address, map->start, map->offset, result->name); */
return result;
return bin_symbol_get_name (result);
}
const char *