Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Merge requests
  • !4952

i#4865 emulate: Add new emulation instrumentation API

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Derek Bruening requested to merge i4865-emulation-api into master 3 years ago
  • Overview 49
  • Commits 5
  • Pipelines 0
  • Changes 13

Adds a new emulation instrumentation interface with simpler convenience routines for identifying the original application instruction fetch and operands.

Uses the new interface in memtrace_simple. Separate commits will update memval_simple, memtrace_x86, and drmemtrace.

Adds an x86 test that runs the memtrace_simple sample on the allasm_repstr app and ensures we see 2-byte "rep movs" instructions instead of the 1-byte "movs" that the existing sample client records due to not being emulation-aware. Adds a -log_to_stderr flag to the sample to make the test simpler and not have to deal with log files.

Adding new events is separated into #4947 which we may attempt in the future. Removing rep string non-fetched instructions is #4948.


Testing:

memtrace_simple before: $ bin64/drrun -c api/bin/libmemtrace_simple.so -- suite/tests/bin/allasm_repstr && cat ls -1td api/bin/*.log|head -1 Format: : , <(r)ead/(w)rite/opcode> 0x401018: 1, movs 0x40200e: 1, r 0x402000: 1, w 0x401018: 1, movs 0x40200f: 1, r 0x402001: 1, w 0x401018: 1, movs 0x402010: 1, r 0x402002: 1, w 0x401018: 1, movs 0x402011: 1, r 0x402003: 1, w 0x401018: 1, movs 0x402012: 1, r 0x402004: 1, w After: Format: : , <(r)ead/(w)rite/opcode> 0x401018: 2, rep movs 0x40200e: 1, r 0x402000: 1, w 0x401018: 2, rep movs 0x40200f: 1, r 0x402001: 1, w 0x401018: 2, rep movs 0x402010: 1, r 0x402002: 1, w 0x401018: 2, rep movs 0x402011: 1, r 0x402003: 1, w 0x401018: 2, rep movs 0x402012: 1, r 0x402004: 1, w

memtrace_simple on a gather expansion: $ ninja && bin64/drrun -c api/bin/libmemtrace_simple.so -log_to_stderr -- suite/tests/bin/allasm_scattergather Format: : , <(r)ead/(w)rite/opcode> 0x40105c: 11, mov 0x402022: 4, w 0x401067: 11, mov 0x402026: 4, w 0x401072: 11, mov 0x40202a: 4, w 0x40108a: 7, mov 0x402026: 4, r 0x40108a: 7, mov 0x40202e: 4, r 0x40108a: 7, mov 0x40202a: 4, r => Format: : , <(r)ead/(w)rite/opcode> 0x40105c: 11, mov 0x402022: 4, w 0x401067: 11, mov 0x402026: 4, w 0x401072: 11, mov 0x40202a: 4, w 0x40108a: 10, vpgatherdd 0x402026: 4, r 0x40202e: 4, r 0x40202a: 4, r

Issue: #4865 (closed)

Activity

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
  1. 18 Jun, 2021 5 commits
    • Derek Bruening's avatar
      Fix argv option check · 667e86b4
      Derek Bruening authored 3 years ago
      667e86b4
    • Derek Bruening's avatar
      Merge branch 'master' of github.com:DynamoRIO/dynamorio into i4865-emulation-api · e70db468
      Derek Bruening authored 3 years ago
      e70db468
    • Derek Bruening's avatar
      s/dr_get_options/argv/; s/API's/APIs/ · 02c3d6e7
      Derek Bruening authored 3 years ago
      02c3d6e7
    • Derek Bruening's avatar
      s/DR_EMULATE_FIRST_INSTR/#DR_EMULATE_IS_FIRST_INSTR/; Remove stale docs;... · 396c37e4
      Derek Bruening authored 3 years ago
      s/DR_EMULATE_FIRST_INSTR/#DR_EMULATE_IS_FIRST_INSTR/; Remove stale docs; Comment and doc updates per reviewer suggestions
      396c37e4
    • Derek Bruening's avatar
      i#4865 emulate: Add new emulation instrumentation API · 8f35c256
      Derek Bruening authored 3 years ago
      Adds a new emulation instrumentation interface with simpler
      convenience routines for identifying the original application
      instruction fetch and operands.
      
      Uses the new interface in memtrace_simple.  Separate commits will
      update memval_simple, memtrace_x86, and drmemtrace.
      
      Adds an x86 test that runs the memtrace_simple sample on the
      allasm_repstr app and ensures we see 2-byte "rep movs" instructions
      instead of the 1-byte "movs" that the existing sample client records
      due to not being emulation-aware.  Adds a -log_to_stderr flag to the
      sample to make the test simpler and not have to deal with log files.
      
      Adding new events is separated into #4947 which we may attempt in the
      future.  Removing rep string non-fetched instructions is #4948.
      
      --------------------------------------------------
      Testing:
      
      memtrace_simple before:
          $ bin64/drrun -c api/bin/libmemtrace_simple.so -- suite/tests/bin/allasm_repstr && cat `ls -1td api/bin/*.log|head -1`
          Format: <data address>: <data size>, <(r)ead/(w)rite/opcode>
          0x401018:  1, movs
          0x40200e:  1, r
          0x402000:  1, w
          0x401018:  1, movs
          0x40200f:  1, r
          0x402001:  1, w
          0x401018:  1, movs
          0x402010:  1, r
          0x402002:  1, w
          0x401018:  1, movs
          0x402011:  1, r
          0x402003:  1, w
          0x401018:  1, movs
          0x402012:  1, r
          0x402004:  1, w
      After:
          Format: <data address>: <data size>, <(r)ead/(w)rite/opcode>
          0x401018:  2, rep movs
          0x40200e:  1, r
          0x402000:  1, w
          0x401018:  2, rep movs
          0x40200f:  1, r
          0x402001:  1, w
          0x401018:  2, rep movs
          0x402010:  1, r
          0x402002:  1, w
          0x401018:  2, rep movs
          0x402011:  1, r
          0x402003:  1, w
          0x401018:  2, rep movs
          0x402012:  1, r
          0x402004:  1, w
      
      memtrace_simple on a gather expansion:
          $ ninja && bin64/drrun -c api/bin/libmemtrace_simple.so -log_to_stderr -- suite/tests/bin/allasm_scattergather
          Format: <data address>: <data size>, <(r)ead/(w)rite/opcode>
          0x40105c: 11, mov
          0x402022:  4, w
          0x401067: 11, mov
          0x402026:  4, w
          0x401072: 11, mov
          0x40202a:  4, w
          0x40108a:  7, mov
          0x402026:  4, r
          0x40108a:  7, mov
          0x40202e:  4, r
          0x40108a:  7, mov
          0x40202a:  4, r
        =>
          Format: <data address>: <data size>, <(r)ead/(w)rite/opcode>
          0x40105c: 11, mov
          0x402022:  4, w
          0x401067: 11, mov
          0x402026:  4, w
          0x401072: 11, mov
          0x40202a:  4, w
          0x40108a: 10, vpgatherdd
          0x402026:  4, r
          0x40202e:  4, r
          0x40202a:  4, r
      --------------------------------------------------
      
      Issue: #4865
      8f35c256
0 Assignees
None
Assign to
2 Reviewers
Abhinav Anil Sharma's avatar
Abhinav Anil Sharma
Derek Bruening's avatar
Derek Bruening
Request review from
Labels
1
Google-Verified
1
Google-Verified
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
participants
Reference: DynamoRIO/dynamorio!4952
Source branch: i4865-emulation-api

Menu

Explore Projects Groups Snippets