Skip to content

Commit 47daa65

Browse files
authored
Fix two nasty bugs (#40)
1 parent 938d7ac commit 47daa65

File tree

22 files changed

+222
-88
lines changed

22 files changed

+222
-88
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ env:
1616
PUBLIC_SIMICS_PACKAGE_VERSION_1000: "6.0.169"
1717
MINGW_URL: "https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0-16.0.6-11.0.0-ucrt-r1/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-16.0.6-mingw-w64ucrt-11.0.0-r1.7z"
1818
MINGW_VERSION: "13.2.0-16.0.6-11.0.0-ucrt-r1"
19-
TSFFS_SIMICS_PKG_VERSION: "6.0.1"
2019

2120
jobs:
2221
build_test_artifacts:
@@ -166,7 +165,7 @@ jobs:
166165
bin/project-setup --force
167166
./build.rs
168167
ispm packages \
169-
-i linux64/packages/simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-linux64.ispm \
168+
-i linux64/packages/simics-pkg-31337-*-linux64.ispm \
170169
--non-interactive --trust-insecure-packages
171170
172171
- name: Build Project
@@ -271,13 +270,12 @@ jobs:
271270
ispm.exe projects $(pwd) --create --non-interactive --ignore-existing-files
272271
./bin/project-setup.bat --mingw-dir C:\MinGW\ --ignore-existing-files --force
273272
cargo -Zscript build.rs
274-
ispm.exe packages -i win64/packages/simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-win64.ispm --non-interactive --trust-insecure-packages
275273
276274
- name: Upload Distribution Package
277275
uses: actions/upload-artifact@v3
278276
with:
279-
name: simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-win64.ispm
280-
path: win64/packages/simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-win64.ispm
277+
name: simics-pkg-31337-win64
278+
path: win64/packages/simics-pkg-31337-*-win64.ispm
281279

282280
build_dist:
283281
name: Build for Distribution
@@ -307,14 +305,14 @@ jobs:
307305
run: |
308306
docker build -t tsffs-dist -f .github/builder/Dockerfile .
309307
docker create --name tsffs-dist tsffs-dist bash
310-
docker cp tsffs-dist:/tsffs/linux64/packages/simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-linux64.ispm simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-linux64.ispm
308+
docker cp tsffs-dist:/tsffs/linux64/packages/ packages/
311309
docker rm -f tsffs-dist
312310
313311
- name: Upload Distribution Package
314312
uses: actions/upload-artifact@v3
315313
with:
316-
name: simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-linux64.ispm
317-
path: simics-pkg-31337-${{ env.TSFFS_SIMICS_PKG_VERSION }}-linux64.ispm
314+
name: simics-pkg-31337-linux64
315+
path: packages/simics-pkg-31337-*-linux64.ispm
318316

319317
fuzz_tests:
320318
name: Run Fuzz Tests

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Then you just add a line to every git commit message:
5757
Signed-off-by: Joe Smith <[email protected]>
5858
```
5959

60-
Use your real name (sorry, no pseudonyms or anonymous contributions.)
60+
Use a known identity (sorry, no anonymous contributions.)
6161

6262
If you set your `user.name` and `user.email` git configs, you can sign your
6363
commit automatically with `git commit -s`.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ license = "Apache-2.0"
1616
publish = false
1717
readme = "README.md"
1818
repository = "https://github.com/intel/tsffs"
19-
version = "0.2.0"
19+
version = "0.2.1"
2020

2121
[workspace.metadata]
22-
build-id = 2
23-
version = "6.0.1"
22+
build-id = 3
23+
version = "6.0.2"
2424

2525
[workspace]
2626
resolver = "2"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ RUN ispm projects /workspace/tsffs/ --create --ignore-existing-files --non-inter
9595
bin/project-setup --force && \
9696
./build.rs && \
9797
ispm packages \
98-
-i /workspace/tsffs/linux64/packages/simics-pkg-31337-6.0.1-linux64.ispm \
98+
-i /workspace/tsffs/linux64/packages/*-linux64.ispm \
9999
--non-interactive --trust-insecure-packages && \
100100
make clobber
101101

docs/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@
4949
- [Build Internals](developer/build.md)
5050
- [Refreshing Build Environment](developer/refresh.md)
5151
- [Building Against A Specific SIMICS Version](developer/specific-simics-version.md)
52-
52+
- [Debugging TSFFS](developer/debugging.md)

docs/src/config/installing-in-projects.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ relative (from the project's SIMICS base package root) paths to packages that sh
3131
be included in the project.
3232

3333
If all SIMICS packages are installed into an `install-dir` together, the TSFFS package
34-
can be added by adding a line like:
34+
can be added by adding a line like (if your installed package version is `6.0.1`):
3535

3636
```txt
3737
../simics-tsffs-6.0.1/
@@ -43,4 +43,10 @@ If your SIMICS packages are not all installed together, the path can be absolute
4343

4444
```txt
4545
/absolute/path/to/installed/simics-tsffs-6.0.1/
46+
```
47+
48+
You can obtain your latest installed version with:
49+
50+
```sh
51+
ispm packages --list-installed --json | jq -r '[ .installedPackages[] | select(.pkgNumber == 31337) ] | ([ .[].version ] | max_by(split(".") | map(tonumber))) as $m | first(first(.[]|select(.version == $m)).paths[0])'
4652
```

docs/src/developer/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
- [Build Internals](build.md)
44
- [Refreshing Build Environment](refresh.md)
5-
- [Building Against A Specific SIMICS Version](specific-simics-version.md)
5+
- [Building Against A Specific SIMICS Version](specific-simics-version.md)
6+
- [Debugging TSFFS](debugging.md)

docs/src/developer/debugging.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Debugging
2+
3+
Hopefully not very often, but once in a while you may need to debug the TSFFS module.
4+
5+
The easiest way to do this is by loading and using it in a script that does what you
6+
want. For example, early in development there was a bug when calling the interface
7+
API.
8+
9+
```txt
10+
@tsffs.iface.tsffs.set_corpus_directory("%simics%/corpus")
11+
```
12+
13+
So this script was used to help debug:
14+
15+
```txt
16+
load-module tsffs
17+
@tsffs = SIM_create_object(SIM_get_class("tsffs"), "tsffs", [])
18+
tsffs.log-level 4
19+
@import time
20+
@print("Sleeping")
21+
@time.sleep(30)
22+
@tsffs.iface.tsffs.set_corpus_directory("%simics%/corpus")
23+
```
24+
25+
ALl this script does is sleep for 30 seconds, then call the API we care about. The 30
26+
second sleep gives you enough time to run this script, find the PID of the simics
27+
process, and attach it with GDB. Once in GDB, just break all threads on the place you
28+
want to debug.
29+
30+
31+
```sh
32+
$ ./simics -no-gui --no-win ./test.simics
33+
$ ps aux | grep simics | grep -v grep | awk '{print $2}'
34+
134284
35+
$ gdb -q attach 134284
36+
gdb> thread apply all break set_corpus_directory
37+
gdb> continue
38+
...
39+
```
40+
41+
In general, most bugs will happen in FFI code, so breakpointing should be relatively
42+
straightforward. However, in complex cases demangling may be necessary. For this,
43+
a new version of GDB including rustfilt is suggested.

docs/src/setup/linux.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ steps for us:
159159
./build.rs
160160
```
161161

162-
This will produce a file `linux64/packages/simics-pkg-31337-6.0.1-linux64.ispm`. We can
162+
This will produce a file `linux64/packages/simics-pkg-31337-VERSION-linux64.ispm`. We can
163163
then install this package into our local SIMICS installation. This in turn allows us to
164164
add the TSFFS package to our SIMICS projects for use. Note the
165165
`--trust-insecure-packages` flag is required because this package is not built and
166166
signed by the SIMICS team, but by ourselves.
167167

168168
```sh
169-
ispm packages -i linux64/packages/simics-pkg-31337-6.0.1-linux64.ispm \
169+
ispm packages -i linux64/packages/*-linux64.ispm \
170170
--non-interactive --trust-insecure-packages
171171
```
172172

docs/src/setup/windows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ cargo -Zscript build.rs
130130
Once built, install TSFFS to your SIMICS installation with:
131131

132132
```powershell
133-
ispm.exe packages -i win64/packages/simics-pkg-31337-6.0.1-win64.ispm --non-interactive --trust-insecure-packages
133+
ispm.exe packages -i win64/packages/*-win64.ispm --non-interactive --trust-insecure-packages
134134
```
135135

136136
## Test TSFFS

0 commit comments

Comments
 (0)