[lldb] [llvm] [LLDB] Extract process arguments from core dump for Linux (PR #185338)
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 28 02:19:37 PDT 2026
================
@@ -1539,6 +1540,36 @@ class Process : public std::enable_shared_from_this<Process>,
/// File path to the core file.
virtual FileSpec GetCoreFile() const { return {}; }
+ class CoreArgs {
+ std::string m_cmd;
+ bool m_might_be_truncated;
+
+ public:
+ CoreArgs() = default;
+ CoreArgs(const std::string &args, bool might_be_truncated)
+ : m_cmd(args), m_might_be_truncated(might_be_truncated) {}
+
+ void Format(Stream &stream) const {
+ if (m_cmd.empty())
+ return;
+ stream << "Core was generated by '" << m_cmd << "'";
+ if (this->m_might_be_truncated)
+ stream << " (command might be truncated)";
+ stream << ".\n";
+ }
+
+ bool empty() const { return m_cmd.empty(); }
+
+ Args as_args() const { return Args(m_cmd); }
+ };
+
+ /// Provide arguments of a command that triggered a core dump.
+ ///
+ /// \return
+ /// The arguments that created the core dump.
+ /// If this process is a live debug session, returns a std::nullopt.
----------------
DavidSpickett wrote:
```
/// If this process is a live debug session, or the core dump contained no arguments, returns a std::nullopt.
```
https://github.com/llvm/llvm-project/pull/185338
More information about the llvm-commits
mailing list