]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use a function-domain search in inside_main_func
authorTom Tromey <tom@tromey.com>
Tue, 19 Sep 2023 23:35:08 +0000 (17:35 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 28 Jan 2024 17:58:17 +0000 (10:58 -0700)
This changes inside_main_func to search only for functions.

gdb/frame.c

index 9e286a4272bf1e7b091a9bfaf9bf4ec88deb6f63..fae89cbbc0ac24eb17126b4ce609f2fdee086223 100644 (file)
@@ -2560,13 +2560,9 @@ inside_main_func (frame_info_ptr this_frame)
         symbol with the name of the main function.  In this case we should
         search the full symbols to see if we can find a match.  */
       struct block_symbol bs = lookup_symbol (name, nullptr,
-                                             SEARCH_VFT, nullptr);
+                                             SEARCH_FUNCTION_DOMAIN, nullptr);
 
-      /* We might have found some unrelated symbol.  For example, the
-        Rust compiler can emit both a subprogram and a namespace with
-        the same name in the same scope; and due to how gdb's symbol
-        tables currently work, we can't request the one we'd
-        prefer.  */
+      /* This lookup should always yield a block-valued symbol.  */
       if (bs.symbol != nullptr && bs.symbol->aclass () == LOC_BLOCK)
        {
          const struct block *block = bs.symbol->value_block ();