From 868e29ac4f48f8f7076fb8e648faed11a5576462 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 17 Oct 2008 08:38:54 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20250638=20-=20NPEs=20when=20disassembling?= =?UTF-8?q?=20in=20debugger=20Patch=20by=20=C3=98yvind=20Harboe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/org/eclipse/cdt/core/CCorePlugin.java | 3 +++ .../cdt/debug/internal/core/model/Disassembly.java | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index 3355479935b..fb1539c7bc6 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -10,6 +10,7 @@ * Markus Schorn (Wind River Systems) * Andrew Ferguson (Symbian) * Anton Leherbauer (Wind River Systems) + * oyvind.harboe@zylin.com - http://bugs.eclipse.org/250638 *******************************************************************************/ package org.eclipse.cdt.core; @@ -566,6 +567,8 @@ public class CCorePlugin extends Plugin { if (project != null) { try { ICDescriptor cdesc = getCProjectDescription(project, false); + if (cdesc==null) + return ext; ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID, true); if (cextensions != null && cextensions.length > 0) ext = cextensions; diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java index 2b9470a935e..316f72135f5 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java @@ -1,12 +1,13 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2008 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * QNX Software Systems - Initial API and implementation + * QNX Software Systems - Initial API and implementation + * oyvind.harboe@zylin.com - http://bugs.eclipse.org/250638 *******************************************************************************/ package org.eclipse.cdt.debug.internal.core.model; @@ -65,7 +66,9 @@ public class Disassembly extends CDebugElement implements IDisassembly, ICDIEven String fileName = frame.getFile(); int lineNumber = frame.getLineNumber(); ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0]; - IAddress address = frame.getAddress(); + IAddress address = frame.getAddress(); + if (address==null) + return null; if ( fileName != null && fileName.length() > 0 ) { try { mixedInstrs = target.getMixedInstructions( fileName, @@ -133,6 +136,7 @@ public class Disassembly extends CDebugElement implements IDisassembly, ICDIEven /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ + @Override public Object getAdapter( Class adapter ) { if ( IExecFileInfo.class.equals( adapter ) ) return getDebugTarget().getAdapter( adapter );