[Lldb-commits] [lldb] 8a5af9e - [debugserver] Fix unintialized member variable

Shafik Yaghmour via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 13 09:56:07 PDT 2021


I might be missing something here but I think 

m_launch_flavor

Is also uninitialized. 

It looks like using in class member initialization would be a better fix for any case where the constructor is just a member initialization list with an empty body.

> On Apr 13, 2021, at 9:47 AM, Jonas Devlieghere via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> 
> Author: Jonas Devlieghere
> Date: 2021-04-13T09:46:59-07:00
> New Revision: 8a5af9e28443ce8290388439f9e36cf2727d7761
> 
> URL: https://github.com/llvm/llvm-project/commit/8a5af9e28443ce8290388439f9e36cf2727d7761
> DIFF: https://github.com/llvm/llvm-project/commit/8a5af9e28443ce8290388439f9e36cf2727d7761.diff
> 
> LOG: [debugserver] Fix unintialized member variable
> 
> Caught by ubsan (__ubsan_handle_load_invalid_value_abort) when running
> the unit tests.
> 
> Added: 
> 
> 
> Modified: 
>    lldb/tools/debugserver/source/RNBContext.h
> 
> Removed: 
> 
> 
> 
> ################################################################################
> diff  --git a/lldb/tools/debugserver/source/RNBContext.h b/lldb/tools/debugserver/source/RNBContext.h
> index 0b46151e47857..03cd7f350e63b 100644
> --- a/lldb/tools/debugserver/source/RNBContext.h
> +++ b/lldb/tools/debugserver/source/RNBContext.h
> @@ -46,7 +46,8 @@ class RNBContext {
>   RNBContext()
>       : 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_arg_vec(), m_env_vec(), m_detach_on_error(false),
> +        m_unmask_signals(false) {}
> 
>   virtual ~RNBContext();
> 
> @@ -148,11 +149,11 @@ class RNBContext {
>   std::string m_working_directory;
>   std::string m_process_event;
>   bool m_detach_on_error;
> +  bool m_unmask_signals;
> 
>   void StartProcessStatusThread();
>   void StopProcessStatusThread();
>   static void *ThreadFunctionProcessStatus(void *arg);
> -  bool m_unmask_signals;
> 
> private:
>   RNBContext(const RNBContext &rhs) = delete;
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list