Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
os.cc
Go to the documentation of this file.
1// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "vm/os.h"
6
7#include "platform/assert.h"
8#include "vm/image_snapshot.h"
9#include "vm/native_symbol.h"
10
11namespace dart {
12
13const uint8_t* OS::GetAppDSOBase(const uint8_t* snapshot_instructions) {
14 // Use the relocated address in the Image if the snapshot was compiled
15 // directly to ELF.
16 const Image instructions_image(snapshot_instructions);
17 if (instructions_image.compiled_to_elf()) {
18 return snapshot_instructions -
19 instructions_image.instructions_relocated_address();
20 }
21 uword dso_base;
23 reinterpret_cast<uword>(snapshot_instructions), &dso_base)) {
24 return reinterpret_cast<const uint8_t*>(dso_base);
25 }
27 return nullptr;
28}
29
30} // namespace dart
bool compiled_to_elf() const
uword instructions_relocated_address() const
static bool LookupSharedObject(uword pc, uword *dso_base=nullptr, char **dso_name=nullptr)
static const uint8_t * GetAppDSOBase(const uint8_t *snapshot_instructions)
Definition os.cc:13
#define UNIMPLEMENTED
uintptr_t uword
Definition globals.h:501