[Lldb-commits] [lldb] r217714 - Make ProcessLaunchInfo copyable.

jingham at apple.com jingham at apple.com
Fri Sep 12 16:00:03 PDT 2014


Hey Zachary, 

at some point I'll finish up the "lldb coding conventions" document, but till I get around to the full thing, one of the bullet items it will have is not to use this form of listing the initializations:

> +    : ProcessInfo()
> +    , m_working_dir()
> +    , m_plugin_name()
> +    , m_shell()
> +    , m_flags(launch_flags)
> +    , m_file_actions()
> +    , m_pty(new lldb_utility::PseudoTerminal)

Please use the form that you find pretty much everywhere in lldb, like this code was prior to this change.

Thanks,

Jim


> On Sep 12, 2014, at 3:38 PM, Zachary Turner <zturner at google.com> wrote:
> 
> Author: zturner
> Date: Fri Sep 12 17:38:39 2014
> New Revision: 217714
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=217714&view=rev
> Log:
> Make ProcessLaunchInfo copyable.
> 
> Modified:
>    lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
>    lldb/trunk/source/Target/ProcessLaunchInfo.cpp
> 
> Modified: lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h?rev=217714&r1=217713&r2=217714&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h (original)
> +++ lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h Fri Sep 12 17:38:39 2014
> @@ -169,7 +169,7 @@ namespace lldb_private
>         lldb_utility::PseudoTerminal &
>         GetPTY ()
>         {
> -            return m_pty;
> +            return *m_pty;
>         }
> 
>         lldb::ListenerSP
> @@ -212,7 +212,7 @@ namespace lldb_private
>         std::string m_shell;
>         Flags m_flags;       // Bitwise OR of bits from lldb::LaunchFlags
>         std::vector<FileAction> m_file_actions; // File actions for any other files
> -        lldb_utility::PseudoTerminal m_pty;
> +        std::shared_ptr<lldb_utility::PseudoTerminal> m_pty;
>         uint32_t m_resume_count; // How many times do we resume after launching
>         Host::MonitorChildProcessCallback m_monitor_callback;
>         void *m_monitor_callback_baton;
> 
> Modified: lldb/trunk/source/Target/ProcessLaunchInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessLaunchInfo.cpp?rev=217714&r1=217713&r2=217714&view=diff
> ==============================================================================
> --- lldb/trunk/source/Target/ProcessLaunchInfo.cpp (original)
> +++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp Fri Sep 12 17:38:39 2014
> @@ -31,7 +31,7 @@ ProcessLaunchInfo::ProcessLaunchInfo ()
>     m_shell (),
>     m_flags (0),
>     m_file_actions (),
> -    m_pty (),
> +    m_pty (new lldb_utility::PseudoTerminal),
>     m_resume_count (0),
>     m_monitor_callback (NULL),
>     m_monitor_callback_baton (NULL),
> @@ -41,19 +41,19 @@ ProcessLaunchInfo::ProcessLaunchInfo ()
> }
> 
> ProcessLaunchInfo::ProcessLaunchInfo(const char *stdin_path, const char *stdout_path, const char *stderr_path,
> -                                     const char *working_directory, uint32_t launch_flags) :
> -    ProcessInfo(),
> -    m_working_dir(),
> -    m_plugin_name(),
> -    m_shell(),
> -    m_flags(launch_flags),
> -    m_file_actions(),
> -    m_pty(),
> -    m_resume_count(0),
> -    m_monitor_callback(NULL),
> -    m_monitor_callback_baton(NULL),
> -    m_monitor_signals(false),
> -    m_hijack_listener_sp()
> +                                     const char *working_directory, uint32_t launch_flags)
> +    : ProcessInfo()
> +    , m_working_dir()
> +    , m_plugin_name()
> +    , m_shell()
> +    , m_flags(launch_flags)
> +    , m_file_actions()
> +    , m_pty(new lldb_utility::PseudoTerminal)
> +    , m_resume_count(0)
> +    , m_monitor_callback(NULL)
> +    , m_monitor_callback_baton(NULL)
> +    , m_monitor_signals(false)
> +    , m_hijack_listener_sp()
> {
>     if (stdin_path)
>     {
> @@ -304,8 +304,8 @@ ProcessLaunchInfo::FinalizeFileActions (
>                 AppendOpenFileAction(STDERR_FILENO, path, false, true);
> 
>             if (default_to_use_pty && (!in_path || !out_path || !err_path)) {
> -                if (m_pty.OpenFirstAvailableMaster(O_RDWR| O_NOCTTY, NULL, 0)) {
> -                    const char *slave_path = m_pty.GetSlaveName(NULL, 0);
> +                if (m_pty->OpenFirstAvailableMaster(O_RDWR| O_NOCTTY, NULL, 0)) {
> +                    const char *slave_path = m_pty->GetSlaveName(NULL, 0);
> 
>                     if (!in_path) {
>                         AppendOpenFileAction(STDIN_FILENO, slave_path, true, false);
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list