From 359c65a4f57e50f80b2236b34c678228266b05c1 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 12 May 2003 14:46:34 +0000 Subject: [PATCH] When generating disassembly instructions by file name and line number check if the frame address is in the address range of the instruction set. If the instruction set doesn't contain the frame address generate a new instruction set based on the frame address. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 7 +++++++ .../core/sourcelookup/DisassemblyManager.java | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index a72d8173b9c..18e2e64d96c 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,10 @@ +2003-05-12 Mikhail Khodjaiants + When generating disassembly instructions by file name and line number check + if the frame address is in the address range of the instruction set. + If the instruction set doesn't contain the frame address generate a new instruction set + based on the frame address. + * DisassemblyManager.java + 2003-05-08 Mikhail Khodjaiants In the "terminate" event handler of the session manager check the targets that belong to the current session. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java index 857ab487034..e1daf3128da 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/DisassemblyManager.java @@ -128,6 +128,7 @@ public class DisassemblyManager String fileName = frameInfo.getFile(); int lineNumber = frameInfo.getFrameLineNumber(); ICDIInstruction[] instructions = new ICDIInstruction[0]; + long address = frameInfo.getAddress(); if ( fileName != null && fileName.length() > 0 ) { try @@ -138,9 +139,10 @@ public class DisassemblyManager { } } - if ( instructions.length == 0 ) + if ( instructions.length == 0 || + // Double check if debugger returns correct address range. + !containsAddress( instructions, address ) ) { - long address = frameInfo.getAddress(); if ( address >= 0 ) { try @@ -213,4 +215,14 @@ public class DisassemblyManager } return rawInstructions; } + + private boolean containsAddress( ICDIInstruction[] instructions, long address ) + { + for ( int i = 0; i < instructions.length; ++i ) + { + if ( instructions[i].getAdress() == address ) + return true; + } + return false; + } }