Skip to content

Commit 929bd57

Browse files
author
Petr Machata
committed
struct Process becomes struct process
This is for consistency with other structures, and ultimately with Linux coding style. The typedef ("Process") was dropped as well for this reason. This opportunity was used to fix coding style around the impacted lines.
1 parent 5cde20b commit 929bd57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+623
-554
lines changed

backend.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int wait_for_proc(pid_t pid);
7070
int task_kill(pid_t pid, int sig);
7171

7272
/* Called after PID is attached, but before it is continued. */
73-
void trace_set_options(struct Process *proc);
73+
void trace_set_options(struct process *proc);
7474

7575
/* Called after ltrace forks. Should attach the newly created child,
7676
* in whose context this function is called. */
@@ -86,7 +86,7 @@ void untrace_pid(pid_t pid);
8686
/* The back end may need to store arbitrary data to a process. This
8787
* is a place where it can initialize PROC->arch_dep. XXX this should
8888
* be dropped in favor of arhc_process_init on pmachata/libs. */
89-
void get_arch_dep(struct Process *proc);
89+
void get_arch_dep(struct process *proc);
9090

9191
/* Return current instruction pointer of PROC.
9292
*
@@ -95,34 +95,34 @@ void get_arch_dep(struct Process *proc);
9595
* that would otherwise support this. Above we have a definition of
9696
* arch_addr_t. This should be converted to an integral type and
9797
* used for target addresses throughout. */
98-
void *get_instruction_pointer(struct Process *proc);
98+
void *get_instruction_pointer(struct process *proc);
9999

100100
/* Set instruction pointer of PROC to ADDR. XXX see above. */
101-
void set_instruction_pointer(struct Process *proc, void *addr);
101+
void set_instruction_pointer(struct process *proc, void *addr);
102102

103103
/* Return current stack pointer of PROC. XXX see above. */
104-
void *get_stack_pointer(struct Process *proc);
104+
void *get_stack_pointer(struct process *proc);
105105

106106
/* Find and return caller address, i.e. the address where the current
107107
* function returns. */
108-
void *get_return_addr(struct Process *proc, void *stack_pointer);
108+
void *get_return_addr(struct process *proc, void *stack_pointer);
109109

110110
/* Adjust PROC so that when the current function returns, it returns
111111
* to ADDR. */
112-
void set_return_addr(struct Process *proc, void *addr);
112+
void set_return_addr(struct process *proc, void *addr);
113113

114114
/* Enable breakpoint SBP in process PROC. */
115-
void enable_breakpoint(struct Process *proc, struct breakpoint *sbp);
115+
void enable_breakpoint(struct process *proc, struct breakpoint *sbp);
116116

117117
/* Disable breakpoint SBP in process PROC. */
118-
void disable_breakpoint(struct Process *proc, struct breakpoint *sbp);
118+
void disable_breakpoint(struct process *proc, struct breakpoint *sbp);
119119

120120
/* Determine whether the event that we have just seen (and that is
121121
* recorded in STATUS) was a syscall. If it was, return 1. If it was
122122
* a return from syscall, return 2. In both cases, set *SYSNUM to the
123123
* number of said syscall. If it wasn't a syscall, return 0. If
124124
* there was an error, return -1. */
125-
int syscall_p(struct Process *proc, int status, int *sysnum);
125+
int syscall_p(struct process *proc, int status, int *sysnum);
126126

127127
/* Continue execution of the process with given PID. */
128128
void continue_process(pid_t pid);
@@ -136,17 +136,17 @@ void continue_after_signal(pid_t pid, int signum);
136136
* is system call, otherwise it's return from a system call. The
137137
* callback should do whatever book-keeping is necessary and continue
138138
* the process if necessary. */
139-
void continue_after_syscall(struct Process *proc, int sysnum, int ret_p);
139+
void continue_after_syscall(struct process *proc, int sysnum, int ret_p);
140140

141141
/* Called after we hit a breakpoint SBP. Should do whatever
142142
* book-keeping is necessary and then continue the process. */
143-
void continue_after_breakpoint(struct Process *proc, struct breakpoint *sbp);
143+
void continue_after_breakpoint(struct process *proc, struct breakpoint *sbp);
144144

