Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325284 - edc - disassembly - add error recovery for unreadable memory, display as single pseudo-mnemonic
Summary: edc - disassembly - add error recovery for unreadable memory, display as sing...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-edc (show other bugs)
Version: 7.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ken Ryall CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 14:57 EDT by Kirk Beitz CLA
Modified: 2011-05-13 10:53 EDT (History)
0 users

See Also:
kirk.beitz: review?


Attachments
add error recovery for unreadable memory, display as single pseudo-mnemonic (20.08 KB, patch)
2010-09-14 14:57 EDT, Kirk Beitz CLA
no flags Details | Diff
updated patch to add error recovery for unreadable memory, display as single pseudo-mnemonic (27.13 KB, patch)
2010-09-15 03:17 EDT, Kirk Beitz CLA
no flags Details | Diff
patch containing error recovery and pseudoInstruction generation only (17.66 KB, patch)
2010-09-18 09:09 EDT, Kirk Beitz CLA
no flags Details | Diff
updated patch containing only error recovery and pseudoInstr generation (17.65 KB, patch)
2010-09-19 03:37 EDT, Kirk Beitz CLA
cdtdoug: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kirk Beitz CLA 2010-09-14 14:57:04 EDT
Created attachment 178864 [details]
add error recovery for unreadable memory, display as single pseudo-mnemonic

the attached patch adds error recovery for unreadable memory to edc, and shows how to implement this in InstructionParserARM .  

part of the recovery relies new, specific exception CodeBufferUnderflowException, added as new file /org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/disassembler/CodeBufferUnderflowException.java .  

the other part of the recovery is the refactoring of now added protected fillDisassemblyViewInstructions(), which uses a new variant of TranslateMemoryBytes() to retrieve chunks of either readable or unreadable contiguous memory, and then either process the actual disassembly in the case of readable memory, or else create a pseudo-mnemonic in the case of unreadable memory.

this patch is somewhat dependent upon the patch for DisassemblyBackendDsf,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=325277 , although it can be applied and committed independently; it just won't completely work until that patch is applied as well.
Comment 1 Kirk Beitz CLA 2010-09-15 03:17:54 EDT
Created attachment 178904 [details]
updated patch to add error recovery for unreadable memory, display as single pseudo-mnemonic

implemented some suggestions from ed swartz regarding alignment that helped significantly reduce the number of "buffer underflow" pseudo-mnemonics displayed (to zero in the testing i did despite trying to force them to appear).

cleaned up some additional edge cases clarified by the alignment adjustment fixes.
Comment 2 Kirk Beitz CLA 2010-09-15 03:19:06 EDT
Comment on attachment 178864 [details]
add error recovery for unreadable memory, display as single pseudo-mnemonic

forgot to obsolete the original with the attachment of the update patch.
Comment 3 Kirk Beitz CLA 2010-09-18 09:09:03 EDT
Created attachment 179175 [details]
patch containing error recovery and pseudoInstruction generation only

patch 178904 (updated patch to add error recovery…) was out of date, and the patch had grown bloated and inter-related with other issues.

those issues are now found in the following edc bugzilla proposals:
- Bug 325677 : Show Function Offsets not working
- Bug 325678 : ARM disassembly : improve view output by pre-checking alignment
- Bug 325679 : new CodeBufferUnderflowException and semantics

the patch that remains is for clarification purposes only, because
- it cannot apply cleanly without the above patches in place first
- it also cannot apply cleanly without the following merges still TBD
  - Bug 325149 : context and environment params added for stepping reqmts
  - Bug 325150 : refactor ARMDisassembly to fix missing/duplicate lines
- it will cause a runtime infinite loop if applied without the changes
  - Bug 325277 : add IInstruction#getSize() to eclipse.cvs.HEAD
  - Bug 325676 : add IInstructionWithSize#getSize() to cdt 7.0.2 cvs branch

the contents of the patch are a newly refactored function in Disassembly.java named fillDisassemblyViewInstructions() that can be called from handleSuccess() callbacks of DRMs in order to populate the array to be passed back to DisassemblyBackendDsf#insertisassembly().

fillDisassemblyViewInstructions() uses the new CodeBufferUnderflowException() to help recover from parsing errors, and also to recover from backend reads resulting in buffers of unreadable memory.  it uses the new utility function pseudoInstruction() to populate the disassembly view with a smaller footprint of text describing underflow and unreadable memory blocks.

a modified version of the attached patch has been tested together with other changes mentioned in this comment in the ARM debugger, and is planned for later merge together at the same time.
Comment 4 Kirk Beitz CLA 2010-09-19 03:37:19 EDT
Created attachment 179200 [details]
updated patch containing only error recovery and pseudoInstr generation

further testing on x86 revealed cases that needed to be adjusted.
Comment 5 Kirk Beitz CLA 2010-10-06 22:45:36 EDT
resolved with 2010.oct.04 edc merge commits by ken.ryall@nokia.com