Skip to content

Commit

Permalink
Merge remote-tracking branch
Browse files Browse the repository at this point in the history
'origin/GP-4571_ghizard_fix_VS6_PDB_available_DebugData_streams'
(Closes #6464)
  • Loading branch information
ryanmkurtz committed May 1, 2024
2 parents 772694c + 953f593 commit 8b34360
Showing 1 changed file with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public int getValue() {
private AbstractPdb pdb;
private List<Integer> debugStreams = new ArrayList<>();

private int getDebugStream(DebugType debugType) {
int index = debugType.getValue();
if (index < 0 || index >= debugStreams.size()) {
return MsfStream.NIL_STREAM_NUMBER;
}
return debugStreams.get(index);
}

//==============================================================================================
// API
//==============================================================================================
Expand All @@ -85,7 +93,7 @@ public DebugData(AbstractPdb pdb) {
*/
public List<FramePointerOmissionRecord> getFramePointerOmissionData()
throws CancelledException {
int streamNum = debugStreams.get(DebugType.FRAME_POINTER_OMISSION.getValue());
int streamNum = getDebugStream(DebugType.FRAME_POINTER_OMISSION);
if (streamNum == MsfStream.NIL_STREAM_NUMBER) {
return null;
}
Expand All @@ -106,7 +114,7 @@ public List<FramePointerOmissionRecord> getFramePointerOmissionData()
* @throws CancelledException upon user cancellation
*/
public SortedMap<Long, Long> getOmapFromSource() throws CancelledException {
int streamNum = debugStreams.get(DebugType.OMAP_FROM_SOURCE.getValue());
int streamNum = getDebugStream(DebugType.OMAP_FROM_SOURCE);
if (streamNum == MsfStream.NIL_STREAM_NUMBER) {
return null;
}
Expand All @@ -119,7 +127,7 @@ public SortedMap<Long, Long> getOmapFromSource() throws CancelledException {
* @throws CancelledException upon user cancellation
*/
public List<ImageSectionHeader> getImageSectionHeaders() throws CancelledException {
int streamNum = debugStreams.get(DebugType.SECTION_HEADER.getValue());
int streamNum = getDebugStream(DebugType.SECTION_HEADER);
if (streamNum == MsfStream.NIL_STREAM_NUMBER) {
return null;
}
Expand All @@ -135,7 +143,7 @@ public List<ImageSectionHeader> getImageSectionHeaders() throws CancelledExcepti
*/
// TODO: just put a return of null Integer for now until figured out.
public Integer getXData() throws CancelledException {
int streamNum = debugStreams.get(DebugType.SECTION_HEADER_ORIG.getValue());
int streamNum = getDebugStream(DebugType.SECTION_HEADER_ORIG);
if (streamNum == MsfStream.NIL_STREAM_NUMBER) {
return null;
}
Expand All @@ -150,7 +158,7 @@ public Integer getXData() throws CancelledException {
* @throws CancelledException upon user cancellation
*/
public List<ImageFunctionEntry> getPData() throws CancelledException {
int streamNum = debugStreams.get(DebugType.SECTION_HEADER_ORIG.getValue());
int streamNum = getDebugStream(DebugType.SECTION_HEADER_ORIG);
if (streamNum == MsfStream.NIL_STREAM_NUMBER) {
return null;
}
Expand All @@ -165,7 +173,7 @@ public List<ImageFunctionEntry> getPData() throws CancelledException {
* @throws CancelledException upon user cancellation
*/
public List<ImageSectionHeader> getImageSectionHeadersOrig() throws CancelledException {
int streamNum = debugStreams.get(DebugType.SECTION_HEADER_ORIG.getValue());
int streamNum = getDebugStream(DebugType.SECTION_HEADER_ORIG);
if (streamNum == MsfStream.NIL_STREAM_NUMBER) {
return null;
}
Expand Down Expand Up @@ -212,7 +220,7 @@ public void deserialize() throws PdbException, CancelledException, IOException {
"DebugData Header had not been deserialized at the appropriate time");
}
for (DebugType dbg : DebugType.values()) {
int streamNum = debugStreams.get(dbg.getValue());
int streamNum = getDebugStream(dbg);
if (streamNum == MsfStream.NIL_STREAM_NUMBER) {
continue;
}
Expand Down Expand Up @@ -278,8 +286,7 @@ private List<FramePointerOmissionRecord> deserializeFramePointerOmissionData(int

}

private SortedMap<Long, Long> deserializeOMap(int streamNum)
throws CancelledException {
private SortedMap<Long, Long> deserializeOMap(int streamNum) throws CancelledException {
try {
PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
SortedMap<Long, Long> omap = new TreeMap<>();
Expand Down Expand Up @@ -325,8 +332,7 @@ private List<ImageSectionHeader> deserializeSectionHeaders(int streamNum)
* processing XData
*/
// TODO: just put a return of null Integer for now until figured out.
private Integer deserializeXData(int streamNum)
throws CancelledException {
private Integer deserializeXData(int streamNum) throws CancelledException {
try {
PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
int streamLength = reader.getLimit();
Expand Down Expand Up @@ -362,8 +368,7 @@ private Integer deserializeXData(int streamNum)
}

// TODO: This is incomplete.
private List<ImageFunctionEntry> deserializePData(int streamNum)
throws CancelledException {
private List<ImageFunctionEntry> deserializePData(int streamNum) throws CancelledException {
try {
PdbByteReader reader = pdb.getReaderForStreamNumber(streamNum);
List<ImageFunctionEntry> myPData = new ArrayList<>();
Expand Down

0 comments on commit 8b34360

Please sign in to comment.