Skip to content

Commit 79c0a9e

Browse files
Fix formatting for code and tests
1 parent 7bac074 commit 79c0a9e

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

lldb/source/Core/Disassembler.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,8 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
732732
return;
733733

734734
addr_t current_pc = m_address.GetLoadAddress(target_sp.get());
735-
addr_t original_pc = frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get());
735+
addr_t original_pc =
736+
frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get());
736737

737738
if (!frame->ChangePC(current_pc))
738739
return;
@@ -744,7 +745,8 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
744745
SymbolContext sc = frame->GetSymbolContext(eSymbolContextFunction);
745746
addr_t func_load_addr = LLDB_INVALID_ADDRESS;
746747
if (sc.function)
747-
func_load_addr = sc.function->GetAddress().GetLoadAddress(target_sp.get());
748+
func_load_addr =
749+
sc.function->GetAddress().GetLoadAddress(target_sp.get());
748750

749751
// Only annotate if the current disassembly line is short enough
750752
// to keep annotations aligned past the desired annotation_column.
@@ -763,22 +765,26 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
763765
continue;
764766

765767
// Handle std::optional<DWARFExpressionEntry>.
766-
if (auto entryOrErr = expr_list.GetExpressionEntryAtAddress(func_load_addr, current_pc)) {
768+
if (auto entryOrErr = expr_list.GetExpressionEntryAtAddress(
769+
func_load_addr, current_pc)) {
767770
auto entry = *entryOrErr;
768771
// Check if entry has a file_range, and filter on address if so.
769772
if (!entry.file_range || entry.file_range->ContainsFileAddress(
770-
(current_pc - func_load_addr) + expr_list.GetFuncFileAddress())) {
773+
(current_pc - func_load_addr) +
774+
expr_list.GetFuncFileAddress())) {
771775

772776
StreamString loc_str;
773777
ABI *abi = exe_ctx->GetProcessPtr()->GetABI().get();
774778
llvm::DIDumpOptions opts;
775779
opts.ShowAddresses = false;
776-
opts.PrintRegisterOnly = true; // <-- important: suppress DW_OP_... annotations, etc.
780+
opts.PrintRegisterOnly =
781+
true; // <-- important: suppress DW_OP_... annotations, etc.
777782

778783
entry.expr->DumpLocation(&loc_str, eDescriptionLevelBrief, abi, opts);
779-
784+
780785
// Only include if not empty.
781-
llvm::StringRef loc_clean = llvm::StringRef(loc_str.GetString()).trim();
786+
llvm::StringRef loc_clean =
787+
llvm::StringRef(loc_str.GetString()).trim();
782788
if (!loc_clean.empty()) {
783789
annotations.push_back(llvm::formatv("{0} = {1}", name, loc_clean));
784790
}
@@ -808,7 +814,6 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
808814
s->PutCString(ss.GetString());
809815
}
810816

811-
812817
bool Instruction::DumpEmulation(const ArchSpec &arch) {
813818
std::unique_ptr<EmulateInstruction> insn_emulator_up(
814819
EmulateInstruction::FindPlugin(arch, eInstructionTypeAny, nullptr));
@@ -820,9 +825,7 @@ bool Instruction::DumpEmulation(const ArchSpec &arch) {
820825
return false;
821826
}
822827

823-
bool Instruction::CanSetBreakpoint () {
824-
return !HasDelaySlot();
825-
}
828+
bool Instruction::CanSetBreakpoint() { return !HasDelaySlot(); }
826829

827830
bool Instruction::HasDelaySlot() {
828831
// Default is false.
@@ -1159,10 +1162,8 @@ void InstructionList::Append(lldb::InstructionSP &inst_sp) {
11591162
m_instructions.push_back(inst_sp);
11601163
}
11611164

1162-
uint32_t
1163-
InstructionList::GetIndexOfNextBranchInstruction(uint32_t start,
1164-
bool ignore_calls,
1165-
bool *found_calls) const {
1165+
uint32_t InstructionList::GetIndexOfNextBranchInstruction(
1166+
uint32_t start, bool ignore_calls, bool *found_calls) const {
11661167
size_t num_instructions = m_instructions.size();
11671168

11681169
uint32_t next_branch = UINT32_MAX;

lldb/test/API/functionalities/rich-disassembler/TestRichDisassembler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from lldbsuite.test.lldbtest import *
22
from lldbsuite.test.decorators import *
33

4+
45
class TestRichDisassembler(TestBase):
56
def test_d_original_example_O1(self):
67
"""
78
Tests disassembler output for d_original_example.c built with -O1.
89
"""
910
self.build(
10-
dictionary={'C_SOURCES': 'd_original_example.c', 'CFLAGS_EXTRAS': '-g -O1'}
11+
dictionary={"C_SOURCES": "d_original_example.c", "CFLAGS_EXTRAS": "-g -O1"}
1112
)
1213
exe = self.getBuildArtifact("a.out")
1314
target = self.dbg.CreateTarget(exe)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <stdio.h>
22

33
int main(int argc, char **argv) {
4-
for (int i = 1; i < argc; ++i)
5-
puts(argv[i]);
6-
return 0;
4+
for (int i = 1; i < argc; ++i)
5+
puts(argv[i]);
6+
return 0;
77
}

0 commit comments

Comments
 (0)