Skip to content

Commit 4d6fe0d

Browse files
honggyukimnamhyung
authored andcommitted
pre-commit: Add codespell hook in pre-commit and fix typos
codespell is a useful tool to detect typos so this patch adds it as a pre-commit hook by default. This codespell pre-commit hook found many typos and this patch also fixes those typos. $ pre-commit run -a ... codespell................................................................Failed - hook id: codespell - exit code: 65 tests/s-thread-name.c:44: thid ==> this ... gdb/uftrace/utils.py:73: expresssion ==> expression gdb/uftrace/utils.py:75: expresssion ==> expression utils/symbol.h:123: maping ==> mapping check-deps/Makefile.check:19: verison ==> version utils/session.c:342: librarry ==> library utils/session.c:415: resouces ==> resources utils/session.c:469: sesssion ==> session utils/dwarf.c:285: executble ==> executable utils/fstack.c:686: funciton ==> function arch/aarch64/mcount-dynamic.c:137: dont' ==> don't misc/install-deps.sh:13: pacakges ==> packages INSTALL.md:65: softwares ==> software utils/perf.c:247: preapre ==> prepare tests/s-thread-exec.c:14: thid ==> this ... arch/x86_64/mcount-dynamic.c:207: dont' ==> don't arch/x86_64/mcount-dynamic.c:730: correspending ==> corresponding utils/demangle.c:1371: vender ==> vendor check-deps/Makefile:25: verison ==> version arch/i386/mcount-dynamic.c:70: dont' ==> don't utils/utils.c:603: splitted ==> split arch/x86_64/mcount-insn.c:86: orginal ==> original arch/x86_64/mcount-insn.c:548: actuall ==> actually, actual arch/x86_64/mcount.S:87: orignal ==> original arch/x86_64/mcount.S:115: orignal ==> original utils/auto-args.c:571: contant ==> constant, content tests/arch/arm/a.c:1: acount ==> account ... cmds/replay.c:664: annoymous ==> anonymous utils/regs.c:146: reigsters ==> registers arch/x86_64/dynamic.S:149: orignal ==> original utils/graph.c:150: occures ==> occurs Signed-off-by: Honggyu Kim <[email protected]>
1 parent 455cc8a commit 4d6fe0d

27 files changed

+52
-41
lines changed

.codespell_ignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pevent
2+
creat
3+
mmaped
4+
ot
5+
te

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ repos:
1313
rev: v14.0.6
1414
hooks:
1515
- id: clang-format
16+
- repo: https://github.com/codespell-project/codespell
17+
rev: v2.1.0
18+
hooks:
19+
- id: codespell
20+
args: ['-I', '.codespell_ignore']
21+
exclude: "libtraceevent/.*"

INSTALL.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ BUILD
6262
=====
6363

6464
To build uftrace, you need to install basic software development tools first -
65-
like gcc and make. And you also need to install dependent softwares. Please
65+
like gcc and make. And you also need to install dependent packages. Please
6666
see DEPENDENCY section for more details.
6767

6868
Once you have installed the required software(s), you need to run `configure` to set

