Page MenuHomePhabricator

[lldb] Ensure SBStructuredData::m_impl_up is always non-null

Authored by kastiglione on Apr 29 2021, 4:06 PM.



By ensuring that SBStructuredData::m_impl_up always has a value, it prevents crashes that can happen when the SBStructuredDataImpl is null.

This fixes a case that caused SBStructuredData::operator= to crash. This happened when rhs had a null SBStructuredDataImpl.

Diff Detail

Unit TestsFailed

400 msx64 debian > LLVM.CodeGen/AMDGPU::sibling-call.ll
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -mattr=-flat-for-global -enable-ipra=0 -amdgpu-sroa=0 -verify-machineinstrs < /mnt/disks/ssd0/agent/llvm-project/llvm/test/CodeGen/AMDGPU/sibling-call.ll | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck -enable-var-scope -check-prefixes=GCN,CIVI /mnt/disks/ssd0/agent/llvm-project/llvm/test/CodeGen/AMDGPU/sibling-call.ll
620 msx64 windows > LLVM.CodeGen/AMDGPU::sibling-call.ll
Script: -- : 'RUN: at line 1'; c:\ws\w32-1\llvm-project\premerge-checks\build\bin\llc.exe -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -mattr=-flat-for-global -enable-ipra=0 -amdgpu-sroa=0 -verify-machineinstrs < C:\ws\w32-1\llvm-project\premerge-checks\llvm\test\CodeGen\AMDGPU\sibling-call.ll | c:\ws\w32-1\llvm-project\premerge-checks\build\bin\filecheck.exe -enable-var-scope -check-prefixes=GCN,CIVI C:\ws\w32-1\llvm-project\premerge-checks\llvm\test\CodeGen\AMDGPU\sibling-call.ll

Event Timeline

kastiglione requested review of this revision.Apr 29 2021, 4:06 PM
kastiglione created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 29 2021, 4:06 PM
shafik added a subscriber: shafik.Apr 29 2021, 4:39 PM

LGTM, it seems like there a few places where we are not consistently checking m_impl_up is valid and other places we are using the conditional operator to check if it is set or not.

I should expand this to fix other unchecked dereferences.

Ensure m_impl_up is always non-null

kastiglione retitled this revision from [lldb] Handle missing SBStructuredData copy assignment cases to [lldb] Ensure SBStructuredData::m_impl_up is always non-null.Apr 29 2021, 5:24 PM
kastiglione edited the summary of this revision. (Show Details)

I changed direction, to ensure the impl pointer is always non-null.


This is the key change, all else is cleanup.

LGTM. I'm going to be that guy and ask if you could test this (there is an API unittest directory with an example test, so copying that and just exercising the nullptr SBStructuredData is good enough).

This revision is now accepted and ready to land.Apr 30 2021, 8:45 AM

Add unittest

This revision was landed with ongoing or failed builds.May 5 2021, 3:12 PM
This revision was automatically updated to reflect the committed changes.