Skip to content

Commit 5ec4599

Browse files
[Flatpak SDK] rr replay is broken
https://bugs.webkit.org/show_bug.cgi?id=230952 Patch by Philippe Normand <[email protected]> on 2021-09-29 Reviewed by Sergio Villar Senin. * patches/rr/0001-cmake-Look-for-resources-in-cmake-s-install-lib-dir.patch: As lib resources and bin resources don't necessarily share the same parent directory, one lookup function is needed for each use-case. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@283214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 0d1f076 commit 5ec4599

File tree

2 files changed

+51
-14
lines changed

2 files changed

+51
-14
lines changed

Tools/buildstream/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2021-09-29 Philippe Normand <[email protected]>
2+
3+
[Flatpak SDK] rr replay is broken
4+
https://bugs.webkit.org/show_bug.cgi?id=230952
5+
6+
Reviewed by Sergio Villar Senin.
7+
8+
* patches/rr/0001-cmake-Look-for-resources-in-cmake-s-install-lib-dir.patch: As lib
9+
resources and bin resources don't necessarily share the same parent directory, one lookup
10+
function is needed for each use-case.
11+
112
2021-09-29 Philippe Normand <[email protected]>
213

314
[Flatpak SDK] rr unable to locate librrpage.so

Tools/buildstream/patches/rr/0001-cmake-Look-for-resources-in-cmake-s-install-lib-dir.patch

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
From 26ba5099f19ba2e00f84aff797be7740fead4aee Mon Sep 17 00:00:00 2001
1+
From e9ceecb54cdfbf45b6eeb296fb078072e83327c2 Mon Sep 17 00:00:00 2001
22
From: Philippe Normand <[email protected]>
33
Date: Wed, 29 Sep 2021 10:22:00 +0100
44
Subject: [PATCH] cmake: Look for resources in cmake's install lib dir
55

66
---
77
CMakeLists.txt | 4 ++++
8-
src/config.h.in | 6 ++++++
9-
src/util.cc | 11 +++--------
10-
3 files changed, 13 insertions(+), 8 deletions(-)
8+
src/config.h.in | 7 +++++++
9+
src/util.cc | 30 ++++++++++--------------------
10+
3 files changed, 21 insertions(+), 20 deletions(-)
1111
create mode 100644 src/config.h.in
1212

1313
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -27,18 +27,19 @@ index e28d95aa..d38b3df2 100644
2727
set(supports32bit true)
2828
diff --git a/src/config.h.in b/src/config.h.in
2929
new file mode 100644
30-
index 00000000..059aeb43
30+
index 00000000..b1188ba7
3131
--- /dev/null
3232
+++ b/src/config.h.in
33-
@@ -0,0 +1,6 @@
33+
@@ -0,0 +1,7 @@
3434
+#ifndef RR_CONFIG_H_
3535
+#define RR_CONFIG_H_
3636
+
37-
+#define RESOURCES_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/"
37+
+#define RESOURCES_PATH "@CMAKE_INSTALL_PREFIX@/"
38+
+#define RESOURCES_LIB_PATH "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/"
3839
+
3940
+#endif
4041
diff --git a/src/util.cc b/src/util.cc
41-
index c57ae7b6..b2ac7bac 100644
42+
index c57ae7b6..debc3310 100644
4243
--- a/src/util.cc
4344
+++ b/src/util.cc
4445
@@ -45,6 +45,7 @@
@@ -49,22 +50,47 @@ index c57ae7b6..b2ac7bac 100644
4950

5051
void good_random(uint8_t* out, size_t out_len);
5152

52-
@@ -1261,8 +1262,7 @@ static string read_exe_dir() {
53-
string resource_path() {
53+
@@ -1245,26 +1246,20 @@ string real_path(const string& path) {
54+
return path;
55+
}
56+
57+
-static string read_exe_dir() {
58+
- KernelMapping km =
59+
- AddressSpace::read_local_kernel_mapping((uint8_t*)&read_exe_dir);
60+
- string exe_path = km.fsname();
61+
- int end = exe_path.length();
62+
- // Chop off the filename
63+
- while (end > 0 && exe_path[end - 1] != '/') {
64+
- --end;
65+
+string resource_path() {
66+
+ string resource_path = Flags::get().resource_path;
67+
+ if (resource_path.empty()) {
68+
+ return RESOURCES_PATH;
69+
}
70+
- exe_path.erase(end);
71+
- return exe_path;
72+
+ return resource_path;
73+
}
74+
75+
-string resource_path() {
76+
+string resource_lib_path() {
5477
string resource_path = Flags::get().resource_path;
5578
if (resource_path.empty()) {
5679
- static string exe_path = read_exe_dir() + "../";
5780
- return exe_path;
58-
+ return RESOURCES_LIB_DIR;
81+
+ return RESOURCES_LIB_PATH;
5982
}
60-
return resource_path;
83+
- return resource_path;
84+
+ return resource_path + "/lib/";
6185
}
62-
@@ -1294,16 +1294,11 @@ bool running_under_rr(bool cache) {
86+
87+
/**
88+
@@ -1294,16 +1289,11 @@ bool running_under_rr(bool cache) {
6389

6490
string find_helper_library(const char *basepath)
6591
{
6692
- string lib_path = resource_path() + "lib64/rr/";
67-
+ string lib_path = resource_path() + "rr/";
93+
+ string lib_path = resource_lib_path() + "rr/";
6894
string file_name = lib_path + basepath;
6995
if (access(file_name.c_str(), F_OK) == 0) {
7096
return lib_path;

0 commit comments

Comments
 (0)