@@ -1320,6 +1320,53 @@ class CommandObjectThreadException : public CommandObjectIterateOverThreads {
1320
1320
}
1321
1321
};
1322
1322
1323
+ class CommandObjectThreadSiginfo : public CommandObjectIterateOverThreads {
1324
+ public:
1325
+ CommandObjectThreadSiginfo (CommandInterpreter &interpreter)
1326
+ : CommandObjectIterateOverThreads(
1327
+ interpreter, " thread siginfo" ,
1328
+ " Display the current siginfo object for a thread. Defaults to "
1329
+ " the current thread." ,
1330
+ " thread siginfo" ,
1331
+ eCommandRequiresProcess | eCommandTryTargetAPILock |
1332
+ eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
1333
+
1334
+ ~CommandObjectThreadSiginfo () override = default ;
1335
+
1336
+ void
1337
+ HandleArgumentCompletion (CompletionRequest &request,
1338
+ OptionElementVector &opt_element_vector) override {
1339
+ CommandCompletions::InvokeCommonCompletionCallbacks (
1340
+ GetCommandInterpreter (), CommandCompletions::eThreadIndexCompletion,
1341
+ request, nullptr );
1342
+ }
1343
+
1344
+ bool HandleOneThread (lldb::tid_t tid, CommandReturnObject &result) override {
1345
+ ThreadSP thread_sp =
1346
+ m_exe_ctx.GetProcessPtr ()->GetThreadList ().FindThreadByID (tid);
1347
+ if (!thread_sp) {
1348
+ result.AppendErrorWithFormat (" thread no longer exists: 0x%" PRIx64 " \n " ,
1349
+ tid);
1350
+ return false ;
1351
+ }
1352
+
1353
+ Stream &strm = result.GetOutputStream ();
1354
+ if (!thread_sp->GetDescription (strm, eDescriptionLevelFull, false , false )) {
1355
+ result.AppendErrorWithFormat (" error displaying info for thread: \" %d\"\n " ,
1356
+ thread_sp->GetIndexID ());
1357
+ return false ;
1358
+ }
1359
+ ValueObjectSP exception_object_sp = thread_sp->GetSiginfoValue ();
1360
+ if (exception_object_sp)
1361
+ exception_object_sp->Dump (strm);
1362
+ else
1363
+ strm.Printf (" (no siginfo)\n " );
1364
+ strm.PutChar (' \n ' );
1365
+
1366
+ return true ;
1367
+ }
1368
+ };
1369
+
1323
1370
// CommandObjectThreadReturn
1324
1371
#define LLDB_OPTIONS_thread_return
1325
1372
#include " CommandOptions.inc"
@@ -2293,6 +2340,8 @@ CommandObjectMultiwordThread::CommandObjectMultiwordThread(
2293
2340
CommandObjectSP (new CommandObjectThreadInfo (interpreter)));
2294
2341
LoadSubCommand (" exception" , CommandObjectSP (new CommandObjectThreadException (
2295
2342
interpreter)));
2343
+ LoadSubCommand (" siginfo" ,
2344
+ CommandObjectSP (new CommandObjectThreadSiginfo (interpreter)));
2296
2345
LoadSubCommand (" step-in" ,
2297
2346
CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
2298
2347
interpreter, " thread step-in" ,
0 commit comments