Backtrace* Backtrace::Create(pid_t pid, pid_t tid, BacktraceMap* map) {
  if (pid == BACKTRACE_CURRENT_PROCESS || pid == getpid()) {
    if (tid == BACKTRACE_CURRENT_THREAD || tid == gettid()) {
      return CreateCurrentObj(map);
    } else {
      return CreateThreadObj(tid, map);
    }
  } else if (tid == BACKTRACE_CURRENT_THREAD) {
    return CreatePtraceObj(pid, pid, map);
  } else {
    return CreatePtraceObj(pid, tid, map);
  }
}
Пример #2
0
Backtrace* Backtrace::Create(pid_t pid, pid_t tid, backtrace_map_info_t* map_info) {
  if (pid == BACKTRACE_CURRENT_PROCESS || pid == getpid()) {
    if (tid == BACKTRACE_NO_TID || tid == gettid()) {
      return CreateCurrentObj(map_info);
    } else {
      return CreateThreadObj(tid, map_info);
    }
  } else if (tid == BACKTRACE_NO_TID) {
    return CreatePtraceObj(pid, pid, map_info);
  } else {
    return CreatePtraceObj(pid, tid, map_info);
  }
}