Intel Pin:Invalid REG for IARG_REG_VALUE reg: xmm0
I'm making a program to trace the program, but I am having trouble with the error like the title.
Is there anyone who can understand something?
INS_InsertCall(ins, action, AFUNPTR(RegOpnd::at_call),
IARG_PTR, data,
IARG_PTR, this,
IARG_REG_VALUE, reg_,
IARG_END);
I checked that IARG_REG_VALUE was not compatible with xmm registers.
How can I get the information?
intel-pin
add a comment |
I'm making a program to trace the program, but I am having trouble with the error like the title.
Is there anyone who can understand something?
INS_InsertCall(ins, action, AFUNPTR(RegOpnd::at_call),
IARG_PTR, data,
IARG_PTR, this,
IARG_REG_VALUE, reg_,
IARG_END);
I checked that IARG_REG_VALUE was not compatible with xmm registers.
How can I get the information?
intel-pin
add a comment |
I'm making a program to trace the program, but I am having trouble with the error like the title.
Is there anyone who can understand something?
INS_InsertCall(ins, action, AFUNPTR(RegOpnd::at_call),
IARG_PTR, data,
IARG_PTR, this,
IARG_REG_VALUE, reg_,
IARG_END);
I checked that IARG_REG_VALUE was not compatible with xmm registers.
How can I get the information?
intel-pin
I'm making a program to trace the program, but I am having trouble with the error like the title.
Is there anyone who can understand something?
INS_InsertCall(ins, action, AFUNPTR(RegOpnd::at_call),
IARG_PTR, data,
IARG_PTR, this,
IARG_REG_VALUE, reg_,
IARG_END);
I checked that IARG_REG_VALUE was not compatible with xmm registers.
How can I get the information?
intel-pin
intel-pin
edited Nov 15 '18 at 5:31
pinenight
asked Nov 15 '18 at 5:07
pinenightpinenight
104
104
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
As the documentation says:
this cannot be used to retrieve the value of registers whose size is larger than ADDRINT (e.g. x87 FPU/XMM/YMM/ZMM/opmask)
You have two options, either:
- Test for the type of the register and use
IARG_REG_CONST_REFERENCE
(orIARG_REG_REFERENCE
if you wish to modify the register). - Get the CPU context (using
IARG_CONST_CONTEXT
orIARG_CONTEXT
if you wish to modify any register in it) and inspect the registers in the context.
I guess that the first option is the more meaningful one, so it should go approximately like the code below:
Warning: code below has not been tested / compiled...
Instrumentation:
const unsigned int opnd_count = INS_OperandCount(ins);
for(unsigned int i=0; i < opnd_count;i++)
if (INS_OperandIsReg(ins,i))
REG r = INS_OperandReg(ins,i);
if ((r))
INS_InsertCall(ins, IPOINT_AFTER, (AFUNPTR)xmm_arg,
IARG_REG_CONST_REFERENCE, r,
IARG_REG_REFERENCE, r, // you might remove this one if you don't modify the reg.
IARG_UINT32, i,
IARG_UINT32, (r-REG_XMM_BASE), // note: REG_XMM_BASE = REG_XMM0
IARG_END);
Analysis:
// regConstRef: const reference on the register
// regRef: reference on the register
// opnd_indx: operand index (0 for the 1st inst. op.; 1 for the 2nd inst. op.)
// regno: register number: 0 = XMM0; 1 = XMM1, etc.
VOID xmm_arg(PIN_REGISTER* regConstRef, PIN_REGISTER* regRef, UINT32 opnd_indx, UINT32 regno)
// just "dump" the register
std::cout << "XMM" << regno << " operand_index: " << opnd_indx << " ";
for(unsigned int i=0;i< MAX_DWORDS_PER_PIN_REG;i++)
std::cout << std::setw(10) << regConstRef->dword[i] << " ";
std::cout << std::endl;
Thanks,comment. I will try to run it with code.I finally want to correspond to XMM / YMM / ZMM registers.
– pinenight
Nov 20 '18 at 6:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53312772%2fintel-pininvalid-reg-for-iarg-reg-value-reg-xmm0%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As the documentation says:
this cannot be used to retrieve the value of registers whose size is larger than ADDRINT (e.g. x87 FPU/XMM/YMM/ZMM/opmask)
You have two options, either:
- Test for the type of the register and use
IARG_REG_CONST_REFERENCE
(orIARG_REG_REFERENCE
if you wish to modify the register). - Get the CPU context (using
IARG_CONST_CONTEXT
orIARG_CONTEXT
if you wish to modify any register in it) and inspect the registers in the context.
I guess that the first option is the more meaningful one, so it should go approximately like the code below:
Warning: code below has not been tested / compiled...
Instrumentation:
const unsigned int opnd_count = INS_OperandCount(ins);
for(unsigned int i=0; i < opnd_count;i++)
if (INS_OperandIsReg(ins,i))
REG r = INS_OperandReg(ins,i);
if ((r))
INS_InsertCall(ins, IPOINT_AFTER, (AFUNPTR)xmm_arg,
IARG_REG_CONST_REFERENCE, r,
IARG_REG_REFERENCE, r, // you might remove this one if you don't modify the reg.
IARG_UINT32, i,
IARG_UINT32, (r-REG_XMM_BASE), // note: REG_XMM_BASE = REG_XMM0
IARG_END);
Analysis:
// regConstRef: const reference on the register
// regRef: reference on the register
// opnd_indx: operand index (0 for the 1st inst. op.; 1 for the 2nd inst. op.)
// regno: register number: 0 = XMM0; 1 = XMM1, etc.
VOID xmm_arg(PIN_REGISTER* regConstRef, PIN_REGISTER* regRef, UINT32 opnd_indx, UINT32 regno)
// just "dump" the register
std::cout << "XMM" << regno << " operand_index: " << opnd_indx << " ";
for(unsigned int i=0;i< MAX_DWORDS_PER_PIN_REG;i++)
std::cout << std::setw(10) << regConstRef->dword[i] << " ";
std::cout << std::endl;
Thanks,comment. I will try to run it with code.I finally want to correspond to XMM / YMM / ZMM registers.
– pinenight
Nov 20 '18 at 6:02
add a comment |
As the documentation says:
this cannot be used to retrieve the value of registers whose size is larger than ADDRINT (e.g. x87 FPU/XMM/YMM/ZMM/opmask)
You have two options, either:
- Test for the type of the register and use
IARG_REG_CONST_REFERENCE
(orIARG_REG_REFERENCE
if you wish to modify the register). - Get the CPU context (using
IARG_CONST_CONTEXT
orIARG_CONTEXT
if you wish to modify any register in it) and inspect the registers in the context.
I guess that the first option is the more meaningful one, so it should go approximately like the code below:
Warning: code below has not been tested / compiled...
Instrumentation:
const unsigned int opnd_count = INS_OperandCount(ins);
for(unsigned int i=0; i < opnd_count;i++)
if (INS_OperandIsReg(ins,i))
REG r = INS_OperandReg(ins,i);
if ((r))
INS_InsertCall(ins, IPOINT_AFTER, (AFUNPTR)xmm_arg,
IARG_REG_CONST_REFERENCE, r,
IARG_REG_REFERENCE, r, // you might remove this one if you don't modify the reg.
IARG_UINT32, i,
IARG_UINT32, (r-REG_XMM_BASE), // note: REG_XMM_BASE = REG_XMM0
IARG_END);
Analysis:
// regConstRef: const reference on the register
// regRef: reference on the register
// opnd_indx: operand index (0 for the 1st inst. op.; 1 for the 2nd inst. op.)
// regno: register number: 0 = XMM0; 1 = XMM1, etc.
VOID xmm_arg(PIN_REGISTER* regConstRef, PIN_REGISTER* regRef, UINT32 opnd_indx, UINT32 regno)
// just "dump" the register
std::cout << "XMM" << regno << " operand_index: " << opnd_indx << " ";
for(unsigned int i=0;i< MAX_DWORDS_PER_PIN_REG;i++)
std::cout << std::setw(10) << regConstRef->dword[i] << " ";
std::cout << std::endl;
Thanks,comment. I will try to run it with code.I finally want to correspond to XMM / YMM / ZMM registers.
– pinenight
Nov 20 '18 at 6:02
add a comment |
As the documentation says:
this cannot be used to retrieve the value of registers whose size is larger than ADDRINT (e.g. x87 FPU/XMM/YMM/ZMM/opmask)
You have two options, either:
- Test for the type of the register and use
IARG_REG_CONST_REFERENCE
(orIARG_REG_REFERENCE
if you wish to modify the register). - Get the CPU context (using
IARG_CONST_CONTEXT
orIARG_CONTEXT
if you wish to modify any register in it) and inspect the registers in the context.
I guess that the first option is the more meaningful one, so it should go approximately like the code below:
Warning: code below has not been tested / compiled...
Instrumentation:
const unsigned int opnd_count = INS_OperandCount(ins);
for(unsigned int i=0; i < opnd_count;i++)
if (INS_OperandIsReg(ins,i))
REG r = INS_OperandReg(ins,i);
if ((r))
INS_InsertCall(ins, IPOINT_AFTER, (AFUNPTR)xmm_arg,
IARG_REG_CONST_REFERENCE, r,
IARG_REG_REFERENCE, r, // you might remove this one if you don't modify the reg.
IARG_UINT32, i,
IARG_UINT32, (r-REG_XMM_BASE), // note: REG_XMM_BASE = REG_XMM0
IARG_END);
Analysis:
// regConstRef: const reference on the register
// regRef: reference on the register
// opnd_indx: operand index (0 for the 1st inst. op.; 1 for the 2nd inst. op.)
// regno: register number: 0 = XMM0; 1 = XMM1, etc.
VOID xmm_arg(PIN_REGISTER* regConstRef, PIN_REGISTER* regRef, UINT32 opnd_indx, UINT32 regno)
// just "dump" the register
std::cout << "XMM" << regno << " operand_index: " << opnd_indx << " ";
for(unsigned int i=0;i< MAX_DWORDS_PER_PIN_REG;i++)
std::cout << std::setw(10) << regConstRef->dword[i] << " ";
std::cout << std::endl;
As the documentation says:
this cannot be used to retrieve the value of registers whose size is larger than ADDRINT (e.g. x87 FPU/XMM/YMM/ZMM/opmask)
You have two options, either:
- Test for the type of the register and use
IARG_REG_CONST_REFERENCE
(orIARG_REG_REFERENCE
if you wish to modify the register). - Get the CPU context (using
IARG_CONST_CONTEXT
orIARG_CONTEXT
if you wish to modify any register in it) and inspect the registers in the context.
I guess that the first option is the more meaningful one, so it should go approximately like the code below:
Warning: code below has not been tested / compiled...
Instrumentation:
const unsigned int opnd_count = INS_OperandCount(ins);
for(unsigned int i=0; i < opnd_count;i++)
if (INS_OperandIsReg(ins,i))
REG r = INS_OperandReg(ins,i);
if ((r))
INS_InsertCall(ins, IPOINT_AFTER, (AFUNPTR)xmm_arg,
IARG_REG_CONST_REFERENCE, r,
IARG_REG_REFERENCE, r, // you might remove this one if you don't modify the reg.
IARG_UINT32, i,
IARG_UINT32, (r-REG_XMM_BASE), // note: REG_XMM_BASE = REG_XMM0
IARG_END);
Analysis:
// regConstRef: const reference on the register
// regRef: reference on the register
// opnd_indx: operand index (0 for the 1st inst. op.; 1 for the 2nd inst. op.)
// regno: register number: 0 = XMM0; 1 = XMM1, etc.
VOID xmm_arg(PIN_REGISTER* regConstRef, PIN_REGISTER* regRef, UINT32 opnd_indx, UINT32 regno)
// just "dump" the register
std::cout << "XMM" << regno << " operand_index: " << opnd_indx << " ";
for(unsigned int i=0;i< MAX_DWORDS_PER_PIN_REG;i++)
std::cout << std::setw(10) << regConstRef->dword[i] << " ";
std::cout << std::endl;
answered Nov 16 '18 at 11:46
NeitsaNeitsa
4,86311731
4,86311731
Thanks,comment. I will try to run it with code.I finally want to correspond to XMM / YMM / ZMM registers.
– pinenight
Nov 20 '18 at 6:02
add a comment |
Thanks,comment. I will try to run it with code.I finally want to correspond to XMM / YMM / ZMM registers.
– pinenight
Nov 20 '18 at 6:02
Thanks,comment. I will try to run it with code.I finally want to correspond to XMM / YMM / ZMM registers.
– pinenight
Nov 20 '18 at 6:02
Thanks,comment. I will try to run it with code.I finally want to correspond to XMM / YMM / ZMM registers.
– pinenight
Nov 20 '18 at 6:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53312772%2fintel-pininvalid-reg-for-iarg-reg-value-reg-xmm0%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown