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.
11 lines
273 B
C++
11 lines
273 B
C++
// The real entry point. The default source file for line-only breakpoints
|
|
// should resolve to this file, not to other.cpp's ns::main.
|
|
namespace ns {
|
|
int main();
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
int local = argc; // BREAK: entry point
|
|
return ns::main() + local;
|
|
}
|