arch/aarch64/mcount-dynamic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void mcount_arch_find_module(struct mcount_dynamic_info *mdi, struct uftrace_sym
134134
if (sym->type != ST_LOCAL_FUNC && sym->type != ST_GLOBAL_FUNC)
135135
continue;
136136

137-
/* dont' check special functions */
137+
/* don't check special functions */
138138
if (sym->name[0] == '_')
139139
continue;
140140

arch/i386/mcount-dynamic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void mcount_arch_find_module(struct mcount_dynamic_info *mdi, struct uftrace_sym
6767
if (sym->type != ST_LOCAL_FUNC && sym->type != ST_GLOBAL_FUNC)
6868
continue;
6969

70-
/* dont' check special functions */
70+
/* don't check special functions */
7171
if (sym->name[0] == '_')
7272
continue;
7373

arch/x86_64/dynamic.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ ENTRY(dynamic_return)
146146
/* restore original stack pointer */
147147
movq (%rsp), %rsp
148148

149-
/* restore orignal return address in parent */
149+
/* restore original return address in parent */
150150
movq %rax, 88(%rsp)
151151

152152
movq 0(%rsp), %rax

arch/x86_64/mcount-dynamic.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void mcount_arch_find_module(struct mcount_dynamic_info *mdi, struct uftrace_sym
204204
if (sym->type != ST_LOCAL_FUNC && sym->type != ST_GLOBAL_FUNC)
205205
continue;
206206

207-
/* dont' check special functions */
207+
/* don't check special functions */
208208
if (sym->name[0] == '_')
209209
continue;
210210

@@ -727,7 +727,7 @@ void mcount_arch_patch_branch(struct mcount_disasm_info *info, struct mcount_ori
727727
pr_err("target is not in reach");
728728
}
729729

730-
/* patch jcc displacement to target correspending entry in the table */
730+
/* patch jcc displacement to target corresponding entry in the table */
731731
info->insns[jcc_index + 1] = disp;
732732

733733
entry_offset += ARCH_BRANCH_ENTRY_SIZE;

arch/x86_64/mcount-insn.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static int x86_reg_index(int capstone_reg)
8383
* This function relocates jcc8 and jcc32 instructions by replacing them with a jcc8
8484
* that has a null offset. The offset will be patched later when the code is saved
8585
* in the of line execution buffer. The new jcc8 will bounce (if condition is met)
86-
* on a trampoline that jumps to the target of the orginal instruction.
86+
* on a trampoline that jumps to the target of the original instruction.
8787
*
8888
* The relocation of jmp8 and jmp32 is achieved by replacing them with an absolute
8989
* indirect jump to the target.
@@ -545,7 +545,7 @@ static bool check_unsupported(struct mcount_disasm_engine *disasm, cs_insn *insn
545545
if (info->addr > target || target >= info->addr + info->sym->size) {
546546
/* also mark the target function as invalid */
547547
if (!mcount_add_badsym(mdi, insn->address, target)) {
548-
/* it was actuall ok (like tail call) */
548+
/* it was actually ok (like tail call) */
549549
return true;
550550
}
551551

arch/x86_64/mcount.S

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ END(mcount)
8484
/*
8585
* Now, we are just returned from the child, RSP points to the right above the
8686
* stack address containing the return address (now it is mcount_return), but we
87-
* should restore the orignal address and the RSP to return.
87+
* should restore the original address and the RSP to return.
8888
*/
8989
ENTRY(mcount_return)
9090
.cfi_startproc
@@ -112,7 +112,7 @@ ENTRY(mcount_return)
112112
/* restore original stack pointer */
113113
movq 0(%rsp), %rsp
114114

115-
/* restore orignal return address in parent */
115+
/* restore original return address in parent */
116116
movq %rax, 40(%rsp)
117117

118118
movq 0(%rsp), %rax

check-deps/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CHECK_LIST += cc_has_minline_all_stringops
2222
CHECK_CFLAGS = $(CFLAGS) $(CFLAGS_$@) -Werror
2323
CHECK_LDFLAGS = $(LDFLAGS) $(LDFLAGS_$@)
2424

25-
# libpython3 provides an embed verison of pkg-config file since python3.8
25+
# libpython3 provides an embed version of pkg-config file since python3.8
2626
ifeq ($(shell pkg-config python3-embed --exists 2> /dev/null; echo $$?), 0)
2727
EMBED := -embed
2828
endif

check-deps/Makefile.check

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ifneq ($(wildcard $(objdir)/check-deps/cc_has_mno_sse2),)
1616
endif
1717

1818
ifneq ($(wildcard $(srcdir)/check-deps/have_libpython3),)
19-
# libpython3 provides an embed verison of pkg-config file since python3.8
19+
# libpython3 provides an embed version of pkg-config file since python3.8
2020
ifeq ($(shell pkg-config python3-embed --exists 2> /dev/null; echo $$?), 0)
2121
EMBED := -embed
2222
endif

cmds/replay.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ void get_argspec_string(struct uftrace_task_reader *task, char *args, size_t len
661661
else if (spec->fmt == ARG_FMT_STRUCT) {
662662
if (spec->type_name) {
663663
/*
664-
* gcc puts "<lambda" to annoymous lambda
664+
* gcc puts "<lambda" to anonymous lambda
665665
* but let's ignore to make it same as clang.
666666
*/
667667
if (strcmp(spec->type_name, "<lambda")) {

gdb/uftrace/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def invoke(self, ptr, typename, elementname):
7070
ContainerOf()
7171

7272

73-
def gdb_eval_or_none(expresssion):
73+
def gdb_eval_or_none(expression):
7474
try:
75-
return gdb.parse_and_eval(expresssion)
75+
return gdb.parse_and_eval(expression)
7676
except:
7777
return None
7878

misc/install-deps.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010
OPT="${@}"
1111

1212
if [ ! -f /etc/os-release ]; then
13-
echo "Your distribution is not supported, so please install pacakges manually."
13+
echo "Your distribution is not supported, so please install packages manually."
1414
echo
1515
exit
1616
fi

tests/arch/arm/a.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
static volatile int acount;
1+
static volatile int account;
22

33
extern volatile int tcount;
44
extern void t1(void);
@@ -7,17 +7,17 @@ extern void t2(void);
77
static void __attribute__((noinline)) a1(void)
88
{
99
t1();
10-
acount++;
10+
account++;
1111
}
1212

1313
void __attribute__((noinline)) a2(void)
1414
{
1515
t2();
16-
acount++;
16+
account++;
1717
}
1818

1919
int main(void)
2020
{
2121
a1();
22-
return acount + tcount;
22+
return account + tcount;
2323
}

tests/s-thread-exec.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ void *thread_func(void *arg)
1111

1212
int main(void)
1313
{
14-
pthread_t thid;
14+
pthread_t thrd_id;
1515

16-
pthread_create(&thid, NULL, thread_func, "t-abc");
17-
pthread_join(thid, NULL);
16+
pthread_create(&thrd_id, NULL, thread_func, "t-abc");
17+
pthread_join(thrd_id, NULL);
1818

1919
return 0;
2020
}

tests/s-thread-name.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ static void *thread_fourth(void *arg)
4141
int main(void)
4242
{
4343
int i;
44-
pthread_t thid[4];
44+
pthread_t thrd_id[4];
4545

46-
pthread_create(&thid[0], NULL, thread_first, NULL);
47-
pthread_create(&thid[1], NULL, thread_second, NULL);
48-
pthread_create(&thid[2], NULL, thread_third, NULL);
49-
pthread_create(&thid[3], NULL, thread_fourth, NULL);
46+
pthread_create(&thrd_id[0], NULL, thread_first, NULL);
47+
pthread_create(&thrd_id[1], NULL, thread_second, NULL);
48+
pthread_create(&thrd_id[2], NULL, thread_third, NULL);
49+
pthread_create(&thrd_id[3], NULL, thread_fourth, NULL);
5050

5151
for (i = 0; i < 4; i++)
52-
pthread_join(thid[i], NULL);
52+
pthread_join(thrd_id[i], NULL);
5353

5454
return 0;
5555
}

utils/auto-args.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ char *get_enum_string(struct rb_root *root, char *name, int val)
568568
* This function parses @enum_str and add it to @root so that it can be
569569
* used for argument/return later. The syntax of enum is same as C
570570
* (except for the 'enum' keyword) but it only accepts a simple integer
571-
* contant or other enum constant in RHS.
571+
* constant or other enum constant in RHS.
572572
*
573573
* For example, following string should be accepted:
574574
*

utils/demangle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ static int dd_operator_name(struct demangle_data *dd)
13681368
}
13691369
}
13701370
if (c0 == 'v' && isdigit(c1)) {
1371-
/* vender extended operator */
1371+
/* vendor extended operator */
13721372
dd->type++;
13731373
dd_source_name(dd);
13741374
dd->type--;

utils/dwarf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int setup_dwarf_info(const char *filename, struct uftrace_dbg_info *dinfo
282282

283283
/*
284284
* symbol table already uses relative address but non-PIE
285-
* executble needs to use absolute address for DWARF info.
285+
* executable needs to use absolute address for DWARF info.
286286
* Also as filter entry uses absolute address, it needs to
287287
* keep the offset to recover relative address back.
288288
*/

utils/fstack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ void fstack_exit(struct uftrace_task_reader *task)
683683
* @task - tracee task
684684
* @fstack - function tracing stack
685685
*
686-
* This funciton updates current display depth according to @type and
686+
* This function updates current display depth according to @type and
687687
* flags of @fstack, and return a new depth.
688688
*/
689689
int fstack_update(int type, struct uftrace_task_reader *task, struct uftrace_fstack *fstack)

utils/graph.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static int add_graph_exit(struct uftrace_task_graph *tg)
147147
return 1;
148148

149149
/*
150-
* LOST only occures in kernel, so clear tg->lost
150+
* LOST only occurs in kernel, so clear tg->lost
151151
* when return to userspace
152152
*/
153153
tg->lost = false;

utils/perf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void record_perf_data(struct uftrace_perf_writer *perf, int cpu, int sock)
244244
#endif /* HAVE_PERF_CLOCKID */
245245

246246
/**
247-
* setup_perf_data - preapre reading perf event data
247+
* setup_perf_data - prepare reading perf event data
248248
* @handle - uftrace data file handle
249249
*
250250
* This function prepares to read perf event data from perf-cpu*.dat

utils/regs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static const size_t arch_reg_sizes[] = {
143143
ARRAY_SIZE(uft_i386_reg_table),
144144
};
145145

146-
/* number of integer reigsters */
146+
/* number of integer registers */
147147
static const int arch_reg_int_sizes[] = {
148148
0, 6, 4, 8, 2,
149149
};

utils/session.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ struct uftrace_session *get_session_from_sid(struct uftrace_session_link *sessio
339339
* @sess: pointer to a current session
340340
* @timestamp: timestamp at the dlopen call
341341
* @base_addr: load address of text segment of the library
342-
* @libname: name of the librarry
342+
* @libname: name of the library
343343
*
344344
* This functions adds the info of a library which was loaded by dlopen.
345345
* Instead of creating a new session, it just adds the library information
@@ -412,7 +412,7 @@ void delete_session(struct uftrace_session *sess)
412412
}
413413

414414
/**
415-
* delete_sessions - free all resouces in the @sessions
415+
* delete_sessions - free all resources in the @sessions
416416
* @sessions: session link to manage sessions and tasks
417417
*
418418
* This function removes all session-related data structure in
@@ -466,7 +466,7 @@ static void add_session_ref(struct uftrace_task *task, struct uftrace_session *s
466466
*
467467
* This function searches the sessions tree using @task and @timestamp.
468468
* The most recent session that has a smaller than the @timestamp will
469-
* be returned. If it didn't find a session tries to search sesssion
469+
* be returned. If it didn't find a session tries to search session
470470
* list of parent or thread-leader.
471471
*/
472472
struct uftrace_session *find_task_session(struct uftrace_session_link *sessions,

utils/symbol.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct uftrace_sym_info {
120120
uint64_t kernel_base;
121121
/* map for the main executable (cached) */
122122
struct uftrace_mmap *exec_map;
123-
/* list of memory maping info for executable and libraries */
123+
/* list of memory mapping info for executable and libraries */
124124
struct uftrace_mmap *maps;
125125
};
126126

utils/utils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ char *strjoin(char *left, char *right, const char *delim)
600600
* @str: input string
601601
* @delim: delimiter to split the string
602602
*
603-
* This function build a string vector using @str splitted by @delim.
603+
* This function builds a string vector using @str split by @delim.
604604
*/
605605
void strv_split(struct strv *strv, const char *str, const char *delim)
606606
{

0 commit comments

Comments
 (0)