mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:37:34 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -44,7 +44,7 @@ Emulator& Emulator::the()
|
|||
return *s_the;
|
||||
}
|
||||
|
||||
Emulator::Emulator(String const& executable_path, Vector<StringView> const& arguments, Vector<String> const& environment)
|
||||
Emulator::Emulator(DeprecatedString const& executable_path, Vector<StringView> const& arguments, Vector<DeprecatedString> const& environment)
|
||||
: m_executable_path(executable_path)
|
||||
, m_arguments(arguments)
|
||||
, m_environment(environment)
|
||||
|
@ -72,7 +72,7 @@ Emulator::Emulator(String const& executable_path, Vector<StringView> const& argu
|
|||
setup_signal_trampoline();
|
||||
}
|
||||
|
||||
Vector<ELF::AuxiliaryValue> Emulator::generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String const& executable_path, int executable_fd) const
|
||||
Vector<ELF::AuxiliaryValue> Emulator::generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, DeprecatedString const& executable_path, int executable_fd) const
|
||||
{
|
||||
// FIXME: This is not fully compatible with the auxiliary vector the kernel generates, this is just the bare
|
||||
// minimum to get the loader going.
|
||||
|
@ -229,7 +229,7 @@ int Emulator::exec()
|
|||
|
||||
size_t instructions_until_next_profile_dump = profile_instruction_interval();
|
||||
if (is_profiling() && m_loader_text_size.has_value())
|
||||
emit_profile_event(profile_stream(), "mmap"sv, String::formatted(R"("ptr": {}, "size": {}, "name": "/usr/lib/Loader.so")", *m_loader_text_base, *m_loader_text_size));
|
||||
emit_profile_event(profile_stream(), "mmap"sv, DeprecatedString::formatted(R"("ptr": {}, "size": {}, "name": "/usr/lib/Loader.so")", *m_loader_text_base, *m_loader_text_size));
|
||||
|
||||
while (!m_shutdown) {
|
||||
if (m_steps_til_pause) [[likely]] {
|
||||
|
@ -421,13 +421,13 @@ MmapRegion const* Emulator::load_library_from_address(FlatPtr address)
|
|||
if (!region)
|
||||
return {};
|
||||
|
||||
String lib_name = region->lib_name();
|
||||
DeprecatedString lib_name = region->lib_name();
|
||||
if (lib_name.is_null())
|
||||
return {};
|
||||
|
||||
String lib_path = lib_name;
|
||||
DeprecatedString lib_path = lib_name;
|
||||
if (Core::File::looks_like_shared_library(lib_name))
|
||||
lib_path = String::formatted("/usr/lib/{}", lib_path);
|
||||
lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_path);
|
||||
|
||||
if (!m_dynamic_library_cache.contains(lib_path)) {
|
||||
auto file_or_error = Core::MappedFile::map(lib_path);
|
||||
|
@ -465,7 +465,7 @@ Optional<Emulator::SymbolInfo> Emulator::symbol_at(FlatPtr address)
|
|||
VERIFY(first_region);
|
||||
auto lib_path = lib_name;
|
||||
if (Core::File::looks_like_shared_library(lib_name)) {
|
||||
lib_path = String::formatted("/usr/lib/{}", lib_name);
|
||||
lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_name);
|
||||
}
|
||||
|
||||
auto it = m_dynamic_library_cache.find(lib_path);
|
||||
|
@ -476,18 +476,18 @@ Optional<Emulator::SymbolInfo> Emulator::symbol_at(FlatPtr address)
|
|||
return { { lib_name, symbol, source_position } };
|
||||
}
|
||||
|
||||
String Emulator::create_backtrace_line(FlatPtr address)
|
||||
DeprecatedString Emulator::create_backtrace_line(FlatPtr address)
|
||||
{
|
||||
auto maybe_symbol = symbol_at(address);
|
||||
if (!maybe_symbol.has_value()) {
|
||||
return String::formatted("=={}== {:p}", getpid(), address);
|
||||
return DeprecatedString::formatted("=={}== {:p}", getpid(), address);
|
||||
}
|
||||
if (!maybe_symbol->source_position.has_value()) {
|
||||
return String::formatted("=={}== {:p} [{}]: {}", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol);
|
||||
return DeprecatedString::formatted("=={}== {:p} [{}]: {}", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol);
|
||||
}
|
||||
|
||||
auto const& source_position = maybe_symbol->source_position.value();
|
||||
return String::formatted("=={}== {:p} [{}]: {} (\e[34;1m{}\e[0m:{})", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol, LexicalPath::basename(source_position.file_path), source_position.line_number);
|
||||
return DeprecatedString::formatted("=={}== {:p} [{}]: {} (\e[34;1m{}\e[0m:{})", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol, LexicalPath::basename(source_position.file_path), source_position.line_number);
|
||||
}
|
||||
|
||||
void Emulator::dump_backtrace(Vector<FlatPtr> const& backtrace)
|
||||
|
@ -515,7 +515,7 @@ void Emulator::emit_profile_sample(AK::OutputStream& output)
|
|||
output.write_or_error(builder.string_view().bytes());
|
||||
}
|
||||
|
||||
void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_name, String const& contents)
|
||||
void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_name, DeprecatedString const& contents)
|
||||
{
|
||||
StringBuilder builder;
|
||||
timeval tv {};
|
||||
|
@ -525,13 +525,13 @@ void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_nam
|
|||
output.write_or_error(builder.string_view().bytes());
|
||||
}
|
||||
|
||||
String Emulator::create_instruction_line(FlatPtr address, X86::Instruction const& insn)
|
||||
DeprecatedString Emulator::create_instruction_line(FlatPtr address, X86::Instruction const& insn)
|
||||
{
|
||||
auto symbol = symbol_at(address);
|
||||
if (!symbol.has_value() || !symbol->source_position.has_value())
|
||||
return String::formatted("{:p}: {}", address, insn.to_string(address));
|
||||
return DeprecatedString::formatted("{:p}: {}", address, insn.to_string(address));
|
||||
|
||||
return String::formatted("{:p}: {} \e[34;1m{}\e[0m:{}", address, insn.to_string(address), LexicalPath::basename(symbol->source_position->file_path), symbol->source_position.value().line_number);
|
||||
return DeprecatedString::formatted("{:p}: {} \e[34;1m{}\e[0m:{}", address, insn.to_string(address), LexicalPath::basename(symbol->source_position->file_path), symbol->source_position.value().line_number);
|
||||
}
|
||||
|
||||
static void emulator_signal_handler(int signum, siginfo_t* signal_info, void* context)
|
||||
|
|
|
@ -31,9 +31,9 @@ class Emulator {
|
|||
public:
|
||||
static Emulator& the();
|
||||
|
||||
Emulator(String const& executable_path, Vector<StringView> const& arguments, Vector<String> const& environment);
|
||||
Emulator(DeprecatedString const& executable_path, Vector<StringView> const& arguments, Vector<DeprecatedString> const& environment);
|
||||
|
||||
void set_profiling_details(bool should_dump_profile, size_t instruction_interval, OutputFileStream* profile_stream, NonnullOwnPtrVector<String>* profiler_strings, Vector<int>* profiler_string_id_map)
|
||||
void set_profiling_details(bool should_dump_profile, size_t instruction_interval, OutputFileStream* profile_stream, NonnullOwnPtrVector<DeprecatedString>* profiler_strings, Vector<int>* profiler_string_id_map)
|
||||
{
|
||||
m_is_profiling = should_dump_profile;
|
||||
m_profile_instruction_interval = instruction_interval;
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
}
|
||||
|
||||
OutputFileStream& profile_stream() { return *m_profile_stream; }
|
||||
NonnullOwnPtrVector<String>& profiler_strings() { return *m_profiler_strings; }
|
||||
NonnullOwnPtrVector<DeprecatedString>& profiler_strings() { return *m_profiler_strings; }
|
||||
Vector<int>& profiler_string_id_map() { return *m_profiler_string_id_map; }
|
||||
|
||||
bool is_profiling() const { return m_is_profiling; }
|
||||
|
@ -114,8 +114,8 @@ public:
|
|||
}
|
||||
|
||||
struct SymbolInfo {
|
||||
String lib_name;
|
||||
String symbol;
|
||||
DeprecatedString lib_name;
|
||||
DeprecatedString symbol;
|
||||
Optional<Debug::DebugInfo::SourcePosition> source_position;
|
||||
};
|
||||
|
||||
|
@ -124,9 +124,9 @@ public:
|
|||
void dump_regions() const;
|
||||
|
||||
private:
|
||||
const String m_executable_path;
|
||||
const DeprecatedString m_executable_path;
|
||||
Vector<StringView> const m_arguments;
|
||||
Vector<String> const m_environment;
|
||||
Vector<DeprecatedString> const m_environment;
|
||||
|
||||
SoftMMU m_mmu;
|
||||
NonnullOwnPtr<SoftCPU> m_cpu;
|
||||
|
@ -134,14 +134,14 @@ private:
|
|||
OwnPtr<MallocTracer> m_malloc_tracer;
|
||||
|
||||
void setup_stack(Vector<ELF::AuxiliaryValue>);
|
||||
Vector<ELF::AuxiliaryValue> generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String const& executable_path, int executable_fd) const;
|
||||
Vector<ELF::AuxiliaryValue> generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, DeprecatedString const& executable_path, int executable_fd) const;
|
||||
void register_signal_handlers();
|
||||
void setup_signal_trampoline();
|
||||
|
||||
void send_signal(int);
|
||||
|
||||
void emit_profile_sample(AK::OutputStream&);
|
||||
void emit_profile_event(AK::OutputStream&, StringView event_name, String const& contents);
|
||||
void emit_profile_event(AK::OutputStream&, StringView event_name, DeprecatedString const& contents);
|
||||
|
||||
int virt$accept4(FlatPtr);
|
||||
int virt$access(FlatPtr, size_t, int);
|
||||
|
@ -256,8 +256,8 @@ private:
|
|||
MmapRegion const* find_text_region(FlatPtr address);
|
||||
MmapRegion const* load_library_from_address(FlatPtr address);
|
||||
MmapRegion const* first_region_for_object(StringView name);
|
||||
String create_backtrace_line(FlatPtr address);
|
||||
String create_instruction_line(FlatPtr address, X86::Instruction const& insn);
|
||||
DeprecatedString create_backtrace_line(FlatPtr address);
|
||||
DeprecatedString create_instruction_line(FlatPtr address, X86::Instruction const& insn);
|
||||
|
||||
bool m_shutdown { false };
|
||||
int m_exit_status { 0 };
|
||||
|
@ -292,13 +292,13 @@ private:
|
|||
NonnullOwnPtr<ELF::Image> image;
|
||||
};
|
||||
|
||||
HashMap<String, CachedELF> m_dynamic_library_cache;
|
||||
HashMap<DeprecatedString, CachedELF> m_dynamic_library_cache;
|
||||
|
||||
RangeAllocator m_range_allocator;
|
||||
|
||||
OutputFileStream* m_profile_stream { nullptr };
|
||||
Vector<int>* m_profiler_string_id_map { nullptr };
|
||||
NonnullOwnPtrVector<String>* m_profiler_strings { nullptr };
|
||||
NonnullOwnPtrVector<DeprecatedString>* m_profiler_strings { nullptr };
|
||||
|
||||
bool m_is_profiling { false };
|
||||
size_t m_profile_instruction_interval { 0 };
|
||||
|
|
|
@ -297,7 +297,7 @@ FlatPtr Emulator::virt$perf_event(int event, FlatPtr arg1, FlatPtr arg2)
|
|||
if (event == PERF_EVENT_SIGNPOST) {
|
||||
if (is_profiling()) {
|
||||
if (profiler_string_id_map().size() > arg1)
|
||||
emit_profile_event(profile_stream(), "signpost"sv, String::formatted("\"arg1\": {}, \"arg2\": {}", arg1, arg2));
|
||||
emit_profile_event(profile_stream(), "signpost"sv, DeprecatedString::formatted("\"arg1\": {}, \"arg2\": {}", arg1, arg2));
|
||||
syscall(SC_perf_event, PERF_EVENT_SIGNPOST, profiler_string_id_map().at(arg1), arg2);
|
||||
} else {
|
||||
syscall(SC_perf_event, PERF_EVENT_SIGNPOST, arg1, arg2);
|
||||
|
@ -316,7 +316,7 @@ FlatPtr Emulator::virt$perf_register_string(FlatPtr string, size_t size)
|
|||
auto ret = (int)syscall(SC_perf_register_string, buffer, size + 4);
|
||||
|
||||
if (ret >= 0 && is_profiling()) {
|
||||
profiler_strings().append(make<String>(StringView { buffer + 4, size }));
|
||||
profiler_strings().append(make<DeprecatedString>(StringView { buffer + 4, size }));
|
||||
profiler_string_id_map().append(ret);
|
||||
ret = profiler_string_id_map().size() - 1;
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ int Emulator::virt$set_mmap_name(FlatPtr params_addr)
|
|||
auto* region = mmu().find_region({ 0x23, (FlatPtr)params.addr });
|
||||
if (!region || !is<MmapRegion>(*region))
|
||||
return -EINVAL;
|
||||
static_cast<MmapRegion&>(*region).set_name(String::copy(name));
|
||||
static_cast<MmapRegion&>(*region).set_name(DeprecatedString::copy(name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -608,7 +608,7 @@ int Emulator::virt$set_process_name(FlatPtr user_buffer, int size)
|
|||
if (size < 0)
|
||||
return -EINVAL;
|
||||
auto host_buffer = mmu().copy_buffer_from_vm(user_buffer, size);
|
||||
auto name = String::formatted("(UE) {}", StringView { host_buffer.data(), host_buffer.size() });
|
||||
auto name = DeprecatedString::formatted("(UE) {}", StringView { host_buffer.data(), host_buffer.size() });
|
||||
return syscall(SC_set_process_name, name.characters(), name.length());
|
||||
}
|
||||
|
||||
|
@ -846,7 +846,7 @@ static void round_to_page_size(FlatPtr& address, size_t& size)
|
|||
u32 Emulator::virt$munmap(FlatPtr address, size_t size)
|
||||
{
|
||||
if (is_profiling())
|
||||
emit_profile_event(profile_stream(), "munmap"sv, String::formatted("\"ptr\": {}, \"size\": {}", address, size));
|
||||
emit_profile_event(profile_stream(), "munmap"sv, DeprecatedString::formatted("\"ptr\": {}, \"size\": {}", address, size));
|
||||
round_to_page_size(address, size);
|
||||
Vector<Region*, 4> marked_for_deletion;
|
||||
bool has_non_mmap_region = false;
|
||||
|
@ -905,7 +905,7 @@ u32 Emulator::virt$mmap(u32 params_addr)
|
|||
final_address = result.value().base().get();
|
||||
auto final_size = result.value().size();
|
||||
|
||||
String name_str;
|
||||
DeprecatedString name_str;
|
||||
if (params.name.characters) {
|
||||
auto buffer_result = ByteBuffer::create_uninitialized(params.name.length);
|
||||
if (buffer_result.is_error())
|
||||
|
@ -916,7 +916,7 @@ u32 Emulator::virt$mmap(u32 params_addr)
|
|||
}
|
||||
|
||||
if (is_profiling())
|
||||
emit_profile_event(profile_stream(), "mmap"sv, String::formatted(R"("ptr": {}, "size": {}, "name": "{}")", final_address, final_size, name_str));
|
||||
emit_profile_event(profile_stream(), "mmap"sv, DeprecatedString::formatted(R"("ptr": {}, "size": {}, "name": "{}")", final_address, final_size, name_str));
|
||||
|
||||
if (params.flags & MAP_ANONYMOUS) {
|
||||
mmu().add_region(MmapRegion::create_anonymous(final_address, final_size, params.prot, move(name_str)));
|
||||
|
@ -1230,15 +1230,15 @@ int Emulator::virt$execve(FlatPtr params_addr)
|
|||
Syscall::SC_execve_params params;
|
||||
mmu().copy_from_vm(¶ms, params_addr, sizeof(params));
|
||||
|
||||
auto path = String::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length));
|
||||
Vector<String> arguments;
|
||||
Vector<String> environment;
|
||||
auto path = DeprecatedString::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length));
|
||||
Vector<DeprecatedString> arguments;
|
||||
Vector<DeprecatedString> environment;
|
||||
|
||||
auto copy_string_list = [this](auto& output_vector, auto& string_list) {
|
||||
for (size_t i = 0; i < string_list.length; ++i) {
|
||||
Syscall::StringArgument string;
|
||||
mmu().copy_from_vm(&string, (FlatPtr)&string_list.strings[i], sizeof(string));
|
||||
output_vector.append(String::copy(mmu().copy_buffer_from_vm((FlatPtr)string.characters, string.length)));
|
||||
output_vector.append(DeprecatedString::copy(mmu().copy_buffer_from_vm((FlatPtr)string.characters, string.length)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1284,7 +1284,7 @@ int Emulator::virt$stat(FlatPtr params_addr)
|
|||
Syscall::SC_stat_params params;
|
||||
mmu().copy_from_vm(¶ms, params_addr, sizeof(params));
|
||||
|
||||
auto path = String::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length));
|
||||
auto path = DeprecatedString::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length));
|
||||
struct stat host_statbuf;
|
||||
int rc;
|
||||
if (params.follow_symlinks)
|
||||
|
@ -1523,7 +1523,7 @@ int Emulator::virt$scheduler_set_parameters(FlatPtr user_addr)
|
|||
int Emulator::virt$set_thread_name(pid_t pid, FlatPtr name_addr, size_t name_length)
|
||||
{
|
||||
auto user_name = mmu().copy_buffer_from_vm(name_addr, name_length);
|
||||
auto name = String::formatted("(UE) {}", StringView { user_name.data(), user_name.size() });
|
||||
auto name = DeprecatedString::formatted("(UE) {}", StringView { user_name.data(), user_name.size() });
|
||||
return syscall(SC_set_thread_name, pid, name.characters(), name.length());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,20 +26,20 @@ static void free_pages(void* ptr, size_t bytes)
|
|||
VERIFY(rc == 0);
|
||||
}
|
||||
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::create_anonymous(u32 base, u32 size, u32 prot, String name)
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::create_anonymous(u32 base, u32 size, u32 prot, DeprecatedString name)
|
||||
{
|
||||
auto* data = (u8*)mmap_initialized(size, 0, String::formatted("(UE) {}", name).characters());
|
||||
auto* data = (u8*)mmap_initialized(size, 0, DeprecatedString::formatted("(UE) {}", name).characters());
|
||||
auto* shadow_data = (u8*)mmap_initialized(size, 1, "MmapRegion ShadowData");
|
||||
auto region = adopt_own(*new MmapRegion(base, size, prot, data, shadow_data));
|
||||
region->m_name = move(name);
|
||||
return region;
|
||||
}
|
||||
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, String name)
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, DeprecatedString name)
|
||||
{
|
||||
// Since we put the memory to an arbitrary location, do not pass MAP_FIXED and MAP_FIXED_NOREPLACE to the Kernel.
|
||||
auto real_flags = flags & ~(MAP_FIXED | MAP_FIXED_NOREPLACE);
|
||||
auto* data = (u8*)mmap_with_name(nullptr, size, prot, real_flags, fd, offset, name.is_empty() ? nullptr : String::formatted("(UE) {}", name).characters());
|
||||
auto* data = (u8*)mmap_with_name(nullptr, size, prot, real_flags, fd, offset, name.is_empty() ? nullptr : DeprecatedString::formatted("(UE) {}", name).characters());
|
||||
VERIFY(data != MAP_FAILED);
|
||||
auto* shadow_data = (u8*)mmap_initialized(size, 1, "MmapRegion ShadowData");
|
||||
auto region = adopt_own(*new MmapRegion(base, size, prot, data, shadow_data));
|
||||
|
@ -318,10 +318,10 @@ void MmapRegion::set_prot(int prot)
|
|||
}
|
||||
}
|
||||
|
||||
void MmapRegion::set_name(String name)
|
||||
void MmapRegion::set_name(DeprecatedString name)
|
||||
{
|
||||
m_name = move(name);
|
||||
set_mmap_name(range().base().as_ptr(), range().size(), String::formatted("(UE) {}", m_name).characters());
|
||||
set_mmap_name(range().base().as_ptr(), range().size(), DeprecatedString::formatted("(UE) {}", m_name).characters());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ class MallocTracer;
|
|||
|
||||
class MmapRegion final : public Region {
|
||||
public:
|
||||
static NonnullOwnPtr<MmapRegion> create_anonymous(u32 base, u32 size, u32 prot, String name);
|
||||
static NonnullOwnPtr<MmapRegion> create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, String name);
|
||||
static NonnullOwnPtr<MmapRegion> create_anonymous(u32 base, u32 size, u32 prot, DeprecatedString name);
|
||||
static NonnullOwnPtr<MmapRegion> create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, DeprecatedString name);
|
||||
virtual ~MmapRegion() override;
|
||||
|
||||
virtual ValueWithShadow<u8> read8(u32 offset) override;
|
||||
|
@ -51,8 +51,8 @@ public:
|
|||
MallocRegionMetadata* malloc_metadata() { return m_malloc_metadata; }
|
||||
void set_malloc_metadata(Badge<MallocTracer>, NonnullOwnPtr<MallocRegionMetadata> metadata) { m_malloc_metadata = move(metadata); }
|
||||
|
||||
String const& name() const { return m_name; }
|
||||
String lib_name() const
|
||||
DeprecatedString const& name() const { return m_name; }
|
||||
DeprecatedString lib_name() const
|
||||
{
|
||||
if (m_name.contains("Loader.so"sv))
|
||||
return "Loader.so";
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
return {};
|
||||
return m_name.substring(0, *maybe_separator);
|
||||
}
|
||||
void set_name(String name);
|
||||
void set_name(DeprecatedString name);
|
||||
|
||||
private:
|
||||
MmapRegion(u32 base, u32 size, int prot, u8* data, u8* shadow_data);
|
||||
|
@ -72,7 +72,7 @@ private:
|
|||
bool m_malloc { false };
|
||||
|
||||
OwnPtr<MallocRegionMetadata> m_malloc_metadata;
|
||||
String m_name;
|
||||
DeprecatedString m_name;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
String fpu_exception_string(FPU_Exception ex)
|
||||
DeprecatedString fpu_exception_string(FPU_Exception ex)
|
||||
{
|
||||
switch (ex) {
|
||||
case FPU_Exception::StackFault:
|
||||
|
|
|
@ -23,7 +23,7 @@ int main(int argc, char** argv, char** env)
|
|||
{
|
||||
Vector<StringView> arguments;
|
||||
bool pause_on_startup { false };
|
||||
String profile_dump_path;
|
||||
DeprecatedString profile_dump_path;
|
||||
FILE* profile_output_file { nullptr };
|
||||
bool enable_roi_mode { false };
|
||||
bool dump_profile { false };
|
||||
|
@ -45,7 +45,7 @@ int main(int argc, char** argv, char** env)
|
|||
if (dump_profile && profile_instruction_interval == 0)
|
||||
profile_instruction_interval = 128;
|
||||
|
||||
String executable_path;
|
||||
DeprecatedString executable_path;
|
||||
if (arguments[0].contains("/"sv))
|
||||
executable_path = Core::File::real_path_for(arguments[0]);
|
||||
else
|
||||
|
@ -56,10 +56,10 @@ int main(int argc, char** argv, char** env)
|
|||
}
|
||||
|
||||
if (dump_profile && profile_dump_path.is_empty())
|
||||
profile_dump_path = String::formatted("{}.{}.profile", LexicalPath(executable_path).basename(), getpid());
|
||||
profile_dump_path = DeprecatedString::formatted("{}.{}.profile", LexicalPath(executable_path).basename(), getpid());
|
||||
|
||||
OwnPtr<OutputFileStream> profile_stream;
|
||||
OwnPtr<NonnullOwnPtrVector<String>> profile_strings;
|
||||
OwnPtr<NonnullOwnPtrVector<DeprecatedString>> profile_strings;
|
||||
OwnPtr<Vector<int>> profile_string_id_map;
|
||||
|
||||
if (dump_profile) {
|
||||
|
@ -70,20 +70,20 @@ int main(int argc, char** argv, char** env)
|
|||
return 1;
|
||||
}
|
||||
profile_stream = make<OutputFileStream>(profile_output_file);
|
||||
profile_strings = make<NonnullOwnPtrVector<String>>();
|
||||
profile_strings = make<NonnullOwnPtrVector<DeprecatedString>>();
|
||||
profile_string_id_map = make<Vector<int>>();
|
||||
|
||||
profile_stream->write_or_error(R"({"events":[)"sv.bytes());
|
||||
timeval tv {};
|
||||
gettimeofday(&tv, nullptr);
|
||||
profile_stream->write_or_error(
|
||||
String::formatted(
|
||||
DeprecatedString::formatted(
|
||||
R"~({{"type": "process_create", "parent_pid": 1, "executable": "{}", "pid": {}, "tid": {}, "timestamp": {}, "lost_samples": 0, "stack": []}})~",
|
||||
executable_path, getpid(), gettid(), tv.tv_sec * 1000 + tv.tv_usec / 1000)
|
||||
.bytes());
|
||||
}
|
||||
|
||||
Vector<String> environment;
|
||||
Vector<DeprecatedString> environment;
|
||||
for (int i = 0; env[i]; ++i) {
|
||||
environment.append(env[i]);
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ int main(int argc, char** argv, char** env)
|
|||
emulator.profile_stream().write_or_error("], \"strings\": ["sv.bytes());
|
||||
if (emulator.profiler_strings().size()) {
|
||||
for (size_t i = 0; i < emulator.profiler_strings().size() - 1; ++i)
|
||||
emulator.profile_stream().write_or_error(String::formatted("\"{}\", ", emulator.profiler_strings().at(i)).bytes());
|
||||
emulator.profile_stream().write_or_error(String::formatted("\"{}\"", emulator.profiler_strings().last()).bytes());
|
||||
emulator.profile_stream().write_or_error(DeprecatedString::formatted("\"{}\", ", emulator.profiler_strings().at(i)).bytes());
|
||||
emulator.profile_stream().write_or_error(DeprecatedString::formatted("\"{}\"", emulator.profiler_strings().last()).bytes());
|
||||
}
|
||||
emulator.profile_stream().write_or_error("]}"sv.bytes());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue