diff --git a/.clang-format b/.clang-format index ab4772e..5e8f217 100644 --- a/.clang-format +++ b/.clang-format @@ -3,7 +3,6 @@ BasedOnStyle: LLVM IndentWidth: 4 UseTab: Never BreakBeforeBraces: Linux -AlwaysBreakBeforeMultilineStrings: true AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AllowShortFunctionsOnASingleLine: false @@ -14,8 +13,6 @@ AlignOperands: true AllowAllParametersOfDeclarationOnNextLine: false AlignAfterOpenBracket: true SpaceAfterCStyleCast: false -MaxEmptyLinesToKeep: 2 -BreakBeforeBinaryOperators: NonAssignment BreakStringLiterals: false SortIncludes: false ContinuationIndentWidth: 4 diff --git a/.gitignore b/.gitignore index f1fd949..ec25d17 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ config.h libtrdb.a tests trdb +benchmarks Makefile.in diff --git a/src/disassembly.c b/src/disassembly.c index 8ce3a40..d78f8e9 100644 --- a/src/disassembly.c +++ b/src/disassembly.c @@ -125,8 +125,8 @@ int trdb_init_disassembler_unit_for_pulp(struct disassembler_unit *dunit, return -trdb_invalid; trdb_init_disassemble_info_for_pulp(dinfo); dinfo->disassembler_options = options; - dunit->disassemble_fn = disassembler(bfd_arch_riscv, false, - bfd_mach_riscv32, NULL); + dunit->disassemble_fn = + disassembler(bfd_arch_riscv, false, bfd_mach_riscv32, NULL); return 0; } @@ -157,10 +157,8 @@ int trdb_init_disassembler_unit(struct disassembler_unit *dunit, bfd *abfd, return -trdb_invalid; trdb_init_disassemble_info_from_bfd(dinfo, abfd, options); - dunit->disassemble_fn = disassembler(bfd_get_arch(abfd), - bfd_big_endian(abfd), - bfd_get_mach(abfd), - abfd); + dunit->disassemble_fn = disassembler( + bfd_get_arch(abfd), bfd_big_endian(abfd), bfd_get_mach(abfd), abfd); if (!dunit->disassemble_fn) return -trdb_arch_support; @@ -557,10 +555,9 @@ find_symbol_for_address(bfd_vma vma, struct disassemble_info *inf, long *place) * the relocation table. Also give the target a chance to reject symbols. */ want_section = - (aux->require_sec || ((abfd->flags & HAS_RELOC) != 0 && - vma >= bfd_section_vma(sec) && - vma < (bfd_section_vma(sec) + - bfd_section_size(sec) / opb))); + (aux->require_sec || + ((abfd->flags & HAS_RELOC) != 0 && vma >= bfd_section_vma(sec) && + vma < (bfd_section_vma(sec) + bfd_section_size(sec) / opb))); if ((sorted_syms[thisplace]->section != sec && want_section) || !inf->symbol_is_valid(sorted_syms[thisplace], inf)) { long i; @@ -656,8 +653,7 @@ static void trdb_print_addr_with_sym(bfd *abfd, asection *sec, asymbol *sym, if (sym == NULL) { bfd_vma secaddr; - (*inf->fprintf_func)(inf->stream, " <%s", - bfd_section_name(sec)); + (*inf->fprintf_func)(inf->stream, " <%s", bfd_section_name(sec)); secaddr = bfd_section_vma(sec); if (vma < secaddr) { (*inf->fprintf_func)(inf->stream, "-0x"); @@ -873,10 +869,8 @@ int trdb_alloc_dinfo_with_bfd(struct trdb_ctx *c, bfd *abfd, } /* Use libopcodes to locate a suitable disassembler. */ - dunit->disassemble_fn = disassembler(bfd_get_arch(abfd), - bfd_big_endian(abfd), - bfd_get_mach(abfd), - abfd); + dunit->disassemble_fn = disassembler( + bfd_get_arch(abfd), bfd_big_endian(abfd), bfd_get_mach(abfd), abfd); if (!dunit->disassemble_fn) { err(c, "can't disassemble for architecture %s\n", bfd_printable_arch_mach(bfd_get_arch(abfd), 0)); diff --git a/src/trace_debugger.c b/src/trace_debugger.c index 88a8a86..e23fb3a 100644 --- a/src/trace_debugger.c +++ b/src/trace_debugger.c @@ -1864,8 +1864,7 @@ int trdb_decompress_trace(struct trdb_ctx *c, bfd *abfd, status = -trdb_bad_vma; goto fail; } - stop_offset = - bfd_section_size(section) / dinfo.octets_per_byte; + stop_offset = bfd_section_size(section) / dinfo.octets_per_byte; free_section_for_debugging(&dinfo); if ((status = alloc_section_for_debugging(c, abfd, section, diff --git a/src/trdb.c b/src/trdb.c index 7299281..210302d 100644 --- a/src/trdb.c +++ b/src/trdb.c @@ -468,8 +468,8 @@ static int disassemble_trace(struct trdb_ctx *c, FILE *output_fp, bfd *abfd, /* if we can't use a bfd assume its pulp riscv */ init_disassemble_info(&dinfo, stdout, (fprintf_ftype)fprintf); trdb_init_disassemble_info_for_pulp(&dinfo); - dunit.disassemble_fn = disassembler(bfd_arch_riscv, false, - bfd_mach_riscv32, NULL); + dunit.disassemble_fn = + disassembler(bfd_arch_riscv, false, bfd_mach_riscv32, NULL); } trdb_disassemble_trace(samplecnt, *samples, &dunit); diff --git a/test/tests.c b/test/tests.c index f0f846f..ec0e19b 100644 --- a/test/tests.c +++ b/test/tests.c @@ -112,10 +112,8 @@ static int test_disasm_bfd() /* set up disassembly context */ struct disassembler_unit dunit = {0}; dunit.dinfo = &dinfo; - dunit.disassemble_fn = disassembler(bfd_get_arch(abfd), - bfd_big_endian(abfd), - bfd_get_mach(abfd), - abfd); + dunit.disassemble_fn = disassembler( + bfd_get_arch(abfd), bfd_big_endian(abfd), bfd_get_mach(abfd), abfd); if (!dunit.disassemble_fn) { LOG_ERRT("No suitable disassembler found\n"); return TRDB_FAIL; @@ -878,8 +876,9 @@ static int test_decompress_trace(const char *bin_path, const char *trace_path) } static int test_decompress_cvs_trace_differential(const char *bin_path, - const char *trace_path, - bool differential, bool implicit_ret) + const char *trace_path, + bool differential, + bool implicit_ret) { bfd *abfd = NULL; size_t instrcnt = 0; @@ -1001,8 +1000,9 @@ static int test_decompress_cvs_trace_differential(const char *bin_path, } static int test_decompress_trace_differential(const char *bin_path, - const char *trace_path, - bool differential, bool implicit_ret) + const char *trace_path, + bool differential, + bool implicit_ret) { bfd *abfd = NULL; struct tr_instr *tmp = NULL;