dart-sdk/runtime/bin/exe_utils.h
Ryan Macnak b8ee3a9996 [build] Don't export all symbols to the dynamic table.
We were exporting all symbols to the dynamic table so that they could be looked up using `dladdr` for the profiler and backtracer. The symbols include our statically-linked libcxx, which can create trouble when another DSO has a different version of libcxx. Now we export only the VM embedding API functions (`Dart_*`) and use a specially produced table to do the symbolization.

TEST=runtime/tests/vm/dart/exported_symbols_test.dart
TEST=runtime/tests/vm/dart/symbolized_crash_test.dart
Bug: https://github.com/dart-lang/sdk/issues/53267
Change-Id: I2ee494fba86f67127ba0f6f402622f01a4662207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323702
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-09-05 21:47:59 +00:00

37 lines
1,000 B
C++

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_BIN_EXE_UTILS_H_
#define RUNTIME_BIN_EXE_UTILS_H_
#include <stdlib.h>
#include <string.h>
#include "include/dart_api.h"
#include "platform/globals.h"
#include "platform/utils.h"
namespace dart {
namespace bin {
class EXEUtils {
public:
// Returns the path to the directory the current executable resides in.
static Utils::CStringUniquePtr GetDirectoryPrefixFromExeName();
#if !defined(DART_HOST_OS_WINDOWS)
// Loads a compact symbolization table from "$exepath.sym" that is used by the
// VM's profiler and crash stack trace dumper to symbolize C frames.
static void LoadDartProfilerSymbols(const char* exepath);
#endif
private:
DISALLOW_COPY_AND_ASSIGN(EXEUtils);
};
} // namespace bin
} // namespace dart
#endif // RUNTIME_BIN_EXE_UTILS_H_