@@ -55,8 +55,8 @@ Status TargetList::CreateTarget(Debugger &debugger,
55
55
const OptionGroupPlatform *platform_options,
56
56
TargetSP &target_sp) {
57
57
return CreateTargetInternal (debugger, user_exe_path, triple_str,
58
- load_dependent_files, platform_options, target_sp,
59
- false );
58
+ load_dependent_files, platform_options,
59
+ target_sp );
60
60
}
61
61
62
62
Status TargetList::CreateTarget (Debugger &debugger,
@@ -65,15 +65,13 @@ Status TargetList::CreateTarget(Debugger &debugger,
65
65
LoadDependentFiles load_dependent_files,
66
66
PlatformSP &platform_sp, TargetSP &target_sp) {
67
67
return CreateTargetInternal (debugger, user_exe_path, specified_arch,
68
- load_dependent_files, platform_sp, target_sp,
69
- false );
68
+ load_dependent_files, platform_sp, target_sp);
70
69
}
71
70
72
71
Status TargetList::CreateTargetInternal (
73
72
Debugger &debugger, llvm::StringRef user_exe_path,
74
73
llvm::StringRef triple_str, LoadDependentFiles load_dependent_files,
75
- const OptionGroupPlatform *platform_options, TargetSP &target_sp,
76
- bool is_dummy_target) {
74
+ const OptionGroupPlatform *platform_options, TargetSP &target_sp) {
77
75
Status error;
78
76
79
77
// Let's start by looking at the selected platform.
@@ -256,7 +254,7 @@ Status TargetList::CreateTargetInternal(
256
254
if (!prefer_platform_arch && arch.IsValid ()) {
257
255
if (!platform_sp->IsCompatibleArchitecture (arch, false , nullptr )) {
258
256
platform_sp = Platform::GetPlatformForArchitecture (arch, &platform_arch);
259
- if (!is_dummy_target && platform_sp)
257
+ if (platform_sp)
260
258
debugger.GetPlatformList ().SetSelectedPlatform (platform_sp);
261
259
}
262
260
} else if (platform_arch.IsValid ()) {
@@ -266,53 +264,31 @@ Status TargetList::CreateTargetInternal(
266
264
if (!platform_sp->IsCompatibleArchitecture (platform_arch, false , nullptr )) {
267
265
platform_sp = Platform::GetPlatformForArchitecture (platform_arch,
268
266
&fixed_platform_arch);
269
- if (!is_dummy_target && platform_sp)
267
+ if (platform_sp)
270
268
debugger.GetPlatformList ().SetSelectedPlatform (platform_sp);
271
269
}
272
270
}
273
271
274
272
if (!platform_arch.IsValid ())
275
273
platform_arch = arch;
276
274
277
- return TargetList::CreateTargetInternal (
278
- debugger, user_exe_path, platform_arch, load_dependent_files, platform_sp,
279
- target_sp, is_dummy_target);
280
- }
281
-
282
- lldb::TargetSP TargetList::GetDummyTarget (lldb_private::Debugger &debugger) {
283
- // FIXME: Maybe the dummy target should be per-Debugger
284
- if (!m_dummy_target_sp || !m_dummy_target_sp->IsValid ()) {
285
- ArchSpec arch (Target::GetDefaultArchitecture ());
286
- if (!arch.IsValid ())
287
- arch = HostInfo::GetArchitecture ();
288
- Status err = CreateDummyTarget (
289
- debugger, arch.GetTriple ().getTriple ().c_str (), m_dummy_target_sp);
290
- }
291
-
292
- return m_dummy_target_sp;
293
- }
294
-
295
- Status TargetList::CreateDummyTarget (Debugger &debugger,
296
- llvm::StringRef specified_arch_name,
297
- lldb::TargetSP &target_sp) {
298
- PlatformSP host_platform_sp (Platform::GetHostPlatform ());
299
- return CreateTargetInternal (
300
- debugger, (const char *)nullptr , specified_arch_name, eLoadDependentsNo,
301
- (const OptionGroupPlatform *)nullptr , target_sp, true );
275
+ return TargetList::CreateTargetInternal (debugger, user_exe_path,
276
+ platform_arch, load_dependent_files,
277
+ platform_sp, target_sp);
302
278
}
303
279
304
280
Status TargetList::CreateTargetInternal (Debugger &debugger,
305
281
llvm::StringRef user_exe_path,
306
282
const ArchSpec &specified_arch,
307
283
LoadDependentFiles load_dependent_files,
308
284
lldb::PlatformSP &platform_sp,
309
- lldb::TargetSP &target_sp,
310
- bool is_dummy_target) {
285
+ lldb::TargetSP &target_sp) {
311
286
static Timer::Category func_cat (LLVM_PRETTY_FUNCTION);
312
287
Timer scoped_timer (
313
288
func_cat, " TargetList::CreateTarget (file = '%s', arch = '%s')" ,
314
289
user_exe_path.str ().c_str (), specified_arch.GetArchitectureName ());
315
290
Status error;
291
+ const bool is_dummy_target = false ;
316
292
317
293
ArchSpec arch (specified_arch);
318
294
@@ -418,16 +394,11 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
418
394
target_sp->AppendExecutableSearchPaths (file_dir);
419
395
}
420
396
421
- // Don't put the dummy target in the target list, it's held separately.
422
- if (!is_dummy_target) {
423
- std::lock_guard<std::recursive_mutex> guard (m_target_list_mutex);
424
- m_selected_target_idx = m_target_list.size ();
425
- m_target_list.push_back (target_sp);
426
- // Now prime this from the dummy target:
427
- target_sp->PrimeFromDummyTarget (debugger.GetDummyTarget ());
428
- } else {
429
- m_dummy_target_sp = target_sp;
430
- }
397
+ std::lock_guard<std::recursive_mutex> guard (m_target_list_mutex);
398
+ m_selected_target_idx = m_target_list.size ();
399
+ m_target_list.push_back (target_sp);
400
+ // Now prime this from the dummy target:
401
+ target_sp->PrimeFromDummyTarget (debugger.GetDummyTarget ());
431
402
432
403
return error;
433
404
}
0 commit comments