[Lldb-commits] [lldb] r289711 - Adopt PrettyStackTrace in LLDB
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 14 16:52:07 PST 2016
On Wed, Dec 14, 2016 at 1:41 PM Sean Callanan via lldb-commits <
lldb-commits at lists.llvm.org> wrote:
>
> Modified: lldb/trunk/source/API/SBFrame.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=289711&r1=289710&r2=289711&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/API/SBFrame.cpp (original)
> +++ lldb/trunk/source/API/SBFrame.cpp Wed Dec 14 15:31:31 2016
> @@ -52,6 +52,8 @@
> #include "lldb/API/SBValue.h"
> #include "lldb/API/SBVariablesOptions.h"
>
> +#include "llvm/Support/PrettyStackTrace.h"
> +
> using namespace lldb;
> using namespace lldb_private;
>
> @@ -1288,10 +1290,11 @@ lldb::SBValue SBFrame::EvaluateExpressio
> if (stop_locker.TryLock(&process->GetRunLock())) {
> frame = exe_ctx.GetFramePtr();
> if (frame) {
> + std::unique_ptr<llvm::PrettyStackTraceFormat> PST;
>
Minor nit, but I would move this to the most narrow scope possible that
requires its use. which in this case means to move the declaration inside
the next if statement.
> if (target->GetDisplayExpressionsInCrashlogs()) {
> StreamString frame_description;
> frame->DumpUsingSettingsFormat(&frame_description);
> - Host::SetCrashDescriptionWithFormat(
> + PST = llvm::make_unique<llvm::PrettyStackTraceFormat>(
> "SBFrame::EvaluateExpression (expr = \"%s\",
> fetch_dynamic_value "
> "= %u) %s",
> expr, options.GetFetchDynamicValue(),
>
If you do the above, then you could declare the variable as `auto` here.
Normally auto is frowned upon, but this is an exception since
`make_unique<PrettyStackTraceFormat>` is a clear statement of the return
type.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161215/1513e74c/attachment-0001.html>
More information about the lldb-commits
mailing list