|
Lines 116-122
Link Here
|
| 116 |
register(new String[] { MIMemory.class.getName(), IMemory.class.getName() }, new Hashtable<String, String>()); |
116 |
register(new String[] { MIMemory.class.getName(), IMemory.class.getName() }, new Hashtable<String, String>()); |
| 117 |
|
117 |
|
| 118 |
// Create the memory requests cache |
118 |
// Create the memory requests cache |
| 119 |
fMemoryCache = new MIMemoryCache(); |
119 |
setMemoryCache(new MIMemoryCache()); |
| 120 |
|
120 |
|
| 121 |
// Register as service event listener |
121 |
// Register as service event listener |
| 122 |
getSession().addServiceEventListener(this, null); |
122 |
getSession().addServiceEventListener(this, null); |
|
Lines 149-154
Link Here
|
| 149 |
return MIPlugin.getBundleContext(); |
149 |
return MIPlugin.getBundleContext(); |
| 150 |
} |
150 |
} |
| 151 |
|
151 |
|
|
|
152 |
/** |
| 153 |
* This method resets the memory cache. It allows an overriding class to provide |
| 154 |
* its own memory cache class. |
| 155 |
* |
| 156 |
* @since 1.1 |
| 157 |
*/ |
| 158 |
protected void setMemoryCache(MIMemoryCache cache) { fMemoryCache = cache; } |
| 159 |
|
| 160 |
|
| 152 |
/////////////////////////////////////////////////////////////////////////// |
161 |
/////////////////////////////////////////////////////////////////////////// |
| 153 |
// IMemory |
162 |
// IMemory |
| 154 |
/////////////////////////////////////////////////////////////////////////// |
163 |
/////////////////////////////////////////////////////////////////////////// |
|
Lines 440-446
Link Here
|
| 440 |
// MIMemoryCache |
449 |
// MIMemoryCache |
| 441 |
/////////////////////////////////////////////////////////////////////////// |
450 |
/////////////////////////////////////////////////////////////////////////// |
| 442 |
|
451 |
|
| 443 |
private class MIMemoryCache { |
452 |
/** |
|
|
453 |
* This class can now be overridden. |
| 454 |
* |
| 455 |
* @since 1.1 |
| 456 |
*/ |
| 457 |
protected class MIMemoryCache { |
| 444 |
|
458 |
|
| 445 |
// Back-end commands cache |
459 |
// Back-end commands cache |
| 446 |
private CommandCache fCommandCache; |
460 |
private CommandCache fCommandCache; |
|
Lines 848-854
Link Here
|
| 848 |
* @param count |
862 |
* @param count |
| 849 |
* @param drm |
863 |
* @param drm |
| 850 |
*/ |
864 |
*/ |
| 851 |
private void readMemoryBlock(IMemoryDMContext memoryDMC, IAddress address, final long offset, |
865 |
protected void readMemoryBlock(IDMContext dmc, IAddress address, final long offset, |
| 852 |
final int word_size, final int count, final DataRequestMonitor<MemoryByte[]> drm) |
866 |
final int word_size, final int count, final DataRequestMonitor<MemoryByte[]> drm) |
| 853 |
{ |
867 |
{ |
| 854 |
/* To simplify the parsing of the MI result, we request the output to |
868 |
/* To simplify the parsing of the MI result, we request the output to |
|
Lines 860-866
Link Here
|
| 860 |
Character asChar = null; |
874 |
Character asChar = null; |
| 861 |
|
875 |
|
| 862 |
fCommandCache.execute( |
876 |
fCommandCache.execute( |
| 863 |
new MIDataReadMemory(memoryDMC, offset, address.toString(), mode, word_size, nb_rows, nb_cols, asChar), |
877 |
new MIDataReadMemory(dmc, offset, address.toString(), mode, word_size, nb_rows, nb_cols, asChar), |
| 864 |
new DataRequestMonitor<MIDataReadMemoryInfo>(getExecutor(), drm) { |
878 |
new DataRequestMonitor<MIDataReadMemoryInfo>(getExecutor(), drm) { |
| 865 |
@Override |
879 |
@Override |
| 866 |
protected void handleSuccess() { |
880 |
protected void handleSuccess() { |
|
Lines 890-896
Link Here
|
| 890 |
* @param buffer |
904 |
* @param buffer |
| 891 |
* @param rm |
905 |
* @param rm |
| 892 |
*/ |
906 |
*/ |
| 893 |
private void writeMemoryBlock(final IMemoryDMContext memoryDMC, final IAddress address, final long offset, |
907 |
protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, |
| 894 |
final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) |
908 |
final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) |
| 895 |
{ |
909 |
{ |
| 896 |
// Each byte is written individually (GDB power...) |
910 |
// Each byte is written individually (GDB power...) |
|
Lines 906-912
Link Here
|
| 906 |
for (int i = 0; i < count; i++) { |
920 |
for (int i = 0; i < count; i++) { |
| 907 |
String value = new Byte(buffer[i]).toString(); |
921 |
String value = new Byte(buffer[i]).toString(); |
| 908 |
fCommandCache.execute( |
922 |
fCommandCache.execute( |
| 909 |
new MIDataWriteMemory(memoryDMC, offset + i, baseAddress, format, word_size, value), |
923 |
new MIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), |
| 910 |
new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM) |
924 |
new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM) |
| 911 |
); |
925 |
); |
| 912 |
} |
926 |
} |