Skip to content

Commit 03bc7fd

Browse files
committed
Update third party
1 parent fd23fc1 commit 03bc7fd

16 files changed

Lines changed: 75 additions & 210 deletions

File tree

third_party/abseil-cpp/absl/debugging/internal/symbolize.h

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -78,46 +78,6 @@ namespace absl {
7878
ABSL_NAMESPACE_BEGIN
7979
namespace debugging_internal {
8080

81-
// Legacy stateless symbol decorator API. Will be removed soon.
82-
struct SymbolDecoratorArgs {
83-
// The program counter we are getting symbolic name for.
84-
const void *pc;
85-
// 0 for main executable, load address for shared libraries.
86-
ptrdiff_t relocation;
87-
// Read-only file descriptor for ELF image covering "pc",
88-
// or -1 if no such ELF image exists in /proc/self/maps.
89-
int fd;
90-
// Output buffer, size.
91-
// Note: the buffer may not be empty -- default symbolizer may have already
92-
// produced some output, and earlier decorators may have adorned it in
93-
// some way. You are free to replace or augment the contents (within the
94-
// symbol_buf_size limit).
95-
char *const symbol_buf;
96-
size_t symbol_buf_size;
97-
// Temporary scratch space, size.
98-
// Use that space in preference to allocating your own stack buffer to
99-
// conserve stack.
100-
char *const tmp_buf;
101-
size_t tmp_buf_size;
102-
// User-provided argument
103-
void* arg;
104-
};
105-
using LegacySymbolDecorator = void (*)(const SymbolDecoratorArgs *);
106-
107-
// Installs a function-pointer as a decorator. Returns a value less than zero
108-
// if the system cannot install the decorator. Otherwise, returns a unique
109-
// identifier corresponding to the decorator. This identifier can be used to
110-
// uninstall the decorator - See RemoveSymbolDecorator() below.
111-
int InstallSymbolDecorator(LegacySymbolDecorator decorator, void* arg);
112-
113-
// Removes a previously installed function-pointer decorator. Parameter "ticket"
114-
// is the return-value from calling InstallSymbolDecorator().
115-
bool RemoveSymbolDecorator(int ticket);
116-
117-
// Remove all installed decorators. Returns true if successful, false if
118-
// symbolization is currently in progress.
119-
bool RemoveAllSymbolDecorators();
120-
12181
class SymbolDecorator;
12282

12383
class SymbolDecoratorDeleter {

third_party/abseil-cpp/absl/debugging/symbolize_elf.inc

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,6 @@ inline constexpr bool kPlatformUsesOPDSections = false;
146146
// pointers and the first one is the function's entry.
147147
const size_t kFunctionDescriptorSize = sizeof(void *) * 2;
148148

149-
const int kMaxDecorators = 10; // Seems like a reasonable upper limit.
150-
151-
struct InstalledSymbolDecorator {
152-
LegacySymbolDecorator fn;
153-
void *arg;
154-
int ticket;
155-
};
156-
157-
int g_num_decorators;
158-
InstalledSymbolDecorator g_decorators[kMaxDecorators];
159-
160149
std::atomic<SymbolDecorator::Factory*> g_decorator_factory = nullptr;
161150

162151
struct FileMappingHint {
@@ -166,16 +155,6 @@ struct FileMappingHint {
166155
const char *filename;
167156
};
168157

169-
// Protects g_decorators.
170-
// We are using SpinLock and not a Mutex here, because we may be called
171-
// from inside Mutex::Lock itself, and it prohibits recursive calls.
172-
// This happens in e.g. base/stacktrace_syscall_unittest.
173-
// Moreover, we are using only try_lock(), if the decorator list
174-
// is being modified (is busy), we skip all decorators, and possibly
175-
// loose some info. Sorry, that's the best we could do.
176-
ABSL_CONST_INIT absl::base_internal::SpinLock g_decorators_mu(
177-
absl::base_internal::SCHEDULE_KERNEL_ONLY);
178-
179158
const int kMaxFileMappingHints = 8;
180159
int g_num_file_mapping_hints;
181160
FileMappingHint g_file_mapping_hints[kMaxFileMappingHints];
@@ -1507,7 +1486,6 @@ static bool MaybeInitializeObjFile(
15071486
const char *Symbolizer::GetUncachedSymbol(const void *pc) {
15081487
ObjFile *const obj = FindObjFile(pc, 1);
15091488
ptrdiff_t relocation = 0;
1510-
int fd = -1;
15111489
if (obj != nullptr) {
15121490
if (MaybeInitializeObjFile(obj, decorator_factory_)) {
15131491
const size_t start_addr = reinterpret_cast<size_t>(obj->start_addr);
@@ -1549,7 +1527,6 @@ const char *Symbolizer::GetUncachedSymbol(const void *pc) {
15491527
}
15501528
}
15511529

1552-
fd = obj->fd;
15531530
if (GetSymbolFromObjectFile(*obj, pc, relocation, symbol_buf_,
15541531
sizeof(symbol_buf_), tmp_buf_,
15551532
sizeof(tmp_buf_)) == SYMBOL_FOUND) {
@@ -1574,18 +1551,6 @@ const char *Symbolizer::GetUncachedSymbol(const void *pc) {
15741551
#endif
15751552
}
15761553

1577-
if (g_decorators_mu.try_lock()) {
1578-
if (g_num_decorators > 0) {
1579-
SymbolDecoratorArgs decorator_args = {
1580-
pc, relocation, fd, symbol_buf_, sizeof(symbol_buf_),
1581-
tmp_buf_, sizeof(tmp_buf_), nullptr};
1582-
for (int i = 0; i < g_num_decorators; ++i) {
1583-
decorator_args.arg = g_decorators[i].arg;
1584-
g_decorators[i].fn(&decorator_args);
1585-
}
1586-
}
1587-
g_decorators_mu.unlock();
1588-
}
15891554
if (obj != nullptr && obj->decorator != nullptr) {
15901555
obj->decorator->Decorate(pc, relocation, symbol_buf_, sizeof(symbol_buf_),
15911556
tmp_buf_, sizeof(tmp_buf_));
@@ -1633,55 +1598,6 @@ const char *Symbolizer::GetSymbol(const void *pc) {
16331598
#endif
16341599
}
16351600

1636-
bool RemoveAllSymbolDecorators() {
1637-
SetSymbolDecoratorFactory(nullptr);
1638-
1639-
if (!g_decorators_mu.try_lock()) {
1640-
// Someone else is using decorators. Get out.
1641-
return false;
1642-
}
1643-
g_num_decorators = 0;
1644-
g_decorators_mu.unlock();
1645-
return true;
1646-
}
1647-
1648-
bool RemoveSymbolDecorator(int ticket) {
1649-
if (!g_decorators_mu.try_lock()) {
1650-
// Someone else is using decorators. Get out.
1651-
return false;
1652-
}
1653-
for (int i = 0; i < g_num_decorators; ++i) {
1654-
if (g_decorators[i].ticket == ticket) {
1655-
while (i < g_num_decorators - 1) {
1656-
g_decorators[i] = g_decorators[i + 1];
1657-
++i;
1658-
}
1659-
g_num_decorators = i;
1660-
break;
1661-
}
1662-
}
1663-
g_decorators_mu.unlock();
1664-
return true; // Decorator is known to be removed.
1665-
}
1666-
1667-
int InstallSymbolDecorator(LegacySymbolDecorator decorator, void *arg) {
1668-
static int ticket = 0;
1669-
1670-
if (!g_decorators_mu.try_lock()) {
1671-
// Someone else is using decorators. Get out.
1672-
return -2;
1673-
}
1674-
int ret = ticket;
1675-
if (g_num_decorators >= kMaxDecorators) {
1676-
ret = -1;
1677-
} else {
1678-
g_decorators[g_num_decorators] = {decorator, arg, ticket++};
1679-
++g_num_decorators;
1680-
}
1681-
g_decorators_mu.unlock();
1682-
return ret;
1683-
}
1684-
16851601
SymbolDecorator::Factory* SetSymbolDecoratorFactory(
16861602
SymbolDecorator::Factory* factory) {
16871603
return g_decorator_factory.exchange(factory, std::memory_order_acq_rel);

third_party/abseil-cpp/absl/debugging/symbolize_test.cc

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -375,48 +375,6 @@ TEST(Symbolize, SymbolizeWithMultipleMaps) {
375375
}
376376
}
377377

378-
// Appends string(*args->arg) to args->symbol_buf.
379-
static void DummySymbolDecorator(
380-
const absl::debugging_internal::SymbolDecoratorArgs *args) {
381-
std::string *message = static_cast<std::string *>(args->arg);
382-
strncat(args->symbol_buf, message->c_str(),
383-
args->symbol_buf_size - strlen(args->symbol_buf) - 1);
384-
}
385-
386-
TEST(Symbolize, InstallAndRemoveSymbolDecorators) {
387-
int ticket_a;
388-
std::string a_message("a");
389-
EXPECT_GE(ticket_a = absl::debugging_internal::InstallSymbolDecorator(
390-
DummySymbolDecorator, &a_message),
391-
0);
392-
393-
int ticket_b;
394-
std::string b_message("b");
395-
EXPECT_GE(ticket_b = absl::debugging_internal::InstallSymbolDecorator(
396-
DummySymbolDecorator, &b_message),
397-
0);
398-
399-
int ticket_c;
400-
std::string c_message("c");
401-
EXPECT_GE(ticket_c = absl::debugging_internal::InstallSymbolDecorator(
402-
DummySymbolDecorator, &c_message),
403-
0);
404-
405-
// Use addresses 4 and 8 here to ensure that we always use valid addresses
406-
// even on systems that require instructions to be 32-bit aligned.
407-
char *address = reinterpret_cast<char *>(4);
408-
EXPECT_STREQ("abc", TrySymbolize(address));
409-
410-
EXPECT_TRUE(absl::debugging_internal::RemoveSymbolDecorator(ticket_b));
411-
412-
EXPECT_STREQ("ac", TrySymbolize(address + 4));
413-
414-
// Cleanup: remove all remaining decorators so other stack traces don't
415-
// get mystery "ac" decoration.
416-
EXPECT_TRUE(absl::debugging_internal::RemoveSymbolDecorator(ticket_a));
417-
EXPECT_TRUE(absl::debugging_internal::RemoveSymbolDecorator(ticket_c));
418-
}
419-
420378
template <char C>
421379
class TestSymbolDecorator final
422380
: public absl::debugging_internal::SymbolDecorator {

third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ ABSL_NAMESPACE_BEGIN
2121

2222
namespace debugging_internal {
2323

24-
int InstallSymbolDecorator(LegacySymbolDecorator, void*) { return -1; }
25-
bool RemoveSymbolDecorator(int) { return false; }
26-
bool RemoveAllSymbolDecorators(void) { return false; }
27-
2824
SymbolDecorator::Factory* SetSymbolDecoratorFactory(SymbolDecorator::Factory*) {
2925
return nullptr;
3026
}

third_party/abseil-cpp/absl/strings/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ cc_test(
11141114
"//absl/container:btree",
11151115
"//absl/container:flat_hash_map",
11161116
"//absl/container:node_hash_map",
1117+
"//absl/hash",
11171118
"@googletest//:gtest",
11181119
"@googletest//:gtest_main",
11191120
],

third_party/abseil-cpp/absl/strings/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ absl_cc_test(
397397
absl::dynamic_annotations
398398
absl::btree
399399
absl::flat_hash_map
400+
absl::hash
400401
absl::node_hash_map
401402
GTest::gmock_main
402403
)

third_party/abseil-cpp/absl/strings/str_split_test.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "absl/container/btree_set.h"
3737
#include "absl/container/flat_hash_map.h"
3838
#include "absl/container/node_hash_map.h"
39+
#include "absl/hash/hash.h"
3940
#include "absl/strings/string_view.h"
4041

4142
namespace {
@@ -422,6 +423,9 @@ TEST(Splitter, ConversionOperator) {
422423
TestConversionOperator<absl::btree_multiset<absl::string_view>>(splitter);
423424
TestConversionOperator<absl::btree_multiset<std::string>>(splitter);
424425
TestConversionOperator<std::unordered_set<std::string>>(splitter);
426+
TestConversionOperator<
427+
std::unordered_set<absl::string_view, absl::Hash<absl::string_view>>>(
428+
splitter);
425429

426430
// Tests conversion to map-like objects.
427431

@@ -455,6 +459,15 @@ TEST(Splitter, ConversionOperator) {
455459
splitter);
456460
TestMapConversionOperator<std::unordered_map<std::string, std::string>>(
457461
splitter);
462+
TestMapConversionOperator<std::unordered_map<
463+
absl::string_view, absl::string_view, absl::Hash<absl::string_view>>>(
464+
splitter);
465+
TestMapConversionOperator<std::unordered_map<absl::string_view, std::string,
466+
absl::Hash<absl::string_view>>>(
467+
splitter);
468+
TestMapConversionOperator<std::unordered_map<std::string, absl::string_view,
469+
absl::Hash<absl::string_view>>>(
470+
splitter);
458471
TestMapConversionOperator<
459472
absl::node_hash_map<absl::string_view, absl::string_view>>(splitter);
460473
TestMapConversionOperator<

third_party/fmt/src/os.cc

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161

6262
namespace {
6363
#ifdef _WIN32
64+
6465
// Return type of read and write functions.
6566
using rwresult = int;
6667

@@ -69,20 +70,6 @@ using rwresult = int;
6970
inline unsigned convert_rwcount(size_t count) {
7071
return count <= UINT_MAX ? static_cast<unsigned>(count) : UINT_MAX;
7172
}
72-
#elif FMT_USE_FCNTL
73-
// Return type of read and write functions.
74-
using rwresult = ssize_t;
75-
76-
inline auto convert_rwcount(size_t count) -> size_t { return count; }
77-
#endif
78-
} // namespace
79-
80-
FMT_BEGIN_NAMESPACE
81-
82-
#ifdef _WIN32
83-
namespace detail {
84-
85-
namespace {
8673

8774
class system_message {
8875
system_message(const system_message&) = delete;
@@ -111,8 +98,8 @@ class system_message {
11198
}
11299
~system_message() { LocalFree(message_); }
113100
explicit operator bool() const noexcept { return result_ != 0; }
114-
operator basic_string_view<wchar_t>() const noexcept {
115-
return basic_string_view<wchar_t>(message_, result_);
101+
operator fmt::basic_string_view<wchar_t>() const noexcept {
102+
return fmt::basic_string_view<wchar_t>(message_, result_);
116103
}
117104
};
118105

@@ -122,7 +109,7 @@ class utf8_system_category final : public std::error_category {
122109
std::string message(int error_code) const override {
123110
auto&& msg = system_message(error_code);
124111
if (msg) {
125-
auto utf8_message = to_utf8<wchar_t>();
112+
auto utf8_message = fmt::detail::to_utf8<wchar_t>();
126113
if (utf8_message.convert(msg)) {
127114
return utf8_message.str();
128115
}
@@ -131,12 +118,22 @@ class utf8_system_category final : public std::error_category {
131118
}
132119
};
133120

121+
#elif FMT_USE_FCNTL
122+
123+
// Return type of read and write functions.
124+
using rwresult = ssize_t;
125+
126+
inline auto convert_rwcount(size_t count) -> size_t { return count; }
127+
128+
#endif
134129
} // namespace
135130

136-
} // namespace detail
131+
FMT_BEGIN_NAMESPACE
132+
133+
#ifdef _WIN32
137134

138135
FMT_API const std::error_category& system_category() noexcept {
139-
static const detail::utf8_system_category category;
136+
static const utf8_system_category category;
140137
return category;
141138
}
142139

@@ -166,6 +163,7 @@ void detail::format_windows_error(detail::buffer<char>& out, int error_code,
166163
void report_windows_error(int error_code, const char* message) noexcept {
167164
do_report_error(detail::format_windows_error, error_code, message);
168165
}
166+
169167
#endif // _WIN32
170168

171169
buffered_file::~buffered_file() noexcept {

0 commit comments

Comments
 (0)