SourceManager::GetDefaultFileAndLine locates the executable's main to pick a default source file, used for input like "break set -l N" with no file specified. It searched for main by full name, but a function's linkage name can differ from its source name, in which case a full-name search for "main" does not find it and no default file is chosen. For example, wasi-libc renames main to __main_argc_argv, so on WebAssembly the debug function for main was never matched and "break set -l N" failed with "no default file available". When we can't find "main", fall back to searching by base name.
10 lines
325 B
C++
10 lines
325 B
C++
// A function whose base name is also "main". Being a real debug function (not
|
|
// just a symbol), it competes with the entry point in a base-name lookup and
|
|
// must not be mistaken for it when choosing the default source file.
|
|
namespace ns {
|
|
int main() {
|
|
int value = 1;
|
|
return value; // ns::main body
|
|
}
|
|
} // namespace ns
|