BreakpointResolverName (Breakpoint *bkpt,
const char *name,
uint32_t name_type_mask,
+ lldb::LanguageType language,
Breakpoint::MatchType type,
bool skip_prologue);
const char *names[],
size_t num_names,
uint32_t name_type_mask,
+ lldb::LanguageType language,
bool skip_prologue);
// This one takes a C++ array of names. It is always MatchType = Exact.
BreakpointResolverName (Breakpoint *bkpt,
std::vector<std::string> names,
uint32_t name_type_mask,
+ lldb::LanguageType language,
bool skip_prologue);
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
ConstString m_class_name;
RegularExpression m_regex;
Breakpoint::MatchType m_match_type;
+ lldb::LanguageType m_language;
bool m_skip_prologue;
void
/// The mask of bits from lldb::FunctionNameType enumerations
/// that tell us what kind of name we are looking for.
///
+ /// @param[out] language
+ /// If known, the language to use for determining the
+ /// lookup_name_type_mask.
+ ///
/// @param[out] lookup_name
/// The actual name that will be used when calling
/// SymbolVendor::FindFunctions() or Symtab::FindFunctionSymbols()
static void
PrepareForFunctionNameLookup (const ConstString &name,
uint32_t name_type_mask,
+ lldb::LanguageType language,
ConstString &lookup_name,
uint32_t &lookup_name_type_mask,
bool &match_name_after_lookup);
OptionValueArch *
GetPropertyAtIndexAsOptionValueArch (const ExecutionContext *exe_ctx, uint32_t idx) const;
+ OptionValueLanguage *
+ GetPropertyAtIndexAsOptionValueLanguage (const ExecutionContext *exe_ctx, uint32_t idx) const;
+
bool
GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const;
static bool
LanguageIsCPlusPlus (lldb::LanguageType language);
+ static bool
+ LanguageIsObjC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsPascal (lldb::LanguageType language);
+
Process *
GetProcess()
{
bool
GetBreakpointsConsultPlatformAvoidList ();
+ lldb::LanguageType
+ GetLanguage () const;
+
const char *
GetExpressionPrefixContentsAsCString ();
const FileSpecList *containingSourceFiles,
const char *func_name,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
const char *func_names[],
size_t num_names,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
const FileSpecList *containingSourceFiles,
const std::vector<std::string> &func_names,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
- *sb_bp = target_sp->CreateBreakpoint (&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal, hardware);
+ *sb_bp = target_sp->CreateBreakpoint (&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, skip_prologue, internal, hardware);
}
else
{
- *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal, hardware);
+ *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, skip_prologue, internal, hardware);
}
}
comp_unit_list.get(),
symbol_name,
name_type_mask,
+ eLanguageTypeUnknown,
skip_prologue,
internal,
hardware);
symbol_names,
num_names,
name_type_mask,
+ eLanguageTypeUnknown,
skip_prologue,
internal,
hardware);
BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
const char *name_cstr,
uint32_t name_type_mask,
+ LanguageType language,
Breakpoint::MatchType type,
bool skip_prologue) :
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
m_class_name (),
m_regex (),
m_match_type (type),
+ m_language (language),
m_skip_prologue (skip_prologue)
{
const char *names[],
size_t num_names,
uint32_t name_type_mask,
+ LanguageType language,
bool skip_prologue) :
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
m_match_type (Breakpoint::Exact),
+ m_language (language),
m_skip_prologue (skip_prologue)
{
for (size_t i = 0; i < num_names; i++)
BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
std::vector<std::string> names,
uint32_t name_type_mask,
+ LanguageType language,
bool skip_prologue) :
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
m_match_type (Breakpoint::Exact),
+ m_language (language),
m_skip_prologue (skip_prologue)
{
for (const std::string& name : names)
m_class_name (NULL),
m_regex (func_regex),
m_match_type (Breakpoint::Regexp),
+ m_language (eLanguageTypeUnknown),
m_skip_prologue (skip_prologue)
{
}
m_class_name (class_name),
m_regex (),
m_match_type (type),
+ m_language (eLanguageTypeUnknown),
m_skip_prologue (skip_prologue)
{
LookupInfo lookup;
m_class_name(rhs.m_class_name),
m_regex(rhs.m_regex),
m_match_type (rhs.m_match_type),
+ m_language (rhs.m_language),
m_skip_prologue (rhs.m_skip_prologue)
{
{
LookupInfo lookup;
lookup.name = name;
- Module::PrepareForFunctionNameLookup(lookup.name, name_type_mask, lookup.lookup_name, lookup.name_type_mask, lookup.match_name_after_lookup);
+ Module::PrepareForFunctionNameLookup(lookup.name, name_type_mask, m_language, lookup.lookup_name, lookup.name_type_mask, lookup.match_name_after_lookup);
m_lookups.push_back (lookup);
}
}
m_throw_bp (true),
m_hardware (false),
m_exception_language (eLanguageTypeUnknown),
+ m_language (lldb::eLanguageTypeUnknown),
m_skip_prologue (eLazyBoolCalculate),
m_one_shot (false),
m_all_files (false),
break;
}
+ case 'L':
+ m_language = LanguageRuntime::GetLanguageTypeFromString (option_arg);
+ if (m_language == eLanguageTypeUnknown)
+ error.SetErrorStringWithFormat ("Unknown language type: '%s' for breakpoint", option_arg);
+ break;
+
case 'm':
{
bool success;
m_throw_bp = true;
m_hardware = false;
m_exception_language = eLanguageTypeUnknown;
+ m_language = lldb::eLanguageTypeUnknown;
m_skip_prologue = eLazyBoolCalculate;
m_one_shot = false;
m_use_dummy = false;
bool m_throw_bp;
bool m_hardware; // Request to use hardware breakpoints
lldb::LanguageType m_exception_language;
+ lldb::LanguageType m_language;
LazyBool m_skip_prologue;
bool m_one_shot;
bool m_use_dummy;
&(m_options.m_filenames),
m_options.m_func_names,
name_type_mask,
+ m_options.m_language,
m_options.m_skip_prologue,
internal,
m_options.m_hardware).get();
#define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10 )
#define LLDB_OPT_SKIP_PROLOGUE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) )
#define LLDB_OPT_MOVE_TO_NEAREST_CODE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_9 )
+#define LLDB_OPT_EXPR_LANGUAGE ( LLDB_OPT_SET_FROM_TO(3, 8) & ~LLDB_OPT_SET_7 )
OptionDefinition
CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
// { LLDB_OPT_SET_10, false, "exception-typename", 'O', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeTypeName,
// "The breakpoint will only stop if an exception Object of this type is thrown. Can be repeated multiple times to stop for multiple object types" },
+ { LLDB_OPT_EXPR_LANGUAGE, false, "language", 'L', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage,
+ "Specifies the Language to use when interpreting the breakpoint's expression (note: currently only implemented for breakpoints identifiers). If not set the target.language setting is used." },
+
{ LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
"sKip the prologue if the breakpoint is at the beginning of a function. If not set the target.skip-prologue setting is used." },
bool match_name_after_lookup = false;
Module::PrepareForFunctionNameLookup (name,
name_type_mask,
+ eLanguageTypeUnknown, // TODO: add support
lookup_name,
lookup_name_type_mask,
match_name_after_lookup);
void
Module::PrepareForFunctionNameLookup (const ConstString &name,
uint32_t name_type_mask,
+ LanguageType language,
ConstString &lookup_name,
uint32_t &lookup_name_type_mask,
bool &match_name_after_lookup)
{
if (CPPLanguageRuntime::IsCPPMangledName (name_cstr))
lookup_name_type_mask = eFunctionNameTypeFull;
- else if (ObjCLanguageRuntime::IsPossibleObjCMethodName (name_cstr))
+ else if ((language == eLanguageTypeUnknown ||
+ LanguageRuntime::LanguageIsObjC(language)) &&
+ ObjCLanguageRuntime::IsPossibleObjCMethodName (name_cstr))
lookup_name_type_mask = eFunctionNameTypeFull;
+ else if (LanguageRuntime::LanguageIsC(language))
+ {
+ lookup_name_type_mask = eFunctionNameTypeFull;
+ }
else
{
- if (ObjCLanguageRuntime::IsPossibleObjCSelector(name_cstr))
+ if ((language == eLanguageTypeUnknown ||
+ LanguageRuntime::LanguageIsObjC(language)) &&
+ ObjCLanguageRuntime::IsPossibleObjCSelector(name_cstr))
lookup_name_type_mask |= eFunctionNameTypeSelector;
CPPLanguageRuntime::MethodName cpp_method (name);
uint32_t lookup_name_type_mask = 0;
bool match_name_after_lookup = false;
Module::PrepareForFunctionNameLookup (name, name_type_mask,
+ eLanguageTypeUnknown, // TODO: add support
lookup_name,
lookup_name_type_mask,
match_name_after_lookup);
uint32_t lookup_name_type_mask = 0;
bool match_name_after_lookup = false;
Module::PrepareForFunctionNameLookup (name, name_type_mask,
+ eLanguageTypeUnknown, // TODO: add support
lookup_name,
lookup_name_type_mask,
match_name_after_lookup);
case eVarSetOperationReplace:
case eVarSetOperationAssign:
{
- LanguageType new_type = LanguageRuntime::GetLanguageTypeFromString(value.data());
- m_value_was_set = true;
- m_current_value = new_type;
+ ConstString lang_name(value.trim());
+ LanguageType new_type = LanguageRuntime::GetLanguageTypeFromString(lang_name.GetCString());
+ if (new_type)
+ {
+ m_value_was_set = true;
+ m_current_value = new_type;
+ }
+ else
+ {
+ StreamString error_strm;
+ error_strm.Printf("invalid language type '%s', ", value.str().c_str());
+ error_strm.Printf("valid values are:\n");
+ LanguageRuntime::PrintAllLanguages(error_strm, " ", "\n");
+ error.SetErrorString(error_strm.GetData());
+ }
}
break;
return nullptr;
}
+OptionValueLanguage *
+OptionValueProperties::GetPropertyAtIndexAsOptionValueLanguage (const ExecutionContext *exe_ctx, uint32_t idx) const
+{
+ const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
+ if (property)
+ return property->GetValue()->GetAsLanguage();
+ return nullptr;
+}
+
bool
OptionValueProperties::GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const
{
NULL,
"OSKextLoadedKextSummariesUpdated",
eFunctionNameTypeFull,
+ eLanguageTypeUnknown,
skip_prologue,
internal_bp,
hardware).get();
exception_names.data(),
exception_names.size(),
eFunctionNameTypeBase,
+ eLanguageTypeC_plus_plus,
eLazyBoolNo));
return resolver_sp;
resolver_sp.reset (new BreakpointResolverName (bkpt,
"objc_exception_throw",
eFunctionNameTypeBase,
+ eLanguageTypeObjC,
Breakpoint::Exact,
eLazyBoolNo));
// FIXME: don't do catch yet.
resolver_sp.reset (new BreakpointResolverName (bkpt,
"objc_exception_throw",
eFunctionNameTypeBase,
+ eLanguageTypeObjC,
Breakpoint::Exact,
eLazyBoolNo));
// FIXME: We don't do catch breakpoints for ObjC yet.
g_bp_names,
llvm::array_lengthof(g_bp_names),
eFunctionNameTypeFull,
+ eLanguageTypeUnknown,
skip_prologue,
internal,
hardware);
{ "renderscript", eLanguageTypeExtRenderScript},
// Now synonyms, in arbitrary order
{ "objc", eLanguageTypeObjC },
- { "objc++", eLanguageTypeObjC_plus_plus }
+ { "objc++", eLanguageTypeObjC_plus_plus },
+ { "pascal", eLanguageTypePascal83 }
};
static uint32_t num_languages = sizeof(language_names) / sizeof (struct language_name_pair);
}
}
+bool
+LanguageRuntime::LanguageIsObjC (LanguageType language)
+{
+ switch (language)
+ {
+ case eLanguageTypeObjC:
+ case eLanguageTypeObjC_plus_plus:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+LanguageRuntime::LanguageIsC (LanguageType language)
+{
+ switch (language)
+ {
+ case eLanguageTypeC:
+ case eLanguageTypeC89:
+ case eLanguageTypeC99:
+ case eLanguageTypeC11:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+LanguageRuntime::LanguageIsPascal (LanguageType language)
+{
+ switch (language)
+ {
+ case eLanguageTypePascal83:
+ return true;
+ default:
+ return false;
+ }
+}
+
void
LanguageRuntime::InitializeCommands (CommandObject* parent)
{
const FileSpecList *containingSourceFiles,
const char *func_name,
uint32_t func_name_type_mask,
+ LanguageType language,
LazyBool skip_prologue,
bool internal,
bool hardware)
if (skip_prologue == eLazyBoolCalculate)
skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
+ if (language == lldb::eLanguageTypeUnknown)
+ language = GetLanguage();
BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL,
func_name,
func_name_type_mask,
+ language,
Breakpoint::Exact,
skip_prologue));
bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
const FileSpecList *containingSourceFiles,
const std::vector<std::string> &func_names,
uint32_t func_name_type_mask,
+ LanguageType language,
LazyBool skip_prologue,
bool internal,
bool hardware)
if (skip_prologue == eLazyBoolCalculate)
skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
+ if (language == lldb::eLanguageTypeUnknown)
+ language = GetLanguage();
BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL,
func_names,
func_name_type_mask,
+ language,
skip_prologue));
bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
const char *func_names[],
size_t num_names,
uint32_t func_name_type_mask,
+ LanguageType language,
LazyBool skip_prologue,
bool internal,
bool hardware)
if (skip_prologue == eLazyBoolCalculate)
skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
+ if (language == lldb::eLanguageTypeUnknown)
+ language = GetLanguage();
+
BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL,
func_names,
num_names,
func_name_type_mask,
+ language,
skip_prologue));
bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
}
{
{ "default-arch" , OptionValue::eTypeArch , true , 0 , NULL, NULL, "Default architecture to choose, when there's a choice." },
{ "move-to-nearest-code" , OptionValue::eTypeBoolean , false, true , NULL, NULL, "Move breakpoints to nearest code." },
+ { "language" , OptionValue::eTypeLanguage , false, eLanguageTypeUnknown , NULL, NULL, "The language to use when interpreting expressions entered in commands (note: currently only implemented for breakpoints identifiers)." },
{ "expr-prefix" , OptionValue::eTypeFileSpec , false, 0 , NULL, NULL, "Path to a file containing expressions to be prepended to all expressions." },
{ "prefer-dynamic-value" , OptionValue::eTypeEnum , false, eDynamicDontRunTarget , NULL, g_dynamic_value_types, "Should printed values be shown as their dynamic value." },
{ "enable-synthetic-value" , OptionValue::eTypeBoolean , false, true , NULL, NULL, "Should synthetic values be used by default whenever available." },
{
ePropertyDefaultArch,
ePropertyMoveToNearestCode,
+ ePropertyLanguage,
ePropertyExprPrefix,
ePropertyPreferDynamic,
ePropertyEnableSynthetic,
return m_collection_sp->GetPropertyAtIndexAsFileSpec(NULL, idx);
}
+LanguageType
+TargetProperties::GetLanguage () const
+{
+ OptionValueLanguage *value = m_collection_sp->GetPropertyAtIndexAsOptionValueLanguage (NULL, ePropertyLanguage);
+ if (value)
+ return value->GetCurrentValue();
+ return LanguageType();
+}
+
const char *
TargetProperties::GetExpressionPrefixContentsAsCString ()
{
LEVEL = ../../../make
-C_SOURCES := main.c
+CXX_SOURCES := main.cpp foo.cpp
include $(LEVEL)/Makefile.rules
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
- self.line = line_number('main.c', '// Set break point at this line.')
+ self.line = line_number('main.cpp', '// Set break point at this line.')
def breakpoint_options_test(self):
"""Test breakpoint command for different options."""
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, extra_options = "-K 1", num_expected_locations = 1)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, extra_options = "-K 0", num_expected_locations = 1)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-K 1", num_expected_locations = 1)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-K 0", num_expected_locations = 1)
# This should create a breakpoint 0 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, extra_options = "-m 0", num_expected_locations = 0)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-m 0", num_expected_locations = 0)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Check the list of breakpoint.
self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line,
- "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line,
- "3: file = 'main.c', line = %d, exact_match = 1, locations = 0" % self.line])
+ substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line,
+ "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line,
+ "3: file = 'main.cpp', line = %d, exact_match = 1, locations = 0" % self.line])
# Continue the program, there should be another stop.
self.runCmd("process continue")
self.expect("process status", "Process exited successfully",
patterns = ["^Process [0-9]+ exited with status = 0"])
+ def breakpoint_options_language_test(self):
+ """Test breakpoint command for language option."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # This should create a breakpoint with 1 locations.
+ lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c++", num_expected_locations=1)
+
+ # This should create a breakpoint 0 locations.
+ lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c", num_expected_locations=0)
+ self.runCmd("settings set target.language c")
+ lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, num_expected_locations=0)
+
+ # Run the program.
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # Stopped once.
+ self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ["stop reason = breakpoint 1."])
+
+ # Continue the program, we should exit.
+ self.runCmd("process continue")
+
+ # We should exit.
+ self.expect("process status", "Process exited successfully",
+ patterns = ["^Process [0-9]+ exited with status = 0"])
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
--- /dev/null
+
+namespace ns {
+ int func(void)
+ {
+ return 0;
+ }
+}
+
+extern "C" int foo(void)
+{
+ return ns::func();
+}
// Set break point at this line.
+extern "C" int foo(void);
int
main (int argc, char **argv)
{
- return 0;
+ return foo();
}
self.expect ("settings show stop-disassembly-display", SETTING_MSG("stop-disassembly-display"),
startstr = 'stop-disassembly-display (enum) = always')
self.runCmd("settings clear stop-disassembly-display", check=False)
+ # language
+ self.runCmd ("settings set target.language c89") # Set to known value
+ self.runCmd ("settings set target.language pascal ") # Set to new value with trailing whitespace
+ self.expect ("settings show target.language", SETTING_MSG("target.language"),
+ startstr = "target.language (language) = pascal")
+ self.runCmd("settings clear target.language", check=False)
# arguments
self.runCmd ("settings set target.run-args 1 2 3") # Set to known value
self.runCmd ("settings set target.run-args 3 4 5 ") # Set to new value with trailing whitespaces
"target.default-arch",
"target.move-to-nearest-code",
"target.expr-prefix",
+ "target.language",
"target.prefer-dynamic-value",
"target.enable-synthetic-value",
"target.skip-prologue",
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")
+ # Test that the target.language=pascal setting works and that BP #5 is not set
+ self.runCmd("-interpreter-exec console \"settings set target.language c\"")
+ self.expect("\^done")
+ self.runCmd("-break-insert ns.foo1")
+ self.expect("\^error")
+
+ # Test that the target.language=c++ setting works and that BP #6 is hit
+ # FIXME: lldb-mi interprets 'ns::func' as file:func where file='ns:'.
+ #self.runCmd("-interpreter-exec console \"settings set target.language c++\"")
+ #self.expect("\^done")
+ #self.runCmd("-break-insert ns::foo1")
+ #self.expect("\^done,bkpt={number=\"6\"")
+ #self.runCmd("-exec-run")
+ #self.expect("\^running")
+ #self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"6\"")
+
# Test that BP #1 and #2 weren't set by running to program exit
self.runCmd("-exec-continue")
self.expect("\^running")
#include <cstdio>
+namespace ns
+{
+ int foo1(void) { printf("In foo1\n"); return 1; }
+ int foo2(void) { printf("In foo2\n"); return 2; }
+}
+
// BP_before_main
+int x;
int
main(int argc, char const *argv[])
{
printf("Print a formatted string so that GCC does not optimize this printf call: %s\n", argv[0]);
+ x = ns::foo1() + ns::foo2();
return 0; // BP_return
}