Skip to content

Commit eb394e5

Browse files
authored
Merge pull request #46 from bdutro-mips/dev/bdutro/filtered-event-target-fix
Skip setting event target PC if the event was a filtered mode change Enhance check-in regression with additional build types
2 parents 46d88cb + 233181b commit eb394e5

File tree

7 files changed

+60
-10
lines changed

7 files changed

+60
-10
lines changed

.github/workflows/ubuntu-build.yml

+43-8
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,67 @@ on:
33
branches:
44
- master
55

6-
env:
7-
BUILD_TYPE: Release
8-
96
jobs:
107
build:
8+
strategy:
9+
matrix:
10+
compiler: [gcc, clang]
11+
build_type: [Debug, Release]
12+
lto_config:
13+
- lto: false
14+
full_lto: false
15+
- lto: true
16+
full_lto: false
17+
- lto: true
18+
full_lto: true
19+
exclude:
20+
# Don't try to build Debug with LTO enabled
21+
- build_type: Debug
22+
lto_config:
23+
lto: true
24+
# GCC doesn't have a thin LTO mode
25+
- compiler: gcc
26+
build_type: Release
27+
lto_config:
28+
lto: true
29+
full_lto: false
30+
31+
env:
32+
CC: ${{ matrix.compiler }}
33+
CXX: ${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
34+
LTO_CONFIG: ${{ matrix.build_type == 'Release' && format('-DNO_STF_LTO={0}', !matrix.lto_config.lto) || '' }}
35+
CLANG_FULL_LTO_CONFIG: ${{ (matrix.compiler == 'clang' && matrix.build_type == 'Release') && format('-DFULL_LTO={0}', matrix.lto_config.full_lto) || '' }}
36+
1137
runs-on: ubuntu-latest
1238

1339
steps:
14-
- uses: actions/checkout@v2
40+
- name: Get number of CPU cores
41+
uses: SimenB/github-actions-cpu-cores@v2
42+
id: cpu-cores
43+
44+
- uses: actions/checkout@v4
1545

1646
- name: Install Dependencies
1747
run: |
1848
sudo apt-get update
19-
sudo apt-get -y install libboost-dev
49+
sudo apt-get -y install libboost-dev cython3
50+
51+
- name: Install Clang
52+
run: |
53+
sudo apt-get -y install clang lld llvm
54+
if: ${{ matrix.compiler == 'clang' }}
2055

2156
- name: Create Build Directory
2257
run: cmake -E make_directory ${{runner.workspace}}/build
2358

2459
- name: Configure CMAKE
2560
working-directory: ${{runner.workspace}}/build
26-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
61+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_STF_PYTHON_LIB=ON $LTO_CONFIG $CLANG_FULL_LTO_CONFIG
2762

2863
- name: Build
2964
working-directory: ${{runner.workspace}}/build
30-
run: cmake --build . --config $BUILD_TYPE
65+
run: cmake --build . --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }}
3166

3267
- name: Regress
3368
working-directory: ${{runner.workspace}}/build
34-
run: cmake --build . --config $BUILD_TYPE --target regress
69+
run: cmake --build . --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }} --target regress

cmake/stf_linker_setup.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ function(setup_stf_linker set_compiler_options)
142142
set(CMAKE_AR "gcc-ar" PARENT_SCOPE)
143143
endif()
144144

145+
set(STF_LINK_FLAGS "${STF_LINK_FLAGS}" PARENT_SCOPE)
145146
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>" PARENT_SCOPE)
146147
set(CMAKE_CXX_ARCHIVE_FINISH true PARENT_SCOPE)
147148
endfunction()

stf-inc/stf_exception.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ namespace stf
115115
reason_(std::move(reason))
116116
{ }
117117

118+
STFException(const STFException&) = default;
119+
STFException(STFException&&) = default;
120+
118121
/// Destroy!
119122
inline ~STFException() noexcept override = default;
120123

stf-inc/stf_inst_reader.hpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ namespace stf {
100100
#endif
101101

102102
bool event_valid = false;
103+
bool filtered_mode_change = false;
103104

104105
updateSkipping_();
105106

@@ -210,6 +211,7 @@ namespace stf {
210211
if(STF_EXPECT_FALSE((onlyUserMode_() || filter_mode_change_events_) &&
211212
is_mode_change)) {
212213
// Filter out mode change events when mode skipping or if it is explicitly required
214+
filtered_mode_change = true;
213215
break;
214216
}
215217

@@ -219,7 +221,10 @@ namespace stf {
219221

220222
case IntDescriptor::STF_EVENT_PC_TARGET:
221223
stf_assert(event_valid, "Saw EventPCTargetRecord without accompanying EventRecord");
222-
delegates::STFInstDelegate::setLastEventTarget_(inst, rec);
224+
if(!filtered_mode_change)
225+
{
226+
delegates::STFInstDelegate::setLastEventTarget_(inst, rec);
227+
}
223228
event_valid = false;
224229
break;
225230

stf-inc/stf_object.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ namespace stf {
207207
* \note Name chosen to avoid collision in Spike codebase
208208
*/
209209
virtual void pack(STFOFstream& writer) const = 0;
210+
STFBaseObject() = default;
211+
STFBaseObject(const STFBaseObject&) = default;
212+
STFBaseObject(STFBaseObject&&) = default;
210213
virtual inline ~STFBaseObject() = default;
211214
};
212215

stfpy/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ get_directory_property(include_dirs INCLUDE_DIRECTORIES)
2020
get_directory_property(compile_opts COMPILE_OPTIONS)
2121
get_directory_property(link_opts LINK_OPTIONS)
2222

23+
string(JOIN " " stfpy_link_opts $ENV{LDFLAGS} ${link_opts})
24+
2325
set(extra_lib_dirs $<TARGET_FILE_DIR:stf>)
2426
string(REPLACE ";" ":" include_dirs "${include_dirs}")
2527
string(REPLACE ";" ":" extra_lib_dirs "${extra_lib_dirs}")
@@ -50,7 +52,7 @@ add_custom_command(
5052
CXX="${CMAKE_CXX_COMPILER}"
5153
LD="${CMAKE_CXX_COMPILER}"
5254
CPPFLAGS="${compile_opts}"
53-
LDFLAGS="${link_opts}"
55+
LDFLAGS=${stfpy_link_opts}
5456
STFPY_BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}"
5557
${Python3_EXECUTABLE} setup.py build_ext -f
5658
${CYTHON_PARALLEL_FLAG}

tests/stf_writer_test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ add_compile_options(
3333
-Woverloaded-virtual
3434
-Wno-unused-parameter
3535
-Wno-missing-field-initializers
36+
-Wno-unused-command-line-argument
3637
)
3738

3839
add_compile_options($<$<CONFIG:Release>:-Ofast>)

0 commit comments

Comments
 (0)