Merge remote-tracking branch

'origin/GP-0_dev747368_fix_dwarf5_unitheader_npe_and_implicit_value'
(Closes #6312)
This commit is contained in:
Ryan Kurtz 2024-03-14 06:14:21 -04:00
commit 43c6f6897a
2 changed files with 6 additions and 4 deletions

View file

@ -316,10 +316,11 @@ public class DWARFProgram implements Closeable {
DWARFUnitHeader unitHeader =
DWARFUnitHeader.read(this, debugInfoBR, debugAbbrBR, compUnits.size(), monitor);
if (unitHeader != null) {
debugInfoBR.setPointerIndex(unitHeader.getEndOffset());
if (unitHeader == null) {
break;
}
debugInfoBR.setPointerIndex(unitHeader.getEndOffset());
if (unitHeader instanceof DWARFCompilationUnit cu) {
compUnits.add(cu);
importSummary.dwarfVers.add((int) cu.getDWARFVersion());

View file

@ -69,8 +69,9 @@ public class DWARFAttributeDef<E extends Enum<E>> {
E e = mapper.apply(attributeId);
// NOTE: implicit value is a space saving hack built into DWARF. It adds an extra
// field in the attributespec that needs to be read.
long implicitValue = form == DWARFForm.DW_FORM_indirect // read leb128 if present
// field in the attributespec that needs to be read now in the .debug_abbr. This is
// different than DW_FORM_indirect, which is read from the DIE in .debug_info
long implicitValue = form == DWARFForm.DW_FORM_implicit_const // read leb128 if present
? reader.readNext(LEB128::signed)
: 0;