mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -46,7 +46,7 @@ Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(Debug::Proces
|
|||
// We need to go back to the 'call' instruction to get accurate source position information.
|
||||
if (frame_index > 0)
|
||||
--current_instruction;
|
||||
DeprecatedString name = lib->debug_info->elf().symbolicate(current_instruction - lib->base_address);
|
||||
ByteString name = lib->debug_info->elf().symbolicate(current_instruction - lib->base_address);
|
||||
if (name.is_empty()) {
|
||||
dbgln("BacktraceModel: couldn't find containing function for address: {:p} (library={})", current_instruction, lib->name);
|
||||
name = "<missing>";
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override;
|
||||
|
||||
struct FrameInfo {
|
||||
DeprecatedString function_name;
|
||||
ByteString function_name;
|
||||
FlatPtr instruction_address { 0 };
|
||||
FlatPtr frame_base { 0 };
|
||||
Optional<Debug::DebugInfo::SourcePosition> m_source_position;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
|
@ -17,5 +17,5 @@ enum class BreakpointChange {
|
|||
Removed,
|
||||
};
|
||||
|
||||
using BreakpointChangeCallback = Function<void(DeprecatedString const& file, size_t line, BreakpointChange)>;
|
||||
using BreakpointChangeCallback = Function<void(ByteString const& file, size_t line, BreakpointChange)>;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ Debugger& Debugger::the()
|
|||
}
|
||||
|
||||
void Debugger::initialize(
|
||||
DeprecatedString source_root,
|
||||
ByteString source_root,
|
||||
Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback,
|
||||
Function<void()> on_continue_callback,
|
||||
Function<void()> on_exit_callback,
|
||||
|
@ -33,7 +33,7 @@ bool Debugger::is_initialized()
|
|||
}
|
||||
|
||||
Debugger::Debugger(
|
||||
DeprecatedString source_root,
|
||||
ByteString source_root,
|
||||
Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback,
|
||||
Function<void()> on_continue_callback,
|
||||
Function<void()> on_exit_callback,
|
||||
|
@ -48,7 +48,7 @@ Debugger::Debugger(
|
|||
pthread_cond_init(&m_ui_action_cond, nullptr);
|
||||
}
|
||||
|
||||
void Debugger::on_breakpoint_change(DeprecatedString const& file, size_t line, BreakpointChange change_type)
|
||||
void Debugger::on_breakpoint_change(ByteString const& file, size_t line, BreakpointChange change_type)
|
||||
{
|
||||
auto position = create_source_position(file, line);
|
||||
|
||||
|
@ -80,7 +80,7 @@ void Debugger::on_breakpoint_change(DeprecatedString const& file, size_t line, B
|
|||
}
|
||||
}
|
||||
|
||||
bool Debugger::set_execution_position(DeprecatedString const& file, size_t line)
|
||||
bool Debugger::set_execution_position(ByteString const& file, size_t line)
|
||||
{
|
||||
auto position = create_source_position(file, line);
|
||||
auto session = Debugger::the().session();
|
||||
|
@ -95,11 +95,11 @@ bool Debugger::set_execution_position(DeprecatedString const& file, size_t line)
|
|||
return true;
|
||||
}
|
||||
|
||||
Debug::DebugInfo::SourcePosition Debugger::create_source_position(DeprecatedString const& file, size_t line)
|
||||
Debug::DebugInfo::SourcePosition Debugger::create_source_position(ByteString const& file, size_t line)
|
||||
{
|
||||
if (file.starts_with('/'))
|
||||
return { file, line + 1 };
|
||||
return { LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_source_root, file)), line + 1 };
|
||||
return { LexicalPath::canonicalized_path(ByteString::formatted("{}/{}", m_source_root, file)), line + 1 };
|
||||
}
|
||||
|
||||
intptr_t Debugger::start_static()
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
};
|
||||
|
||||
static void initialize(
|
||||
DeprecatedString source_root,
|
||||
ByteString source_root,
|
||||
Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback,
|
||||
Function<void()> on_continue_callback,
|
||||
Function<void()> on_exit_callback,
|
||||
|
@ -34,11 +34,11 @@ public:
|
|||
|
||||
static bool is_initialized();
|
||||
|
||||
void on_breakpoint_change(DeprecatedString const& file, size_t line, BreakpointChange change_type);
|
||||
bool set_execution_position(DeprecatedString const& file, size_t line);
|
||||
void on_breakpoint_change(ByteString const& file, size_t line, BreakpointChange change_type);
|
||||
bool set_execution_position(ByteString const& file, size_t line);
|
||||
|
||||
void set_executable_path(DeprecatedString const& path) { m_executable_path = path; }
|
||||
void set_source_root(DeprecatedString const& source_root) { m_source_root = source_root; }
|
||||
void set_executable_path(ByteString const& path) { m_executable_path = path; }
|
||||
void set_source_root(ByteString const& source_root) { m_source_root = source_root; }
|
||||
void set_pid_to_attach(pid_t pid) { m_pid_to_attach = pid; }
|
||||
|
||||
Debug::DebugSession* session() { return m_debug_session.ptr(); }
|
||||
|
@ -94,13 +94,13 @@ private:
|
|||
};
|
||||
|
||||
explicit Debugger(
|
||||
DeprecatedString source_root,
|
||||
ByteString source_root,
|
||||
Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback,
|
||||
Function<void()> on_continue_callback,
|
||||
Function<void()> on_exit_callback,
|
||||
Function<void(float)> on_initialization_progress);
|
||||
|
||||
Debug::DebugInfo::SourcePosition create_source_position(DeprecatedString const& file, size_t line);
|
||||
Debug::DebugInfo::SourcePosition create_source_position(ByteString const& file, size_t line);
|
||||
|
||||
void start();
|
||||
int debugger_loop(Debug::DebugSession::DesiredInitialDebugeeState);
|
||||
|
@ -118,7 +118,7 @@ private:
|
|||
CreateDebugSessionResult create_debug_session();
|
||||
|
||||
OwnPtr<Debug::DebugSession> m_debug_session;
|
||||
DeprecatedString m_source_root;
|
||||
ByteString m_source_root;
|
||||
DebuggingState m_state;
|
||||
|
||||
pthread_mutex_t m_ui_action_mutex {};
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
|
||||
Vector<Debug::DebugInfo::SourcePosition> m_breakpoints;
|
||||
|
||||
DeprecatedString m_executable_path;
|
||||
ByteString m_executable_path;
|
||||
Optional<pid_t> m_pid_to_attach;
|
||||
|
||||
Function<HasControlPassedToUser(PtraceRegisters const&)> m_on_stopped_callback;
|
||||
|
|
|
@ -60,7 +60,7 @@ DisassemblyModel::DisassemblyModel(Debug::DebugSession const& debug_session, Ptr
|
|||
if (!insn.has_value())
|
||||
break;
|
||||
FlatPtr address_in_profiled_program = symbol.value().value() + offset_into_symbol;
|
||||
auto disassembly = insn.value().to_deprecated_string(address_in_profiled_program, &symbol_provider);
|
||||
auto disassembly = insn.value().to_byte_string(address_in_profiled_program, &symbol_provider);
|
||||
StringView instruction_bytes = view.substring_view(offset_into_symbol, insn.value().length());
|
||||
m_instructions.append({ insn.value(), disassembly, instruction_bytes, address_in_profiled_program });
|
||||
|
||||
|
@ -93,12 +93,12 @@ GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole
|
|||
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
if (index.column() == Column::Address)
|
||||
return DeprecatedString::formatted("{:p}", insn.address);
|
||||
return ByteString::formatted("{:p}", insn.address);
|
||||
if (index.column() == Column::InstructionBytes) {
|
||||
StringBuilder builder;
|
||||
for (auto ch : insn.bytes)
|
||||
builder.appendff("{:02x} ", static_cast<unsigned char>(ch));
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
if (index.column() == Column::Disassembly)
|
||||
return insn.disassembly;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace HackStudio {
|
|||
|
||||
struct InstructionData {
|
||||
X86::Instruction insn;
|
||||
DeprecatedString disassembly;
|
||||
ByteString disassembly;
|
||||
StringView bytes;
|
||||
FlatPtr address { 0 };
|
||||
};
|
||||
|
|
|
@ -49,7 +49,7 @@ void DisassemblyWidget::update_state(Debug::DebugSession const& debug_session, P
|
|||
return;
|
||||
auto containing_function = lib->debug_info->get_containing_function(regs.ip() - lib->base_address);
|
||||
if (containing_function.has_value())
|
||||
m_function_name_label->set_text(String::from_deprecated_string(containing_function.value().name).release_value_but_fixme_should_propagate_errors());
|
||||
m_function_name_label->set_text(String::from_byte_string(containing_function.value().name).release_value_but_fixme_should_propagate_errors());
|
||||
else
|
||||
m_function_name_label->set_text("<missing>"_string);
|
||||
show_disassembly();
|
||||
|
@ -73,7 +73,7 @@ void DisassemblyWidget::show_disassembly()
|
|||
m_unavailable_disassembly_widget->set_visible(false);
|
||||
}
|
||||
|
||||
void DisassemblyWidget::hide_disassembly(DeprecatedString const& reason)
|
||||
void DisassemblyWidget::hide_disassembly(ByteString const& reason)
|
||||
{
|
||||
m_top_container->set_visible(false);
|
||||
m_disassembly_view->set_visible(false);
|
||||
|
|
|
@ -21,18 +21,18 @@ class UnavailableDisassemblyWidget final : public GUI::Frame {
|
|||
public:
|
||||
virtual ~UnavailableDisassemblyWidget() override { }
|
||||
|
||||
DeprecatedString const& reason() const { return m_reason; }
|
||||
void set_reason(DeprecatedString const& text) { m_reason = text; }
|
||||
ByteString const& reason() const { return m_reason; }
|
||||
void set_reason(ByteString const& text) { m_reason = text; }
|
||||
|
||||
private:
|
||||
UnavailableDisassemblyWidget(DeprecatedString const& reason)
|
||||
UnavailableDisassemblyWidget(ByteString const& reason)
|
||||
: m_reason(reason)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent& event) override;
|
||||
|
||||
DeprecatedString m_reason;
|
||||
ByteString m_reason;
|
||||
};
|
||||
|
||||
class DisassemblyWidget final : public GUI::Widget {
|
||||
|
@ -47,7 +47,7 @@ private:
|
|||
DisassemblyWidget();
|
||||
|
||||
void show_disassembly();
|
||||
void hide_disassembly(DeprecatedString const&);
|
||||
void hide_disassembly(ByteString const&);
|
||||
|
||||
RefPtr<GUI::Widget> m_top_container;
|
||||
RefPtr<GUI::TableView> m_disassembly_view;
|
||||
|
|
|
@ -118,7 +118,7 @@ GUI::Variant RegistersModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
|
|||
if (index.column() == Column::Register)
|
||||
return reg.name;
|
||||
if (index.column() == Column::Value)
|
||||
return DeprecatedString::formatted("{:p}", reg.value);
|
||||
return ByteString::formatted("{:p}", reg.value);
|
||||
return {};
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace HackStudio {
|
||||
|
||||
struct RegisterData {
|
||||
DeprecatedString name;
|
||||
ByteString name;
|
||||
FlatPtr value;
|
||||
bool changed { false };
|
||||
};
|
||||
|
|
|
@ -55,7 +55,7 @@ int VariablesModel::row_count(const GUI::ModelIndex& index) const
|
|||
return node->members.size();
|
||||
}
|
||||
|
||||
static DeprecatedString variable_value_as_string(Debug::DebugInfo::VariableInfo const& variable)
|
||||
static ByteString variable_value_as_string(Debug::DebugInfo::VariableInfo const& variable)
|
||||
{
|
||||
if (variable.location_type != Debug::DebugInfo::VariableInfo::LocationType::Address)
|
||||
return "N/A";
|
||||
|
@ -69,20 +69,20 @@ static DeprecatedString variable_value_as_string(Debug::DebugInfo::VariableInfo
|
|||
return enumerator->constant_data.as_u32 == enumerator_value;
|
||||
});
|
||||
if (it.is_end())
|
||||
return DeprecatedString::formatted("Unknown ({})", value.value());
|
||||
return DeprecatedString::formatted("{}::{}", variable.type_name, (*it)->name);
|
||||
return ByteString::formatted("Unknown ({})", value.value());
|
||||
return ByteString::formatted("{}::{}", variable.type_name, (*it)->name);
|
||||
}
|
||||
|
||||
if (variable.type_name == "int") {
|
||||
auto value = Debugger::the().session()->peek(variable_address);
|
||||
VERIFY(value.has_value());
|
||||
return DeprecatedString::formatted("{}", static_cast<int>(value.value()));
|
||||
return ByteString::formatted("{}", static_cast<int>(value.value()));
|
||||
}
|
||||
|
||||
if (variable.type_name == "char") {
|
||||
auto value = Debugger::the().session()->peek(variable_address);
|
||||
VERIFY(value.has_value());
|
||||
return DeprecatedString::formatted("'{0:c}'", (char)value.value());
|
||||
return ByteString::formatted("'{0:c}'", (char)value.value());
|
||||
}
|
||||
|
||||
if (variable.type_name == "bool") {
|
||||
|
@ -91,13 +91,13 @@ static DeprecatedString variable_value_as_string(Debug::DebugInfo::VariableInfo
|
|||
return (value.value() & 1) ? "true" : "false";
|
||||
}
|
||||
|
||||
return DeprecatedString::formatted("type: {} @ {:p}, ", variable.type_name, variable_address);
|
||||
return ByteString::formatted("type: {} @ {:p}, ", variable.type_name, variable_address);
|
||||
}
|
||||
|
||||
static Optional<u32> string_to_variable_value(StringView string_value, Debug::DebugInfo::VariableInfo const& variable)
|
||||
{
|
||||
if (variable.is_enum_type()) {
|
||||
auto prefix_string = DeprecatedString::formatted("{}::", variable.type_name);
|
||||
auto prefix_string = ByteString::formatted("{}::", variable.type_name);
|
||||
auto string_to_use = string_value;
|
||||
if (string_value.starts_with(prefix_string))
|
||||
string_to_use = string_value.substring_view(prefix_string.length(), string_value.length() - prefix_string.length());
|
||||
|
@ -143,7 +143,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView
|
|||
|
||||
GUI::MessageBox::show(
|
||||
parent_window,
|
||||
DeprecatedString::formatted("String value \"{}\" could not be converted to a value of type {}.", string_value, variable->type_name),
|
||||
ByteString::formatted("String value \"{}\" could not be converted to a value of type {}.", string_value, variable->type_name),
|
||||
"Set value failed"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
|
|||
switch (role) {
|
||||
case GUI::ModelRole::Display: {
|
||||
auto value_as_string = variable_value_as_string(*variable);
|
||||
return DeprecatedString::formatted("{}: {}", variable->name, value_as_string);
|
||||
return ByteString::formatted("{}: {}", variable->name, value_as_string);
|
||||
}
|
||||
case GUI::ModelRole::Icon:
|
||||
return m_variable_icon;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue