Page MenuHomePhabricator

Fix -data-read-memory-bytes command (MI)

Authored by ki.stfu on Feb 13 2015, 6:03 AM.


  • Add IsHexadecimalNumber method to CMIUtilString (MI)
  • Add number format (dec,hex,auto) to CMICmdArgValNumber (MI)
  • Fix -data-read-memory-bytes to pass address in hex format (MI)
  • Fix output begin/end/offset fields format in -data-read-memory-bytes
  • Fix CMICmdArgValNumber::ExtractNumber to extract 64bit value
  • + tests

All tests passed on OS X

Diff Detail

Event Timeline

ki.stfu updated this revision to Diff 19882.Feb 13 2015, 6:03 AM
ki.stfu retitled this revision from to Fix -data-read-memory-bytes command (MI).
ki.stfu updated this object.
ki.stfu edited the test plan for this revision. (Show Details)
ki.stfu added reviewers: abidh, clayborg, zturner.
ki.stfu added subscribers: abidh, clayborg, zturner, Unknown Object (MLST).
ki.stfu updated this revision to Diff 19883.Feb 13 2015, 6:11 AM

Fix MiExecTestCase tests

ki.stfu planned changes to this revision.Feb 13 2015, 6:18 AM
ki.stfu added inline comments.

set errno to 0 before strtoull()

ki.stfu updated this revision to Diff 19889.Feb 13 2015, 6:43 AM

Fix strtoull() in CMIUtilString::ExtractNumberFromHexadecimal

ki.stfu updated this revision to Diff 19900.Feb 13 2015, 9:39 AM

Minor fixes of comments

clayborg requested changes to this revision.Feb 13 2015, 9:48 AM
clayborg edited edge metadata.

Check your strtoull call and make sure you don't need to check if all characters were consumed otherwise the call to strtoull can succeed with "123qed" or any string that isn't all numbers.


Newbie MI question: no quotes needed around the path?


Has the string been verified to only contain value number characters? If not, then you want to change this to:

char *end = NULL;
const MIuint64 nNum = ::strtoull(this->c_str(), &end, 16);
if (end && *end != '\0')
    return false;
This revision now requires changes to proceed.Feb 13 2015, 9:48 AM
ki.stfu added inline comments.Feb 13 2015, 10:24 AM

In this case not, because self.myexe equals to "a.out", which is loaded from current directory.


This function is called by CMICmdArgValNumber::ExtractNumber() which verifies that string contains only a number.

In other cases I think we can use it like:

CMIUtilString str("0x500 MyFunctionName");
MIuint64 n;
assert (n == 0x500);
ki.stfu requested a review of this revision.Feb 13 2015, 10:24 AM
ki.stfu edited edge metadata.
clayborg accepted this revision.Feb 13 2015, 10:31 AM
clayborg edited edge metadata.

Thanks for the explantation, looks good.

This revision is now accepted and ready to land.Feb 13 2015, 10:31 AM
ki.stfu closed this revision.Feb 13 2015, 10:44 AM