Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#1569 AArch64: Print instruction if encoding fails. #2315

Merged
merged 3 commits into from
Mar 30, 2017

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented Mar 29, 2017

As the parser for AArch64 is not complete yet dumping instructions that could
not be encoded makes it easier to diagnose encoding problems.

As the parser for AArch64 is not complete yet dumping instructions that could
not be encoded makes it easier to diagnose encoding problems.
@fhahn
Copy link
Contributor Author

fhahn commented Mar 29, 2017

252 - code_api|api.static_signal (Failed) caused the Travis-ci failure: https://travis-ci.org/DynamoRIO/dynamorio/jobs/216403717

Xref #2112

@derekbruening
Copy link
Contributor

Make sure any issue hit on Travis or Appveyor has the Hotlist-Travis label. At some point we'll have a Travis Fixit and try to get all-hand-on-board for a burst of flaky test fixing, using that label to find all such problems.

@derekbruening
Copy link
Contributor

I added the label.

@@ -46,7 +46,6 @@

#include "codec.h"

#define ENCFAIL (uint)0 /* a value that is not a valid instruction */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't ENCFAIL used in codec.c below? Wouldn't this make it no longer compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the define to codec.h, which is included by codec.c

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I misread it, thought it was moved to encode.c.

@@ -160,6 +160,11 @@ instr_encode_arch(dcontext_t *dcontext, instr_t *instr, byte *copy_pc, byte *fin
CLIENT_ASSERT(instr_operands_valid(instr), "instr_encode error: operands invalid");

*(uint *)copy_pc = encode_common(final_pc, instr);
if (*(uint *)copy_pc == ENCFAIL) {
IF_DEBUG(instr_disassemble(dcontext, instr, STDERR));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything printed should go through the checks for stderr_mask. How about instr_disassemble_to_buffer and then print via SYSLOG_INTERNAL_ERROR which has the proper checks and also tees the print to the log file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in latest commit. I've also added a short message using SYSLOG_INTERNAL_ERROR, it should be much better now than just using instr_disassemble :)

/* We were unable to encode this instruction. */
IF_DEBUG({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DODEBUG is what's generally used but the difference is minor.

@derekbruening
Copy link
Contributor

I think my recent change to static_signal may have made it flaky on Travis.

@fhahn fhahn merged commit 2ea03bb into master Mar 30, 2017
@derekbruening
Copy link
Contributor

It looks like the bottom of the commit message was not fully edited on the squash-and-merge: please remember to edit the message, as github just squashes the different commit messages together.

@derekbruening derekbruening deleted the i1569-dump-instr-on-encode-failure branch March 30, 2017 22:30
@derekbruening
Copy link
Contributor

There's also weird whitespace:

Date:   Thu Mar 30 16:54:49 2017 +0100

    i#1569 AArch64: Print instruction if encoding fails. (#2315)
    
    
    
    As the parser for AArch64 is not complete yet dumping instructions that could
    not be encoded makes it easier to diagnose encoding problems.
    
    * Use SYSLOG_INTERNAL_ERROR to dump disassembled instruction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants