[lldb-dev] avoid crash in unwinder if abi wasn't set

Carlo Kok ck at remobjects.com
Wed Oct 2 08:07:29 PDT 2013


Ed Maste schreef op 10/2/2013 5:02 PM:
> On 2 October 2013 10:11, Carlo Kok <ck at remobjects.com> wrote:
>>
>> I was trying to see how far I could get debugging with arm64 (not far yet) but the code in attach patch catch the abi not existing yet, instead of crashing in GetSourceName() it just logs that there's no unwind frame. If oke I'll commit.
>
> I ran into this just yesterday (and hacked in a different workaround,
> which I've now undone).  What do you think of this version instead,
> which perhaps makes the issue more clear for next person to add a new
> architecture:
>
> diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
> b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
> index b3d9aa3..3872add 100644
> --- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
> +++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
> @@ -620,6 +620,10 @@ RegisterContextLLDB::GetFullUnwindPlanForFrame ()
>           arch_default_unwind_plan_sp.reset (new UnwindPlan
> (lldb::eRegisterKindGeneric));
>           abi->CreateDefaultUnwindPlan(*arch_default_unwind_plan_sp);
>       }
> +    else
> +    {
> +        UnwindLogMsgVerbose ("unable to get ABI for default UnwindPlan");
> +    }
>
>       bool behaves_like_zeroth_frame = false;
>       if (IsFrameZero ()
> @@ -759,7 +763,8 @@ RegisterContextLLDB::GetFullUnwindPlanForFrame ()
>       }
>
>       // If nothing else, use the architectural default UnwindPlan and
> hope that does the job.
> -    UnwindLogMsgVerbose ("frame uses %s for full UnwindPlan",
> arch_default_unwind_plan_sp->GetSourceName().GetCString());
> +    if (arch_default_unwind_plan_sp)
> +        UnwindLogMsgVerbose ("frame uses %s for full UnwindPlan",
> arch_default_unwind_plan_sp->GetSourceName().GetCString());
>       return arch_default_unwind_plan_sp;
>   }
>
> (Otherwise, there are a couple of whitespace issues with your patch --
> EOL after the else, and 2-space indents.)
>


That's even better.

-- 
Carlo Kok
RemObjects Software



More information about the lldb-dev mailing list