Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions source/exe/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ envoy_cc_library(
envoy_cc_library(
name = "envoy_main_entry_lib",
srcs = ["main.cc"],
external_deps = [
"abseil_symbolize",
],
deps = [
":envoy_main_common_lib",
],
Expand Down
7 changes: 7 additions & 0 deletions source/exe/main.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "exe/main_common.h"

#include "absl/debugging/symbolize.h"

// NOLINT(namespace-envoy)

/**
Expand All @@ -10,6 +12,11 @@
* after setting up command line options.
*/
int main(int argc, char** argv) {
#ifndef __APPLE__
// absl::Symbolize mostly works without this, but this improves corner case
// handling, such as running in a chroot jail.
absl::InitializeSymbolizer(argv[0]);
#endif
std::unique_ptr<Envoy::MainCommon> main_common;

// Initialize the server's main context under a try/catch loop and simply return EXIT_FAILURE
Expand Down
3 changes: 3 additions & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ envoy_cc_test_library(
"main.cc",
"test_runner.h",
],
external_deps = [
"abseil_symbolize",
],
deps = [
"//source/common/common:logger_lib",
"//source/common/common:thread_lib",
Expand Down
5 changes: 5 additions & 0 deletions test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "test/test_common/environment.h"
#include "test/test_runner.h"

#include "absl/debugging/symbolize.h"

#ifdef ENVOY_HANDLE_SIGNALS
#include "exe/signal_action.h"
#endif
Expand All @@ -14,6 +16,9 @@ const char* __asan_default_options() {
// The main entry point (and the rest of this file) should have no logic in it,
// this allows overriding by site specific versions of main.cc.
int main(int argc, char** argv) {
#ifndef __APPLE__
absl::InitializeSymbolizer(argv[0]);
#endif
#ifdef ENVOY_HANDLE_SIGNALS
// Enabled by default. Control with "bazel --define=signal_trace=disabled"
Envoy::SignalAction handle_sigs;
Expand Down