[debugserver] Use class member initialization for RNBContext

Address Shafik Yaghmour's post commit code review feedback.
This commit is contained in:
Jonas Devlieghere 2021-04-13 10:23:04 -07:00
parent 6bdaf5e341
commit ae8a5c6852
1 changed files with 13 additions and 16 deletions

View File

@ -43,12 +43,7 @@ public:
all_event_bits = sticky_event_bits | normal_event_bits all_event_bits = sticky_event_bits | normal_event_bits
} event_t; } event_t;
// Constructors and Destructors // Constructors and Destructors
RNBContext() RNBContext() = default;
: m_pid(INVALID_NUB_PROCESS), m_pid_stop_count(0),
m_events(0, all_event_bits), m_pid_pthread(), m_launch_status(),
m_arg_vec(), m_env_vec(), m_detach_on_error(false),
m_unmask_signals(false) {}
virtual ~RNBContext(); virtual ~RNBContext();
nub_process_t ProcessID() const { return m_pid; } nub_process_t ProcessID() const { return m_pid; }
@ -132,24 +127,26 @@ public:
protected: protected:
// Classes that inherit from RNBContext can see and modify these // Classes that inherit from RNBContext can see and modify these
nub_process_t m_pid; nub_process_t m_pid = INVALID_NUB_PROCESS;
std::string m_stdin; std::string m_stdin;
std::string m_stdout; std::string m_stdout;
std::string m_stderr; std::string m_stderr;
std::string m_working_dir; std::string m_working_dir;
nub_size_t m_pid_stop_count; nub_size_t m_pid_stop_count = 0;
PThreadEvent m_events; // Threaded events that we can wait for /// Threaded events that we can wait for.
PThreadEvent m_events{0, all_event_bits};
pthread_t m_pid_pthread; pthread_t m_pid_pthread;
nub_launch_flavor_t m_launch_flavor; // How to launch our inferior process /// How to launch our inferior process.
DNBError nub_launch_flavor_t m_launch_flavor = eLaunchFlavorDefault;
m_launch_status; // This holds the status from the last launch attempt. /// This holds the status from the last launch attempt.
DNBError m_launch_status;
std::vector<std::string> m_arg_vec; std::vector<std::string> m_arg_vec;
std::vector<std::string> /// This will be unparsed entries FOO=value
m_env_vec; // This will be unparsed - entries FOO=value std::vector<std::string> m_env_vec;
std::string m_working_directory; std::string m_working_directory;
std::string m_process_event; std::string m_process_event;
bool m_detach_on_error; bool m_detach_on_error = false;
bool m_unmask_signals; bool m_unmask_signals = false;
void StartProcessStatusThread(); void StartProcessStatusThread();
void StopProcessStatusThread(); void StopProcessStatusThread();