| Summary: | MemoryProxy not properly processing non-zero offsets in range containing multiple entries | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] TCF | Reporter: | Kirk Beitz <kirk.beitz> | ||||
| Component: | Core | Assignee: | Project Inbox <dsdp.tm.tcf-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Martin Oberhuber <mober.at+eclipse> | ||||
| Severity: | critical | ||||||
| Priority: | P3 | CC: | cdtdoug, eugene | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 0.4.0 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Kirk Beitz
arrgh … why can't you edit own mistakes in bugzilla?!?
the bad snippet and the better substitution in the description are inverted!!!
try the following instead:
this snippet of code (also seen in the attached patch) appears to be incorrect:
BigInteger addr_bi = addr instanceof BigInteger ?
(BigInteger)addr : new BigInteger(addr.toString());
for (Map<String,Object> m : c) {
Range r = new Range();
Number x = (Number)m.get(RANGE_KEY_ADDR);
BigInteger y = x instanceof BigInteger ?
(BigInteger)x : new BigInteger(x.toString());
this call =======> r.offs = addr_bi.subtract(y).intValue();
r.size = ((Number)m.get(RANGE_KEY_SIZE)).intValue();
r.stat = ((Number)m.get(RANGE_KEY_STAT)).intValue();
r.msg = Command.toErrorString(m.get(RANGE_KEY_MSG));
causes this =====> assert r.offs >= 0;
to fire the assert r.size >= 0;
second time this.ranges[n++] = r;
thru the loop }
it would seem to be more appropriate to have it be
better ==========> r.offs = y.subtract(addr_bi).intValue();
subtract() method has a mystical power to get its arguments inverted :-) Yes, it a bug. I have committed the patch. Thanks! Moving bugs to new home for IP log. Bulk change: Marking all bugs from the TM era (until June 2011) target 0.3 |