[24/29] Use a function-domain search in inside_main_func

Message ID 20231120-submit-domain-hacks-2-v1-24-29650d01b198@tromey.com
State New
Headers
Series Restructure symbol domains |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed

Commit Message

Tom Tromey Nov. 21, 2023, 3:53 a.m. UTC
  This changes inside_main_func to search only for functions.
---
 gdb/frame.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
  

Patch

diff --git a/gdb/frame.c b/gdb/frame.c
index ce558bf6149..e86299491e2 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2566,13 +2566,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 ();