This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Use lookup_minimal_symbol in tuiGetBeginAsmAddress
- From: Stephane Carrez <stcarrez at nerim dot fr>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 25 Aug 2002 23:40:09 +0200
- Subject: [PATCH]: Use lookup_minimal_symbol in tuiGetBeginAsmAddress
Hi!
I've committed this patch to use lookup_minimal_symbol instead of parse_and_eval_address.
Stephane
2002-08-25 Stephane Carrez <stcarrez@nerim.fr>
* tuiDisassem.c (tuiGetBeginAsmAddress): Use lookup_minimal_symbol
to find symbol address.
Index: tuiDisassem.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiDisassem.c,v
retrieving revision 1.12
diff -u -p -r1.12 tuiDisassem.c
--- tuiDisassem.c 1 Mar 2002 06:19:28 -0000 1.12
+++ tuiDisassem.c 25 Aug 2002 19:35:40 -0000
@@ -231,19 +231,25 @@ tuiGetBeginAsmAddress (void)
if (element->addr == 0)
{
- /*the target is not executing, because the pc is 0 */
-
- addr = parse_and_eval_address ("main");
-
- if (addr == 0)
- addr = parse_and_eval_address ("MAIN");
+ struct minimal_symbol *main_symbol;
+ /* Find address of the start of program.
+ Note: this should be language specific. */
+ main_symbol = lookup_minimal_symbol ("main", NULL, NULL);
+ if (main_symbol == 0)
+ main_symbol = lookup_minimal_symbol ("MAIN", NULL, NULL);
+ if (main_symbol == 0)
+ main_symbol = lookup_minimal_symbol ("_start", NULL, NULL);
+ if (main_symbol)
+ addr = SYMBOL_VALUE_ADDRESS (main_symbol);
+ else
+ addr = 0;
}
else /* the target is executing */
addr = element->addr;
return addr;
-} /* tuiGetBeginAsmAddress */
+}
/*