Skip to content

Commit

Permalink
Merge branch 'master' into i6495-syscall-templ-invariants
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav92003 authored Mar 28, 2024
2 parents 90ec235 + 98d55a6 commit e31a043
Show file tree
Hide file tree
Showing 25 changed files with 927 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ jobs:
7z x c:\projects\install\doxygen.zip -oc:\projects\install\doxygen > nul
set PATH=c:\projects\install\doxygen;%PATH%
dir "c:\Program Files (x86)\WiX Toolset"*
set PATH=C:\Program Files (x86)\WiX Toolset v3.11\bin;%PATH%
set PATH=C:\Program Files (x86)\WiX Toolset v3.14\bin;%PATH%
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat"
echo ------ Running suite ------
echo PATH is "%PATH%"
Expand Down
34 changes: 33 additions & 1 deletion api/docs/CMake_rundoxygen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ if (embeddable)
endforeach ()

# We leverage the javascript menu from the non-embedded version.
# Menu hierarchy changes:
# (1) Remove the outer "DynamoRIO" layer.
# (2) Remove home page at the end.
# (3) Insert an "API Reference" layer around API details.
# (4) Move the "Extension API" menu inside "Build Your Own Tool".
file(GLOB all_js ${CMAKE_CURRENT_BINARY_DIR}/../html/*.js)
set(found_user_docs OFF)
foreach (js ${all_js})
Expand Down Expand Up @@ -286,7 +291,31 @@ if (embeddable)
message(FATAL_ERROR "Cannot find menu entry for page \"Extension API\"")
endif ()
string(REGEX MATCH "\n[^\n]+\"Extension API\"[^\n]+\n" ext_entry "${string}")
string(REPLACE "${ext_entry}" "\n" string "${string}")
# If ext_entry ends with a [, the menu items are expanded inline and the
# whole Extension API menu can be moved within this file.
string(REGEX MATCH "\\[\n" ext_multiline "${ext_entry}")
if (ext_multiline)
# Extract everything up to but not including the newly-inserted API Reference.
string(REGEX REPLACE
"(\n[^\n]+\"Extension API\",.+)(\n\\[ \"API Reference\")"
"\\2" string "${string}")
# Remember the full Extension API match.
set(ext_entry ${CMAKE_MATCH_1})
if (NOT ext_entry)
message(FATAL_ERROR "Cannot move menu entry for \"Extension API\"")
endif ()
# Now insert the Extension API menu right above Disassembly Library.
if (NOT string MATCHES "Disassembly Library")
message(FATAL_ERROR "Cannot find menu entry for page \"Disassembly Library\"")
endif ()
string(REGEX REPLACE "(\n[^\n]+\"Disassembly Library)" "${ext_entry}\\1"
string "${string}")
# Set the user_docs flag since we found its contents here.
set(found_user_docs ON)
else ()
# Remove the 1-line Extension API string from this file.
string(REPLACE "${ext_entry}" "\n" string "${string}")
endif ()
else ()
# Remove name so we can inline.
string(REGEX REPLACE "var [^\n]* =\n" "" string "${string}")
Expand Down Expand Up @@ -319,6 +348,9 @@ if (embeddable)
if (js MATCHES "page_user_docs.js")
# CMake 3.6+ guarantees the glob is sorted lexicographically, so we've already
# seen navtreedata.js.
if (found_user_docs)
message(FATAL_ERROR "Found unexpected \"page_user_docs\" menu file")
endif ()
set(found_user_docs ON)
if (ext_entry)
if (NOT string MATCHES "Disassembly Library")
Expand Down
19 changes: 17 additions & 2 deletions api/docs/bt.dox
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* **********************************************************
* Copyright (c) 2011-2023 Google, Inc. All rights reserved.
* Copyright (c) 2011-2024 Google, Inc. All rights reserved.
* Copyright (c) 2007-2009 VMware, Inc. All rights reserved.
* **********************************************************/

Expand Down Expand Up @@ -64,7 +64,8 @@ following sections:
\section sec_IR Instruction Representation

The primary data structures involved in instruction manipulation are
the #instr_t, which represents a single instruction, and the \c
the #opnd_t, which represents one operand; the #instr_t, which
represents a single instruction; and the \c
#instrlist_t, which is a linked list of instructions. The header files
dr_ir_instrlist.h and dr_ir_instr.h list a number of functions that
operate on these data structures, including:
Expand All @@ -89,6 +90,20 @@ a primary contributor to DynamoRIO's efficiency.
The instruction representation includes all of the operands, whether
implicit or explicit, and the condition code effects of each instruction.
This allows for analysis of liveness of registers and condition codes.
The operands are split into sources and destinations.

A memory reference is treated as one operand even when it uses
registers to compute its address: those constituent registers are not
listed as their own separate source operands (unless they are read for
other reasons such as updating the index register). This means that a
store to memory will have that store as a destination operand without
listing the store's addressing mode registers as source operands in
their own right. Tools interested in all registers inside such
operands can use opnd_get_num_regs_used() and opnd_get_reg_used() to
generically walk the registers inside an operand, or
instr_reads_from_reg() to determine whether an instruction reads a
register either as a source operand or as a component of a destination
memory reference.

DynamoRIO's IR is mostly opaque to clients. Key data structures have their
sizes exposed to allow for stack allocation, but their fields are opaque. In
Expand Down
2 changes: 1 addition & 1 deletion api/docs/test_suite.dox
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ failure email step". Be sure to match the surrounding indentation as
indentation matters for .yml files.

- name: Setup tmate session
if: ${{ failure() }}
if: failure()
uses: mxschmitt/action-tmate@v3

Next, delete all the other workflow files in the ".github/workflows/" directory.
Expand Down
22 changes: 21 additions & 1 deletion clients/drcachesim/reader/record_file_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ class record_reader_t : public std::iterator<std::input_iterator_tag, trace_entr
return cur_entry_;
}

