Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.util.Map;

import com.oracle.objectfile.debugentry.ClassEntry;
import com.oracle.objectfile.elf.dwarf.constants.DwarfSectionName;
import com.oracle.objectfile.elf.dwarf.constants.DwarfVersion;
import org.graalvm.compiler.debug.DebugContext;

import com.oracle.objectfile.LayoutDecision;
Expand All @@ -42,16 +44,11 @@
*/
public class DwarfARangesSectionImpl extends DwarfSectionImpl {
/* Headers have a fixed size but must align up to 2 * address size. */
private static final int DW_AR_HEADER_SIZE = 12;
private static final int DW_AR_HEADER_PAD_SIZE = 4;
private static final int AR_HEADER_SIZE = 12;
private static final int AR_HEADER_PAD_SIZE = 4;

public DwarfARangesSectionImpl(DwarfDebugInfo dwarfSections) {
super(dwarfSections);
}

@Override
public String getSectionName() {
return DwarfDebugInfo.DW_ARANGES_SECTION_NAME;
super(dwarfSections, DwarfSectionName.DW_ARANGES_SECTION, DwarfSectionName.DW_FRAME_SECTION);
}

@Override
Expand Down Expand Up @@ -104,9 +101,9 @@ public void createContent() {
private static int entrySize(int methodCount) {
int size = 0;
// allow for header data
size += DW_AR_HEADER_SIZE;
size += AR_HEADER_SIZE;
// align to 2 * address size.
size += DW_AR_HEADER_PAD_SIZE;
size += AR_HEADER_PAD_SIZE;
// count 16 bytes for each deopt compiled method
size += methodCount * (2 * 8);
// allow for two trailing zeroes to terminate
Expand Down Expand Up @@ -161,17 +158,17 @@ private int writeHeader(int cuIndex, byte[] buffer, int p) {
// write dummy length for now
pos = writeInt(0, buffer, pos);
/* DWARF version is always 2. */
pos = writeShort(DwarfDebugInfo.DW_VERSION_2, buffer, pos);
pos = writeDwarfVersion(DwarfVersion.DW_VERSION_2, buffer, pos);
pos = writeInfoSectionOffset(cuIndex, buffer, pos);
/* Address size is always 8. */
pos = writeByte((byte) 8, buffer, pos);
/* Segment size is always 0. */
pos = writeByte((byte) 0, buffer, pos);
assert (pos - p) == DW_AR_HEADER_SIZE;
assert (pos - p) == AR_HEADER_SIZE;
/*
* Align to 2 * address size.
*/
for (int i = 0; i < DW_AR_HEADER_PAD_SIZE; i++) {
for (int i = 0; i < AR_HEADER_PAD_SIZE; i++) {
pos = writeByte((byte) 0, buffer, pos);
}
return pos;
Expand All @@ -185,24 +182,4 @@ int writeARange(DebugContext context, CompiledMethodEntry compiledMethod, byte[]
pos = writeLong(primary.getHi() - primary.getLo(), buffer, pos);
return pos;
}

/*
* The debug_aranges section depends on debug_frame section.
*/
private static final String TARGET_SECTION_NAME = DwarfDebugInfo.DW_FRAME_SECTION_NAME;

@Override
public String targetSectionName() {
return TARGET_SECTION_NAME;
}

private final LayoutDecision.Kind[] targetSectionKinds = {
LayoutDecision.Kind.CONTENT,
LayoutDecision.Kind.SIZE
};

@Override
public LayoutDecision.Kind[] targetSectionKinds() {
return targetSectionKinds;
}
}
Loading