@@ -120,53 +120,22 @@ Driver::Driver()
120
120
121
121
Driver::~Driver () { g_driver = NULL ; }
122
122
123
- Driver::OptionData::OptionData ()
124
- : m_args(), m_script_lang(lldb::eScriptLanguageDefault), m_core_file(),
125
- m_crash_log(), m_initial_commands(), m_after_file_commands(),
126
- m_after_crash_commands(), m_debug_mode(false ), m_source_quietly(false ),
127
- m_print_version(false ), m_print_python_path(false ), m_wait_for(false ),
128
- m_repl(false ), m_repl_lang(eLanguageTypeUnknown), m_repl_options(),
129
- m_process_name(), m_process_pid(LLDB_INVALID_PROCESS_ID),
130
- m_use_external_editor(false ), m_batch(false ), m_seen_options() {}
131
-
132
- Driver::OptionData::~OptionData () {}
133
-
134
- void Driver::OptionData::Clear () {
135
- m_args.clear ();
136
- m_script_lang = lldb::eScriptLanguageDefault;
137
- m_initial_commands.clear ();
138
- m_after_file_commands.clear ();
139
-
140
- // If there is a local .lldbinit, add that to the
141
- // list of things to be sourced, if the settings
142
- // permit it.
123
+ void Driver::OptionData::AddLocalLLDBInit () {
124
+ // If there is a local .lldbinit, add that to the list of things to be
125
+ // sourced, if the settings permit it.
143
126
SBFileSpec local_lldbinit (" .lldbinit" , true );
144
-
145
127
SBFileSpec homedir_dot_lldb = SBHostOS::GetUserHomeDirectory ();
146
128
homedir_dot_lldb.AppendPathComponent (" .lldbinit" );
147
129
148
- // Only read .lldbinit in the current working directory
149
- // if it's not the same as the .lldbinit in the home
150
- // directory (which is already being read in).
130
+ // Only read .lldbinit in the current working directory if it's not the same
131
+ // as the .lldbinit in the home directory (which is already being read in).
151
132
if (local_lldbinit.Exists () && strcmp (local_lldbinit.GetDirectory (),
152
133
homedir_dot_lldb.GetDirectory ()) != 0 ) {
153
- char path[2048 ];
154
- local_lldbinit.GetPath (path, 2047 );
134
+ char path[PATH_MAX ];
135
+ local_lldbinit.GetPath (path, sizeof (path) );
155
136
InitialCmdEntry entry (path, true , true , true );
156
137
m_after_file_commands.push_back (entry);
157
138
}
158
-
159
- m_debug_mode = false ;
160
- m_source_quietly = false ;
161
- m_print_version = false ;
162
- m_print_python_path = false ;
163
- m_use_external_editor = false ;
164
- m_wait_for = false ;
165
- m_process_name.erase ();
166
- m_batch = false ;
167
- m_after_crash_commands.clear ();
168
-
169
- m_process_pid = LLDB_INVALID_PROCESS_ID;
170
139
}
171
140
172
141
void Driver::OptionData::AddInitialCommand (std::string command,
@@ -201,8 +170,6 @@ void Driver::OptionData::AddInitialCommand(std::string command,
201
170
command_set->push_back (InitialCmdEntry (command, is_file, false ));
202
171
}
203
172
204
- void Driver::ResetOptionValues () { m_option_data.Clear (); }
205
-
206
173
const char *Driver::GetFilename () const {
207
174
if (m_option_data.m_args .empty ())
208
175
return NULL ;
@@ -284,7 +251,7 @@ bool Driver::GetDebugMode() const { return m_option_data.m_debug_mode; }
284
251
// user only wanted help or version information.
285
252
SBError Driver::ProcessArgs (const opt::InputArgList &args, bool &exiting) {
286
253
SBError error;
287
- ResetOptionValues ();
254
+ m_option_data. AddLocalLLDBInit ();
288
255
289
256
// This is kind of a pain, but since we make the debugger in the Driver's
290
257
// constructor, we can't know at that point whether we should read in init
0 commit comments