static bool
record_is_pre_instr(trace_entry_t *record)
{
return record->type == TRACE_TYPE_ENCODING ||
// The branch target marker sits between any encodings and the instr.
(record->type == TRACE_TYPE_MARKER &&
record->size == TRACE_MARKER_TYPE_BRANCH_TARGET);
}

record_reader_t &
operator++()
{
Expand All @@ -149,7 +158,13 @@ class record_reader_t : public std::iterator<std::input_iterator_tag, trace_entr
UNUSED(res);
if (!eof_) {
++cur_ref_count_;
if (type_is_instr(static_cast<trace_type_t>(cur_entry_.type)))
// We increment the instr count at the encoding as that avoids multiple
// problems with separating encodings from instrs when skipping (including
// for scheduler regions of interest) and when replaying schedules: anything
// using instr ordinals as boundaries.
if (!prev_record_was_pre_instr_ &&
(record_is_pre_instr(&cur_entry_) ||
type_is_instr(static_cast<trace_type_t>(cur_entry_.type))))
++cur_instr_count_;
else if (cur_entry_.type == TRACE_TYPE_MARKER) {
switch (cur_entry_.size) {
Expand Down Expand Up @@ -177,6 +192,7 @@ class record_reader_t : public std::iterator<std::input_iterator_tag, trace_entr
break;
}
}
prev_record_was_pre_instr_ = record_is_pre_instr(&cur_entry_);
}
return *this;
}
Expand Down Expand Up @@ -273,6 +289,10 @@ class record_reader_t : public std::iterator<std::input_iterator_tag, trace_entr
uint64_t cur_instr_count_ = 0;
uint64_t last_timestamp_ = 0;
uint64_t first_timestamp_ = 0;
// Whether the prior record was a record that immediately precedes
// an instruction or another record of this type: an encoding or
// TRACE_MARKER_TYPE_BRANCH_TARGET.
bool prev_record_was_pre_instr_ = false;

// Remember top-level headers for the memtrace_stream_t interface.
uint64_t version_ = 0;
Expand Down
Loading

0 comments on commit e31a043

Please sign in to comment.