if (symfile_objfile == nullptr)
return false;
+ CORE_ADDR sym_addr;
+ const char *name = main_name ();
bound_minimal_symbol msymbol
- = lookup_minimal_symbol (main_name (), NULL, symfile_objfile);
+ = lookup_minimal_symbol (name, NULL, symfile_objfile);
if (msymbol.minsym == nullptr)
- return false;
+ {
+ /* In some language (for example Fortran) there will be no minimal
+ 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, NULL, VAR_DOMAIN, 0);
+ if (bs.symbol == nullptr)
+ return false;
+
+ const struct block *block = SYMBOL_BLOCK_VALUE (bs.symbol);
+ gdb_assert (block != nullptr);
+ sym_addr = BLOCK_START (block);
+ }
+ else
+ sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
- /* Make certain that the code, and not descriptor, address is
- returned. */
- CORE_ADDR maddr
+ /* Convert any function descriptor addresses into the actual function
+ code address. */
+ sym_addr
= gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame),
- BMSYMBOL_VALUE_ADDRESS (msymbol),
- current_top_target ());
+ sym_addr, current_top_target ());
- return maddr == get_frame_func (this_frame);
+ return sym_addr == get_frame_func (this_frame);
}
/* Test whether THIS_FRAME is inside the process entry point function. */
"#6\\s+$hex in mixed_func_1c \\(\[^\r\n\]+\\) at \[^\r\n\]+" \
"#7\\s+$hex in mixed_func_1b \\($1b_args\\) at \[^\r\n\]+" \
"#8\\s+$hex in mixed_func_1a \\(\\) at \[^\r\n\]+" \
- "#9\\s+$hex in mixed_stack_main \\(\\) at \[^\r\n\]+" \
- "#10\\s+$hex in main \\(\[^\r\n\]+\\) at .*" ]
+ "#9\\s+$hex in mixed_stack_main \\(\\) at \[^\r\n\]+" ]
gdb_test "bt -frame-arguments all" $bt_stack
# Check the language for frame #0.