From a09663e375af8ab765c3ef9f283192bae562549c Mon Sep 17 00:00:00 2001 From: Warren Paul Date: Wed, 28 May 2008 20:52:16 +0000 Subject: [PATCH] protect against throwing out of memory exception when loading (potentially large) sections. --- .../eclipse/cdt/utils/debug/dwarf/DwarfReader.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java index 0bc70358033..93e4e665ed3 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.ISymbolReader; import org.eclipse.cdt.utils.debug.IDebugEntryRequestor; import org.eclipse.cdt.utils.elf.Elf; @@ -72,7 +73,15 @@ public class DwarfReader extends Dwarf implements ISymbolReader { String name = section.toString(); for (String element : DWARF_SectionsToParse) { if (name.equals(element)) { - dwarfSections.put(element, section.loadSectionData()); + // catch out of memory exceptions which might happen trying to + // load large sections (like .debug_info). not a fix for that + // problem itself, but will at least continue to load the other + // sections. + try { + dwarfSections.put(element, section.loadSectionData()); + } catch (OutOfMemoryError e) { + CCorePlugin.log(e); + } } } }