145145
/* Called after we received a vfork. Should do whatever book-keeping
146146
* is necessary and continue the process if necessary. N.B. right
147147
* now, with Linux/GNU the only back end, this is not necessary. I
148148
* imagine other systems may be different. */
149-
void continue_after_vfork(struct Process *proc);
149+
void continue_after_vfork(struct process *proc);
150150

151151
/* Called when trace_me or primary trace_pid fail. This may plug in
152152
* any platform-specific knowledge of why it could be so. */
@@ -171,14 +171,14 @@ void os_ltrace_exiting(void);
171171

172172
/* Should copy COUNT bytes from address ADDR of process PROC to local
173173
* buffer BUF. */
174-
size_t umovebytes (struct Process *proc, void *addr, void *buf, size_t count);
174+
size_t umovebytes(struct process *proc, void *addr, void *buf, size_t count);
175175

176176
/* Find out an address of symbol SYM in process PROC, and return.
177177
* Returning NULL delays breakpoint insertion and enables heaps of
178178
* arch-specific black magic that we should clean up some day.
179179
*
180180
* XXX the same points as for get_instruction_pointer apply. */
181-
void *sym2addr(struct Process *proc, struct library_symbol *sym);
181+
void *sym2addr(struct process *proc, struct library_symbol *sym);
182182

183183
/* Obtain address of PLT entry corresponding to relocation RELA in
184184
* file LTE. This is NDX-th PLT entry in the file.
@@ -189,7 +189,7 @@ GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela *rela);
189189
/* Called at some point after we have attached to PROC. This callback
190190
* should insert an introspection breakpoint for handling dynamic
191191
* linker library loads. */
192-
int linkmap_init(struct Process *proc, arch_addr_t dyn_addr);
192+
int linkmap_init(struct process *proc, arch_addr_t dyn_addr);
193193

194194
/* This should produce and return the next event of one of the traced
195195
* processes. The returned pointer will not be freed by the core and
@@ -198,14 +198,14 @@ int linkmap_init(struct Process *proc, arch_addr_t dyn_addr);
198198
struct Event *next_event(void);
199199

200200
/* Called when process PROC was removed. */
201-
void process_removed(struct Process *proc);
201+
void process_removed(struct process *proc);
202202

