Skip to content

Commit 0a43839

Browse files
committed
[lldb] Suppress unsupported language warning for assembly
The following warning is technically correct, but pretty much useless, since there aren't any frame variables that we'd expect the debugger to understand. This version of LLDB has no plugin for the language "assembler". Inspection of frame variables will be limited. This message is useful in the general case but should be suppressed for the "assembler" case. rdar://92745462
1 parent c6049e6 commit 0a43839

File tree

2 files changed

+62
-54
lines changed

2 files changed

+62
-54
lines changed

lldb/source/Target/Process.cpp

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ ProcessSP Process::FindPlugin(lldb::TargetSP target_sp,
407407
create_callback =
408408
PluginManager::GetProcessCreateCallbackForPluginName(plugin_name);
409409
if (create_callback) {
410-
process_sp = create_callback(target_sp, listener_sp, crash_file_path,
411-
can_connect);
410+
process_sp =
411+
create_callback(target_sp, listener_sp, crash_file_path, can_connect);
412412
if (process_sp) {
413413
if (process_sp->CanDebug(target_sp, true)) {
414414
process_sp->m_process_unique_id = ++g_process_unique_id;
@@ -421,8 +421,8 @@ ProcessSP Process::FindPlugin(lldb::TargetSP target_sp,
421421
(create_callback =
422422
PluginManager::GetProcessCreateCallbackAtIndex(idx)) != nullptr;
423423
++idx) {
424-
process_sp = create_callback(target_sp, listener_sp, crash_file_path,
425-
can_connect);
424+
process_sp =
425+
create_callback(target_sp, listener_sp, crash_file_path, can_connect);
426426
if (process_sp) {
427427
if (process_sp->CanDebug(target_sp, false)) {
428428
process_sp->m_process_unique_id = ++g_process_unique_id;
@@ -541,8 +541,7 @@ Process::~Process() {
541541
ProcessProperties &Process::GetGlobalProperties() {
542542
// NOTE: intentional leak so we don't crash if global destructor chain gets
543543
// called as other threads still use the result of this function
544-
static ProcessProperties *g_settings_ptr =
545-
new ProcessProperties(nullptr);
544+
static ProcessProperties *g_settings_ptr = new ProcessProperties(nullptr);
546545
return *g_settings_ptr;
547546
}
548547

@@ -647,7 +646,7 @@ StateType Process::GetNextEvent(EventSP &event_sp) {
647646
StateType state = eStateInvalid;
648647

649648
if (GetPrimaryListener()->GetEventForBroadcaster(this, event_sp,
650-
std::chrono::seconds(0)) &&
649+
std::chrono::seconds(0)) &&
651650
event_sp)
652651
state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
653652

@@ -745,8 +744,7 @@ StateType Process::WaitForProcessToStop(
745744

746745
bool Process::HandleProcessStateChangedEvent(
747746
const EventSP &event_sp, Stream *stream,
748-
SelectMostRelevant select_most_relevant,
749-
bool &pop_process_io_handler) {
747+
SelectMostRelevant select_most_relevant, bool &pop_process_io_handler) {
750748
const bool handle_pop = pop_process_io_handler;
751749

752750
pop_process_io_handler = false;
@@ -937,8 +935,7 @@ bool Process::HandleProcessStateChangedEvent(
937935
process_sp->GetStatus(*stream);
938936
process_sp->GetThreadStatus(*stream, only_threads_with_stop_reason,
939937
start_frame, num_frames,
940-
num_frames_with_source,
941-
stop_format);
938+
num_frames_with_source, stop_format);
942939
if (curr_thread_stop_info_sp) {
943940
lldb::addr_t crashing_address;
944941
ValueObjectSP valobj_sp = StopInfo::GetCrashingDereference(
@@ -1141,7 +1138,7 @@ bool Process::SetProcessExitStatus(
11411138
lldb::pid_t pid, bool exited,
11421139
int signo, // Zero for no signal
11431140
int exit_status // Exit value of process if signal is zero
1144-
) {
1141+
) {
11451142
Log *log = GetLog(LLDBLog::Process);
11461143
LLDB_LOGF(log,
11471144
"Process::SetProcessExitStatus (pid=%" PRIu64
@@ -1346,7 +1343,7 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
13461343

13471344
Log *log(GetLog(LLDBLog::State | LLDBLog::Process));
13481345
LLDB_LOGF(log, "(plugin = %s, state = %s, restarted = %i)",
1349-
GetPluginName().data(), StateAsCString(new_state), restarted);
1346+
GetPluginName().data(), StateAsCString(new_state), restarted);
13501347
const StateType old_state = m_public_state.GetValue();
13511348
m_public_state.SetValue(new_state);
13521349

@@ -1356,15 +1353,15 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
13561353
if (!StateChangedIsExternallyHijacked()) {
13571354
if (new_state == eStateDetached) {
13581355
LLDB_LOGF(log,
1359-
"(plugin = %s, state = %s) -- unlocking run lock for detach",
1360-
GetPluginName().data(), StateAsCString(new_state));
1356+
"(plugin = %s, state = %s) -- unlocking run lock for detach",
1357+
GetPluginName().data(), StateAsCString(new_state));
13611358
m_public_run_lock.SetStopped();
13621359
} else {
13631360
const bool old_state_is_stopped = StateIsStoppedState(old_state, false);
13641361
if ((old_state_is_stopped != new_state_is_stopped)) {
13651362
if (new_state_is_stopped && !restarted) {
13661363
LLDB_LOGF(log, "(plugin = %s, state = %s) -- unlocking run lock",
1367-
GetPluginName().data(), StateAsCString(new_state));
1364+
GetPluginName().data(), StateAsCString(new_state));
13681365
m_public_run_lock.SetStopped();
13691366
}
13701367
}
@@ -1378,7 +1375,7 @@ Status Process::Resume() {
13781375
if (!m_public_run_lock.TrySetRunning()) {
13791376
Status error("Resume request failed - process still running.");
13801377
LLDB_LOGF(log, "(plugin = %s) -- TrySetRunning failed, not resuming.",
1381-
GetPluginName().data());
1378+
GetPluginName().data());
13821379
return error;
13831380
}
13841381
Status error = PrivateResume();
@@ -1458,7 +1455,7 @@ void Process::SetPrivateState(StateType new_state) {
14581455
bool state_changed = false;
14591456

14601457
LLDB_LOGF(log, "(plugin = %s, state = %s)", GetPluginName().data(),
1461-
StateAsCString(new_state));
1458+
StateAsCString(new_state));
14621459

14631460
std::lock_guard<std::recursive_mutex> thread_guard(m_thread_list.GetMutex());
14641461
std::lock_guard<std::recursive_mutex> guard(m_private_state.GetMutex());
@@ -1500,14 +1497,14 @@ void Process::SetPrivateState(StateType new_state) {
15001497
m_mod_id.SetStopEventForLastNaturalStopID(event_sp);
15011498
m_memory_cache.Clear();
15021499
LLDB_LOGF(log, "(plugin = %s, state = %s, stop_id = %u",
1503-
GetPluginName().data(), StateAsCString(new_state),
1504-
m_mod_id.GetStopID());
1500+
GetPluginName().data(), StateAsCString(new_state),
1501+
m_mod_id.GetStopID());
15051502
}
15061503

15071504
m_private_state_broadcaster.BroadcastEvent(event_sp);
15081505
} else {
15091506
LLDB_LOGF(log, "(plugin = %s, state = %s) state didn't change. Ignoring...",
1510-
GetPluginName().data(), StateAsCString(new_state));
1507+
GetPluginName().data(), StateAsCString(new_state));
15111508
}
15121509
}
15131510

@@ -1523,7 +1520,8 @@ addr_t Process::GetImageInfoAddress() { return LLDB_INVALID_ADDRESS; }
15231520

15241521
const lldb::ABISP &Process::GetABI() {
15251522
if (!m_abi_sp)
1526-
m_abi_sp = ABI::FindPlugin(shared_from_this(), GetTarget().GetArchitecture());
1523+
m_abi_sp =
1524+
ABI::FindPlugin(shared_from_this(), GetTarget().GetArchitecture());
15271525
return m_abi_sp;
15281526
}
15291527

@@ -1570,7 +1568,8 @@ LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language) {
15701568
// for example, CPPLanguageRuntime will support eLanguageTypeC_plus_plus,
15711569
// eLanguageTypeC_plus_plus_03, etc. Because of this, we should get the
15721570
// primary language type and make sure that our runtime supports it.
1573-
assert(runtime->GetLanguageType() == Language::GetPrimaryLanguage(language));
1571+
assert(runtime->GetLanguageType() ==
1572+
Language::GetPrimaryLanguage(language));
15741573

15751574
return runtime;
15761575
}
@@ -1961,7 +1960,7 @@ Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) {
19611960

19621961
// Uncomment to verify memory caching works after making changes to caching
19631962
// code
1964-
//#define VERIFY_MEMORY_READS
1963+
// #define VERIFY_MEMORY_READS
19651964

19661965
size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Status &error) {
19671966
if (ABISP abi_sp = GetABI())
@@ -2818,9 +2817,7 @@ ListenerSP ProcessAttachInfo::GetListenerForProcess(Debugger &debugger) {
28182817
return debugger.GetListener();
28192818
}
28202819

2821-
Status Process::WillLaunch(Module *module) {
2822-
return DoWillLaunch(module);
2823-
}
2820+
Status Process::WillLaunch(Module *module) { return DoWillLaunch(module); }
28242821

28252822
Status Process::WillAttachToProcessWithID(lldb::pid_t pid) {
28262823
return DoWillAttachToProcessWithID(pid);
@@ -3710,8 +3707,8 @@ void Process::ControlPrivateStateThread(uint32_t signal) {
37103707
while (!receipt_received) {
37113708
// Check for a receipt for n seconds and then check if the private
37123709
// state thread is still around.
3713-
receipt_received =
3714-
event_receipt_sp->WaitForEventReceived(GetUtilityExpressionTimeout());
3710+
receipt_received = event_receipt_sp->WaitForEventReceived(
3711+
GetUtilityExpressionTimeout());
37153712
if (!receipt_received) {
37163713
// Check if the private state thread is still around. If it isn't
37173714
// then we are done waiting
@@ -4758,7 +4755,8 @@ HandleStoppedEvent(lldb::tid_t thread_id, const ThreadPlanSP &thread_plan_sp,
47584755
StopInfoSP stop_info_sp = thread_sp->GetStopInfo();
47594756
if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonBreakpoint &&
47604757
stop_info_sp->ShouldNotify(event_sp.get())) {
4761-
LLDB_LOG(log, "stopped for breakpoint: {0}.", stop_info_sp->GetDescription());
4758+
LLDB_LOG(log, "stopped for breakpoint: {0}.",
4759+
stop_info_sp->GetDescription());
47624760
if (!options.DoesIgnoreBreakpoints()) {
47634761
// Restore the plan state and then force Private to false. We are going
47644762
// to stop because of this plan so we need it to become a public plan or
@@ -5010,8 +5008,8 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
50105008
// coalescing to cause us to lose OUR running event...
50115009
ForceNextEventDelivery();
50125010

5013-
// This while loop must exit out the bottom, there's cleanup that we need to do
5014-
// when we are done. So don't call return anywhere within it.
5011+
// This while loop must exit out the bottom, there's cleanup that we need to
5012+
// do when we are done. So don't call return anywhere within it.
50155013

50165014
#ifdef LLDB_RUN_THREAD_HALT_WITH_EVENT
50175015
// It's pretty much impossible to write test cases for things like: One
@@ -5235,12 +5233,14 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
52355233
LLDB_LOG(log,
52365234
"Running function with one thread timeout timed out.");
52375235
} else
5238-
LLDB_LOG(log, "Restarting function with all threads enabled and "
5239-
"timeout: {0} timed out, abandoning execution.",
5236+
LLDB_LOG(log,
5237+
"Restarting function with all threads enabled and "
5238+
"timeout: {0} timed out, abandoning execution.",
52405239
timeout);
52415240
} else
5242-
LLDB_LOG(log, "Running function with timeout: {0} timed out, "
5243-
"abandoning execution.",
5241+
LLDB_LOG(log,
5242+
"Running function with timeout: {0} timed out, "
5243+
"abandoning execution.",
52445244
timeout);
52455245
}
52465246

@@ -5663,8 +5663,7 @@ size_t Process::GetThreadStatus(Stream &strm,
56635663
continue;
56645664
}
56655665
thread_sp->GetStatus(strm, start_frame, num_frames,
5666-
num_frames_with_source,
5667-
stop_format);
5666+
num_frames_with_source, stop_format);
56685667
++num_thread_infos_dumped;
56695668
} else {
56705669
Log *log = GetLog(LLDBLog::Process);
@@ -5703,14 +5702,14 @@ bool Process::RunPreResumeActions() {
57035702

57045703
void Process::ClearPreResumeActions() { m_pre_resume_actions.clear(); }
57055704

5706-
void Process::ClearPreResumeAction(PreResumeActionCallback callback, void *baton)
5707-
{
5708-
PreResumeCallbackAndBaton element(callback, baton);
5709-
auto found_iter = std::find(m_pre_resume_actions.begin(), m_pre_resume_actions.end(), element);
5710-
if (found_iter != m_pre_resume_actions.end())
5711-
{
5712-
m_pre_resume_actions.erase(found_iter);
5713-
}
5705+
void Process::ClearPreResumeAction(PreResumeActionCallback callback,
5706+
void *baton) {
5707+
PreResumeCallbackAndBaton element(callback, baton);
5708+
auto found_iter = std::find(m_pre_resume_actions.begin(),
5709+
m_pre_resume_actions.end(), element);
5710+
if (found_iter != m_pre_resume_actions.end()) {
5711+
m_pre_resume_actions.erase(found_iter);
5712+
}
57145713
}
57155714

57165715
ProcessRunLock &Process::GetRunLock() {
@@ -5720,12 +5719,10 @@ ProcessRunLock &Process::GetRunLock() {
57205719
return m_public_run_lock;
57215720
}
57225721

5723-
bool Process::CurrentThreadIsPrivateStateThread()
5724-
{
5722+
bool Process::CurrentThreadIsPrivateStateThread() {
57255723
return m_private_state_thread.EqualsThread(Host::GetCurrentThread());
57265724
}
57275725

5728-
57295726
void Process::Flush() {
57305727
m_thread_list.Flush();
57315728
m_extended_thread_list.Flush();
@@ -5924,7 +5921,9 @@ void Process::PrintWarningUnsupportedLanguage(const SymbolContext &sc) {
59245921
if (!sc.module_sp)
59255922
return;
59265923
LanguageType language = sc.GetLanguage();
5927-
if (language == eLanguageTypeUnknown)
5924+
if (language == eLanguageTypeUnknown ||
5925+
language == lldb::eLanguageTypeAssembly ||
5926+
language == lldb::eLanguageTypeMipsAssembler)
59285927
return;
59295928
LanguageSet plugins =
59305929
PluginManager::GetAllTypeSystemSupportedLanguagesForTypes();
@@ -6429,7 +6428,7 @@ static void GetCoreFileSaveRangesFull(Process &process,
64296428
std::set<addr_t> &stack_ends) {
64306429

64316430
// Don't add only dirty pages, add full regions.
6432-
const bool try_dirty_pages = false;
6431+
const bool try_dirty_pages = false;
64336432
for (const auto &region : regions)
64346433
if (stack_ends.count(region.GetRange().GetRangeEnd()) == 0)
64356434
AddRegion(region, try_dirty_pages, ranges);
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
Test warnings.
1+
Test unsupported language warning
2+
23
REQUIRES: shell
4+
35
RUN: %clang_host %S/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o - \
46
RUN: | sed -e 's/DW_LANG_C99/DW_LANG_Mips_Assembler/g' >%t.ll
57
RUN: %clang_host %t.ll -g -o %t.exe
6-
RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s
8+
RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s --check-prefix ASM
9+
10+
ASM-NOT: This version of LLDB has no plugin for the language "assembler"
11+
12+
RUN: %clang_host %S/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o - \
13+
RUN: | sed -e 's/DW_LANG_C99/DW_LANG_Cobol74/g' >%t.ll
14+
RUN: %clang_host %t.ll -g -o %t.exe
15+
RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s --check-prefix COBOL
716

8-
CHECK: This version of LLDB has no plugin for the language "assembler"
17+
COBOL-NOT: This version of LLDB has no plugin for the language "cobol"

0 commit comments

Comments
 (0)