|
Lines 31-36
Link Here
|
| 31 |
import org.eclipse.cdt.dsf.concurrent.Query; |
31 |
import org.eclipse.cdt.dsf.concurrent.Query; |
| 32 |
import org.eclipse.cdt.dsf.datamodel.DMContexts; |
32 |
import org.eclipse.cdt.dsf.datamodel.DMContexts; |
| 33 |
import org.eclipse.cdt.dsf.datamodel.IDMContext; |
33 |
import org.eclipse.cdt.dsf.datamodel.IDMContext; |
|
|
34 |
import org.eclipse.cdt.dsf.debug.internal.provisional.service.IInstructionWithSize; |
| 34 |
import org.eclipse.cdt.dsf.debug.service.IDisassembly; |
35 |
import org.eclipse.cdt.dsf.debug.service.IDisassembly; |
| 35 |
import org.eclipse.cdt.dsf.debug.service.IExpressions; |
36 |
import org.eclipse.cdt.dsf.debug.service.IExpressions; |
| 36 |
import org.eclipse.cdt.dsf.debug.service.IFormattedValues; |
37 |
import org.eclipse.cdt.dsf.debug.service.IFormattedValues; |
|
Lines 568-575
Link Here
|
| 568 |
// return true to avoid a retry |
569 |
// return true to avoid a retry |
| 569 |
return true; |
570 |
return true; |
| 570 |
} |
571 |
} |
| 571 |
// indicates whether [startAddress] was inserted |
572 |
|
| 572 |
boolean insertedStartAddress = startAddress == null; |
573 |
boolean insertedAnyAddress = false; |
| 573 |
|
574 |
|
| 574 |
try { |
575 |
try { |
| 575 |
fCallback.lockScroller(); |
576 |
fCallback.lockScroller(); |
|
Lines 590-596
Link Here
|
| 590 |
fCallback.getDocument().addInvalidAddressRange(p); |
591 |
fCallback.getDocument().addInvalidAddressRange(p); |
| 591 |
} else if (p == null || address.compareTo(endAddress) > 0) { |
592 |
} else if (p == null || address.compareTo(endAddress) > 0) { |
| 592 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
593 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
| 593 |
return insertedStartAddress; |
594 |
return insertedAnyAddress; |
| 594 |
} else if (p.fValid) { |
595 |
} else if (p.fValid) { |
| 595 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
596 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
| 596 |
if (!p.fAddressOffset.equals(address)) { |
597 |
if (!p.fAddressOffset.equals(address)) { |
|
Lines 598-604
Link Here
|
| 598 |
p.fValid = false; |
599 |
p.fValid = false; |
| 599 |
fCallback.getDocument().addInvalidAddressRange(p); |
600 |
fCallback.getDocument().addInvalidAddressRange(p); |
| 600 |
} else { |
601 |
} else { |
| 601 |
return insertedStartAddress; |
602 |
continue; |
| 602 |
} |
603 |
} |
| 603 |
} |
604 |
} |
| 604 |
boolean hasSource= false; |
605 |
boolean hasSource= false; |
|
Lines 610-621
Link Here
|
| 610 |
} |
611 |
} |
| 611 |
// determine instruction byte length |
612 |
// determine instruction byte length |
| 612 |
BigInteger instrLength= null; |
613 |
BigInteger instrLength= null; |
| 613 |
if (j < instructions.length - 1) { |
614 |
if (instruction instanceof IInstructionWithSize |
| 614 |
instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); |
615 |
&& ((IInstructionWithSize)instruction).getSize() != null) { |
| 615 |
} |
616 |
instrLength= new BigInteger(((IInstructionWithSize)instruction).getSize().toString()); |
| 616 |
if (instrLength == null) { |
617 |
} else { |
| 617 |
// cannot determine length of last instruction |
618 |
if (j < instructions.length - 1) { |
| 618 |
break; |
619 |
instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); |
|
|
620 |
} |
| 621 |
if (instrLength == null) { |
| 622 |
// cannot determine length of last instruction |
| 623 |
break; |
| 624 |
} |
| 619 |
} |
625 |
} |
| 620 |
final String opCode; |
626 |
final String opCode; |
| 621 |
// insert function name+offset instead of opcode bytes |
627 |
// insert function name+offset instead of opcode bytes |
|
Lines 624-641
Link Here
|
| 624 |
} else { |
630 |
} else { |
| 625 |
opCode= ""; //$NON-NLS-1$ |
631 |
opCode= ""; //$NON-NLS-1$ |
| 626 |
} |
632 |
} |
| 627 |
insertedStartAddress= insertedStartAddress || address.compareTo(startAddress) == 0; |
633 |
|
| 628 |
p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstruction(), compilationPath, -1); |
634 |
p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstruction(), compilationPath, -1); |
| 629 |
if (p == null && insertedStartAddress) { |
635 |
if (p == null) { |
| 630 |
break; |
636 |
break; |
| 631 |
} |
637 |
} |
|
|
638 |
insertedAnyAddress = true; |
| 632 |
} |
639 |
} |
| 633 |
} catch (BadLocationException e) { |
640 |
} catch (BadLocationException e) { |
| 634 |
// should not happen |
641 |
// should not happen |
| 635 |
DisassemblyUtils.internalError(e); |
642 |
DisassemblyUtils.internalError(e); |
| 636 |
} finally { |
643 |
} finally { |
| 637 |
fCallback.setUpdatePending(false); |
644 |
fCallback.setUpdatePending(false); |
| 638 |
if (insertedStartAddress) { |
645 |
if (insertedAnyAddress) { |
| 639 |
fCallback.updateInvalidSource(); |
646 |
fCallback.updateInvalidSource(); |
| 640 |
fCallback.unlockScroller(); |
647 |
fCallback.unlockScroller(); |
| 641 |
fCallback.doPending(); |
648 |
fCallback.doPending(); |
|
Lines 644-650
Link Here
|
| 644 |
fCallback.unlockScroller(); |
651 |
fCallback.unlockScroller(); |
| 645 |
} |
652 |
} |
| 646 |
} |
653 |
} |
| 647 |
return insertedStartAddress; |
654 |
return insertedAnyAddress; |
| 648 |
} |
655 |
} |
| 649 |
|
656 |
|
| 650 |
/** |
657 |
/** |
|
Lines 676-683
Link Here
|
| 676 |
// return true to avoid a retry |
683 |
// return true to avoid a retry |
| 677 |
return true; |
684 |
return true; |
| 678 |
} |
685 |
} |
| 679 |
// indicates whether [startAddress] was inserted |
686 |
|
| 680 |
boolean insertedStartAddress = startAddress == null; |
687 |
boolean insertedAnyAddress = false; |
| 681 |
try { |
688 |
try { |
| 682 |
fCallback.lockScroller(); |
689 |
fCallback.lockScroller(); |
| 683 |
|
690 |
|
|
Lines 702-708
Link Here
|
| 702 |
fCallback.getDocument().addInvalidAddressRange(p); |
709 |
fCallback.getDocument().addInvalidAddressRange(p); |
| 703 |
} else if (p == null || address.compareTo(endAddress) > 0) { |
710 |
} else if (p == null || address.compareTo(endAddress) > 0) { |
| 704 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
711 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
| 705 |
return insertedStartAddress; |
712 |
return insertedAnyAddress; |
| 706 |
} else if (p.fValid) { |
713 |
} else if (p.fValid) { |
| 707 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
714 |
if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ |
| 708 |
if (!p.fAddressOffset.equals(address)) { |
715 |
if (!p.fAddressOffset.equals(address)) { |
|
Lines 725-750
Link Here
|
| 725 |
} |
732 |
} |
| 726 |
// determine instruction byte length |
733 |
// determine instruction byte length |
| 727 |
BigInteger instrLength= null; |
734 |
BigInteger instrLength= null; |
| 728 |
if (j < instructions.length - 1) { |
735 |
if (instruction instanceof IInstructionWithSize |
| 729 |
instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); |
736 |
&& ((IInstructionWithSize)instruction).getSize() != null) { |
| 730 |
} else if (i < mixedInstructions.length - 1) { |
737 |
instrLength= new BigInteger(((IInstructionWithSize)instruction).getSize().toString()); |
| 731 |
int nextSrcLineIdx= i+1; |
738 |
} else { |
| 732 |
while (nextSrcLineIdx < mixedInstructions.length) { |
739 |
if (j < instructions.length - 1) { |
| 733 |
IInstruction[] nextInstrs= mixedInstructions[nextSrcLineIdx].getInstructions(); |
740 |
instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); |
| 734 |
if (nextInstrs.length > 0) { |
741 |
} else if (i < mixedInstructions.length - 1) { |
| 735 |
instrLength= nextInstrs[0].getAdress().subtract(instruction.getAdress()).abs(); |
742 |
int nextSrcLineIdx= i+1; |
|
|
743 |
while (nextSrcLineIdx < mixedInstructions.length) { |
| 744 |
IInstruction[] nextInstrs= mixedInstructions[nextSrcLineIdx].getInstructions(); |
| 745 |
if (nextInstrs.length > 0) { |
| 746 |
instrLength= nextInstrs[0].getAdress().subtract(instruction.getAdress()).abs(); |
| 747 |
break; |
| 748 |
} |
| 749 |
++nextSrcLineIdx; |
| 750 |
} |
| 751 |
if (nextSrcLineIdx >= mixedInstructions.length) { |
| 736 |
break; |
752 |
break; |
| 737 |
} |
753 |
} |
| 738 |
++nextSrcLineIdx; |
|
|
| 739 |
} |
754 |
} |
| 740 |
if (nextSrcLineIdx >= mixedInstructions.length) { |
755 |
if (instrLength == null) { |
|
|
756 |
// cannot determine length of last instruction |
| 741 |
break; |
757 |
break; |
| 742 |
} |
758 |
} |
| 743 |
} |
759 |
} |
| 744 |
if (instrLength == null) { |
|
|
| 745 |
// cannot determine length of last instruction |
| 746 |
break; |
| 747 |
} |
| 748 |
final String opCode; |
760 |
final String opCode; |
| 749 |
// insert function name+offset instead of opcode bytes |
761 |
// insert function name+offset instead of opcode bytes |
| 750 |
if (functionName != null && functionName.length() > 0) { |
762 |
if (functionName != null && functionName.length() > 0) { |
|
Lines 752-762
Link Here
|
| 752 |
} else { |
764 |
} else { |
| 753 |
opCode= ""; //$NON-NLS-1$ |
765 |
opCode= ""; //$NON-NLS-1$ |
| 754 |
} |
766 |
} |
| 755 |
insertedStartAddress= insertedStartAddress || address.compareTo(startAddress) == 0; |
|
|
| 756 |
p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstruction(), file, lineNumber); |
767 |
p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstruction(), file, lineNumber); |
| 757 |
if (p == null && insertedStartAddress) { |
768 |
if (p == null) { |
| 758 |
break; |
769 |
break; |
| 759 |
} |
770 |
} |
|
|
771 |
insertedAnyAddress = true; |
| 760 |
} |
772 |
} |
| 761 |
} |
773 |
} |
| 762 |
|
774 |
|
|
Lines 765-771
Link Here
|
| 765 |
DisassemblyUtils.internalError(e); |
777 |
DisassemblyUtils.internalError(e); |
| 766 |
} finally { |
778 |
} finally { |
| 767 |
fCallback.setUpdatePending(false); |
779 |
fCallback.setUpdatePending(false); |
| 768 |
if (insertedStartAddress) { |
780 |
if (insertedAnyAddress) { |
| 769 |
fCallback.updateInvalidSource(); |
781 |
fCallback.updateInvalidSource(); |
| 770 |
fCallback.unlockScroller(); |
782 |
fCallback.unlockScroller(); |
| 771 |
fCallback.doPending(); |
783 |
fCallback.doPending(); |
|
Lines 774-780
Link Here
|
| 774 |
fCallback.unlockScroller(); |
786 |
fCallback.unlockScroller(); |
| 775 |
} |
787 |
} |
| 776 |
} |
788 |
} |
| 777 |
return insertedStartAddress; |
789 |
return insertedAnyAddress; |
| 778 |
} |
790 |
} |
| 779 |
|
791 |
|
| 780 |
/* (non-Javadoc) |
792 |
/* (non-Javadoc) |