203203
/* This should extract entry point address and interpreter (dynamic
204204
* linker) bias if possible. Returns 0 if there were no errors, -1
205205
* otherwise. Sets *ENTRYP and *INTERP_BIASP to non-zero values if
206206
* the corresponding value is known, or zero otherwise; this is not
207207
* done for pointers that are NULL. */
208-
int process_get_entry(struct Process *proc,
208+
int process_get_entry(struct process *proc,
209209
arch_addr_t *entryp,
210210
arch_addr_t *interp_biasp);
211211

@@ -232,7 +232,7 @@ void arch_elf_destroy(struct ltelf *lte);
232232
* destroy, and clone SBP->arch. arch_breakpoint_init and
233233
* arch_breakpoint_clone return 0 on success or a negative value on
234234
* failure. */
235-
int arch_breakpoint_init(struct Process *proc, struct breakpoint *sbp);
235+
int arch_breakpoint_init(struct process *proc, struct breakpoint *sbp);
236236
void arch_breakpoint_destroy(struct breakpoint *sbp);
237237
int arch_breakpoint_clone(struct breakpoint *retp, struct breakpoint *sbp);
238238

@@ -259,19 +259,19 @@ int arch_library_symbol_clone(struct library_symbol *retp,
259259
* PROC->arch in case that PROC underwent an exec. See notes at
260260
* process_init, process_destroy, process_clone and process_exec in
261261
* proc.h. */
262-
int arch_process_init(struct Process *proc);
263-
void arch_process_destroy(struct Process *proc);
264-
int arch_process_clone(struct Process *retp, struct Process *proc);
265-
int arch_process_exec(struct Process *proc);
262+
int arch_process_init(struct process *proc);
263+
void arch_process_destroy(struct process *proc);
264+
int arch_process_clone(struct process *retp, struct process *proc);
265+
int arch_process_exec(struct process *proc);
266266

267267
/* The following callbacks have to be implemented in OS backend if
268268
* os.h defines OS_HAVE_PROCESS_DATA. The protocol is same as for,
269269
* respectively, arch_process_init, arch_process_destroy,
270270
* arch_process_clone and arch_process_exec. */
271-
int os_process_init(struct Process *proc);
272-
void os_process_destroy(struct Process *proc);
273-
int os_process_clone(struct Process *retp, struct Process *proc);
274-
int os_process_exec(struct Process *proc);
271+
int os_process_init(struct process *proc);
272+
void os_process_destroy(struct process *proc);
273+
int os_process_clone(struct process *retp, struct process *proc);
274+
int os_process_exec(struct process *proc);
275275

276276
/* The following callback has to be implemented in backend if arch.h
277277
* defines ARCH_HAVE_GET_SYM_INFO.
@@ -306,18 +306,18 @@ enum plt_status {
306306
* calling arch_plt_sym_val, and symbol is allocated. If plt_ok or
307307
* plt_default are returned, the chain of symbols passed back in RET
308308
* is added to library under construction. */
309-
enum plt_status arch_elf_add_plt_entry(struct Process *proc, struct ltelf *lte,
309+
enum plt_status arch_elf_add_plt_entry(struct process *proc, struct ltelf *lte,
310310
const char *name, GElf_Rela *rela,
311311
size_t i, struct library_symbol **ret);
312312

313313
/* This callback needs to be implemented if arch.h defines
314314
* ARCH_HAVE_DYNLINK_DONE. It is called after the dynamic linker is
315315
* done with the process startup. */
316-
void arch_dynlink_done(struct Process *proc);
316+
void arch_dynlink_done(struct process *proc);
317317

318318
/* This callback needs to be implemented if arch.h defines
319319
* ARCH_HAVE_SYMBOL_RET. It is called after a traced call returns. */
320-
void arch_symbol_ret(struct Process *proc, struct library_symbol *libsym);
320+
void arch_symbol_ret(struct process *proc, struct library_symbol *libsym);
321321

322322

323323
/* This callback needs to be implemented if arch.h defines
@@ -327,7 +327,7 @@ void arch_symbol_ret(struct Process *proc, struct library_symbol *libsym);
327327
* DYN_ADDR holds the address of the dynamic section.
328328
* If the debug area is found, return 0 and fill in the address in *RET.
329329
* If the debug area is not found, return a negative value. */
330-
int arch_find_dl_debug(struct Process *proc, arch_addr_t dyn_addr,
330+
int arch_find_dl_debug(struct process *proc, arch_addr_t dyn_addr,
331331
arch_addr_t *ret);
332332

333333
/* If arch.h defines ARCH_HAVE_FETCH_ARG, the following callbacks have

breakpoint.h

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@
4141

4242
#include "sysdep.h"
4343
#include "library.h"
44-
45-
struct Process;
46-
struct breakpoint;
44+
#include "forward.h"
4745

4846
struct bp_callbacks {
49-
void (*on_hit)(struct breakpoint *bp, struct Process *proc);
50-
void (*on_continue)(struct breakpoint *bp, struct Process *proc);
51-
void (*on_retract)(struct breakpoint *bp, struct Process *proc);
47+
void (*on_hit)(struct breakpoint *bp, struct process *proc);
48+
void (*on_continue)(struct breakpoint *bp, struct process *proc);
49+
void (*on_retract)(struct breakpoint *bp, struct process *proc);
5250
};
5351

5452
struct breakpoint {
@@ -61,11 +59,11 @@ struct breakpoint {
6159
};
6260

6361
/* Call on-hit handler of BP, if any is set. */
64-
void breakpoint_on_hit(struct breakpoint *bp, struct Process *proc);
62+
void breakpoint_on_hit(struct breakpoint *bp, struct process *proc);
6563

6664
/* Call on-continue handler of BP. If none is set, call
6765
* continue_after_breakpoint. */
68-
void breakpoint_on_continue(struct breakpoint *bp, struct Process *proc);
66+
void breakpoint_on_continue(struct breakpoint *bp, struct process *proc);
6967

7068
/* Call on-retract handler of BP, if any is set. This should be
7169
* called before the breakpoints are destroyed. The reason for a
@@ -74,21 +72,21 @@ void breakpoint_on_continue(struct breakpoint *bp, struct Process *proc);
7472
* be called every time we disable the breakpoint, which is too often
7573
* (a breakpoint has to be disabled every time that we need to execute
7674
* the instruction underneath it). */
77-
void breakpoint_on_retract(struct breakpoint *bp, struct Process *proc);
75+
void breakpoint_on_retract(struct breakpoint *bp, struct process *proc);
7876

7977
/* Initialize a breakpoint structure. That doesn't actually realize
8078
* the breakpoint. The breakpoint is initially assumed to be
8179
* disabled. orig_value has to be set separately. CBS may be
8280
* NULL. */
83-
int breakpoint_init(struct breakpoint *bp, struct Process *proc,
81+
int breakpoint_init(struct breakpoint *bp, struct process *proc,
8482
arch_addr_t addr, struct library_symbol *libsym);
8583

8684
/* Make a clone of breakpoint BP into the area of memory pointed to by
8785
* RETP. The original breakpoint was assigned to process OLD_PROC,
8886
* the cloned breakpoint will be attached to process NEW_PROC.
8987
* Returns 0 on success or a negative value on failure. */
90-
int breakpoint_clone(struct breakpoint *retp, struct Process *new_proc,
91-
struct breakpoint *bp, struct Process *old_proc);
88+
int breakpoint_clone(struct breakpoint *retp, struct process *new_proc,
89+
struct breakpoint *bp, struct process *old_proc);
9290

9391
/* Set callbacks. If CBS is non-NULL, then BP->cbs shall be NULL. */
9492
void breakpoint_set_callbacks(struct breakpoint *bp, struct bp_callbacks *cbs);
@@ -98,12 +96,12 @@ void breakpoint_destroy(struct breakpoint *bp);
9896

9997
/* Call enable_breakpoint the first time it's called. Returns 0 on
10098
* success and a negative value on failure. */
101-
int breakpoint_turn_on(struct breakpoint *bp, struct Process *proc);
99+
int breakpoint_turn_on(struct breakpoint *bp, struct process *proc);
102100

103101
/* Call disable_breakpoint when turned off the same number of times
104102
* that it was turned on. Returns 0 on success and a negative value
105103
* on failure. */
106-
int breakpoint_turn_off(struct breakpoint *bp, struct Process *proc);
104+
int breakpoint_turn_off(struct breakpoint *bp, struct process *proc);
107105

108106
/* Utility function that does what typically needs to be done when a
109107
* breakpoint is to be inserted. It checks whether there is another
@@ -113,7 +111,7 @@ int breakpoint_turn_off(struct breakpoint *bp, struct Process *proc);
113111
* added as well as preexisting breakpoints, it then calls
114112
* BREAKPOINT_TURN_ON. If anything fails, it cleans up and returns
115113
* NULL. Otherwise it returns the breakpoint for ADDR. */
116-
struct breakpoint *insert_breakpoint(struct Process *proc, void *addr,
114+
struct breakpoint *insert_breakpoint(struct process *proc, void *addr,
117115
struct library_symbol *libsym);
118116

119117
/* Name of a symbol associated with BP. May be NULL. */
@@ -127,12 +125,12 @@ struct library *breakpoint_library(const struct breakpoint *bp);
127125
* - proc_remove_breakpoint
128126
* - breakpoint_destroy
129127
* XXX */
130-
void delete_breakpoint(struct Process *proc, void *addr);
128+
void delete_breakpoint(struct process *proc, void *addr);
131129

132130
/* XXX some of the following belongs to proc.h/proc.c. */
133-
struct breakpoint *address2bpstruct(struct Process *proc, void *addr);
134-
void enable_all_breakpoints(struct Process *proc);
135-
void disable_all_breakpoints(struct Process *proc);
136-
int breakpoints_init(struct Process *proc);
131+
struct breakpoint *address2bpstruct(struct process *proc, void *addr);
132+
void enable_all_breakpoints(struct process *proc);
133+
void disable_all_breakpoints(struct process *proc);
134+
int breakpoints_init(struct process *proc);
137135

138136
#endif /* BREAKPOINT_H */

0 commit comments

Comments
 (0)