gdb: protect debug::the_database from lto

Clang 18.1 with lto gained the ability to eliminate dead stores.
Since debug::the_database is write-only as far as the compiler understands
(it is read only by gdb), all writes to it are eliminated.

Protect writes to the variable by marking it volatile.

Closes scylladb/scylladb#22454
This commit is contained in:
Avi Kivity
2024-06-22 00:13:04 +03:00
parent eee3681d86
commit f4b1ad43d4
2 changed files with 2 additions and 2 deletions

View File

@@ -10,6 +10,6 @@
namespace debug {
seastar::sharded<replica::database>* the_database = nullptr;
seastar::sharded<replica::database>* volatile the_database = nullptr;
}

View File

@@ -16,7 +16,7 @@ class database;
namespace debug {
extern seastar::sharded<replica::database>* the_database;
extern seastar::sharded<replica::database>* volatile the_database;
}