pid_t AppExecutor::Execute(const AppInfo* app_info) {
auto& b = const_cast<tizen_base::Bundle&>(app_info->GetBundle());
- Debug::GetInst().PrepareDebugger(b);
- AddAulEnvKeys(&b);
- if (process_pool_->IsPrepared()) {
+ if (!Debug::GetInst().PrepareDebugger(b) && process_pool_->IsPrepared()) {
+ AddAulEnvKeys(&b);
tizen_base::Parcel parcel;
parcel.WriteParcelable(*app_info);
pid_t pid = process_pool_->Execute(parcel);
process_pool_->HandleSigchld(pid);
}
-
void AppExecutor::OnExecution() {
UserTracer::Print(std::to_string(getpid()) + "|after calling fork(). " +
app_info_->GetAppId());
return true;
}
-void Debug::PrepareDebugger(const tizen_base::Bundle& b) {
+bool Debug::PrepareDebugger(const tizen_base::Bundle& b) {
debugger_info_.reset();
debug_argv_.clear();
auto debugger = b.GetString(kAulSdk);
- if (debugger.empty()) return;
+ if (debugger.empty()) return false;
_D("[DEBUG] Debugger: %s", debugger.c_str());
auto found = debugger_infos_.find(debugger);
if (found == debugger_infos_.end()) {
_W("Failed to find debugger(%s)", debugger.c_str());
- return;
+ return false;
}
debugger_info_ = found->second;
RemoveFiles(debugger_info_->GetUnlinkList());
- const_cast<tizen_base::Bundle&>(b).Add(kAulDebugExtraEnvList,
- debugger_info_->GetExtraEnvList());
+ if (!debugger_info_->GetExtraEnvList().empty()) {
+ const_cast<tizen_base::Bundle&>(b).Add(kAulDebugExtraEnvList,
+ debugger_info_->GetExtraEnvList());
+ }
+
auto appid = b.GetString(kAulAppId);
if (CheckAsanApp(appid))
const_cast<tizen_base::Bundle&>(b).Add(kAulTizenAsanActivation, "true");
for (const auto& last_extra_key : debugger_info_->GetLastExtraKeyList())
ParseAndAddExtraArgv(b, last_extra_key);
+
+ return true;
}
bool Debug::CheckAsanApp(const std::string& appid) {
void Init();
void Dispose();
bool Load();
- void PrepareDebugger(const tizen_base::Bundle& b);
+ bool PrepareDebugger(const tizen_base::Bundle& b);
std::vector<std::string> GetExtraArgv() const;
std::vector<std::string> GetArgv() const;
bool ShouldAttach() const;