* tuiDisassem.c (tuiGetBeginAsmAddress): Use lookup_minimal_symbol
authorStephane Carrez <stcarrez@nerim.fr>
Sun, 25 Aug 2002 19:39:45 +0000 (19:39 +0000)
committerStephane Carrez <stcarrez@nerim.fr>
Sun, 25 Aug 2002 19:39:45 +0000 (19:39 +0000)
to find symbol address.

gdb/tui/ChangeLog
gdb/tui/tuiDisassem.c

index dc04b1f37a31034c154bba3b9590dfc61dbfb31a..ac71eee6ab3bcddd235f0549dd7facb8eb72cc6e 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-25  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * tuiDisassem.c (tuiGetBeginAsmAddress): Use lookup_minimal_symbol
+       to find symbol address.
+
 2002-08-25  Stephane Carrez  <stcarrez@nerim.fr>
 
        * tuiSourceWin.c (tui_display_main): Rename from tuiDisplayMainFunction
index 8e59e68d6933fda14bf7ebea7d9d47ae77999eb1..e3a19b3ebaa4853cb5bfd59aa21127a92d68fe2f 100644 (file)
@@ -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 */
+}
 
 
 /*