-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathreport.c
629 lines (490 loc) · 18.8 KB
/
report.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
/*
* report events to client
*
* This file is part of mtrace-ng.
* Copyright (C) 2018 Stefani Seibold <[email protected]>
*
* This work was sponsored by Rohde & Schwarz GmbH & Co. KG, Munich/Germany.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "backend.h"
#include "backtrace.h"
#include "common.h"
#include "debug.h"
#include "library.h"
#include "main.h"
#include "memtrace.h"
#include "options.h"
#include "report.h"
#include "server.h"
#include "task.h"
#include "timer.h"
#include "trace.h"
static void report_alloc64(struct task *task, enum mt_operation op, unsigned long ptr, unsigned long size, unsigned int depth, struct library_symbol *libsym)
{
unsigned int i = 0;
struct mt_alloc_payload_64 *alloc = alloca(sizeof(*alloc) + depth * sizeof(uint64_t));
alloc->ptr = (uint64_t)ptr;
alloc->size = (uint64_t)size;
if (depth) {
alloc->data[i++] = libsym->addr;
if (likely(backtrace_init_unwind(task) >= 0)) {
while(i < depth) {
if (likely(backtrace_location_type(task) != LIBTYPE_LOADER)) {
alloc->data[i] = (uint64_t)backtrace_get_ip(task);
if (likely(alloc->data[i - 1] != alloc->data[i])) {
if (unlikely(!alloc->data[i]))
break;
++i;
}
}
if (unlikely(backtrace_step(task) < 0))
break;
}
}
}
server_send_msg(op, task->leader->pid, alloc, sizeof(*alloc) + i * sizeof(uint64_t));
}
static void report_alloc32(struct task *task, enum mt_operation op, unsigned long ptr, unsigned long size, int depth, struct library_symbol *libsym)
{
int i = 0;
struct mt_alloc_payload_32 *alloc = alloca(sizeof(*alloc) + depth * sizeof(uint32_t));
alloc->ptr = (uint32_t)ptr;
alloc->size = (uint32_t)size;
if (depth) {
alloc->data[i++] = libsym->addr;
if (likely(backtrace_init_unwind(task) >= 0)) {
while(i < depth) {
if (likely(backtrace_location_type(task) != LIBTYPE_LOADER)) {
alloc->data[i] = (uint32_t)backtrace_get_ip(task);
if (likely(alloc->data[i - 1] != alloc->data[i])) {
if (unlikely(!alloc->data[i]))
break;
++i;
}
}
if (unlikely(backtrace_step(task) < 0))
break;
}
}
}
task->bp_skipped = 1;
skip_breakpoint(task, task->event.e_un.breakpoint);
server_send_msg(op, task->leader->pid, alloc, sizeof(*alloc) + i * sizeof(uint32_t));
}
static void report_alloc(struct task *task, enum mt_operation op, unsigned long ptr, unsigned long size, int depth, struct library_symbol *libsym)
{
debug(DEBUG_FUNCTION, "%d [%d]: %#lx %lu", op, task->pid, ptr, size);
if (!ptr)
return;
if (task_is_64bit(task))
report_alloc64(task, op, ptr, size, depth, libsym);
else
report_alloc32(task, op, ptr, size, depth, libsym);
}
static void _report_alloc_op(struct task *task, struct library_symbol *libsym, enum mt_operation op)
{
unsigned long size = fetch_param(task, 0);
unsigned long ret = fetch_retval(task);
report_alloc(task, op, ret, size, options.bt_depth, libsym);
}
static void _report_malloc(struct task *task, struct library_symbol *libsym)
{
_report_alloc_op(task, libsym, MT_MALLOC);
}
#if 0
static void _report_malloc1(struct task *task, struct library_symbol *libsym)
{
unsigned long ret = fetch_retval(task);
report_alloc(task, MT_MALLOC, ret, 1, options.bt_depth, libsym);
}
#endif
static void _report_reallocarray(struct task *task, struct library_symbol *libsym)
{
unsigned long size = fetch_param(task, 1) * fetch_param(task, 2);
unsigned long ret = fetch_retval(task);
report_alloc(task, MT_MALLOC, ret, size, options.bt_depth, libsym);
}
static void _report_new(struct task *task, struct library_symbol *libsym)
{
_report_alloc_op(task, libsym, options.sanity ? MT_NEW : MT_MALLOC);
}
static void _report_new_array(struct task *task, struct library_symbol *libsym)
{
_report_alloc_op(task, libsym, options.sanity ? MT_NEW_ARRAY : MT_MALLOC);
}
static void _report_free_op(struct task *task, struct library_symbol *libsym, enum mt_operation op)
{
unsigned long addr = fetch_param(task, 0);
report_alloc(task, op, addr, 0, options.sanity ? options.bt_depth : 0, libsym);
}
static void report_free(struct task *task, struct library_symbol *libsym)
{
_report_free_op(task, libsym, MT_FREE);
}
static void report_delete(struct task *task, struct library_symbol *libsym)
{
_report_free_op(task, libsym, options.sanity ? MT_DELETE : MT_FREE);
}
static void report_delete_array(struct task *task, struct library_symbol *libsym)
{
_report_free_op(task, libsym, options.sanity ? MT_DELETE_ARRAY : MT_FREE);
}
static void _report_realloc(struct task *task, struct library_symbol *libsym)
{
unsigned long size = fetch_param(task, 1);
unsigned long ret = fetch_retval(task);
if (!task->in_realloc) {
if (ret)
report_alloc(task, MT_REALLOC, ret, size, options.bt_depth, libsym);
return;
}
task->in_realloc = 0;
if (ret)
report_alloc(task, MT_REALLOC, ret, size, options.bt_depth, libsym);
if (task_is_64bit(task)) {
struct mt_alloc_payload_64 *alloc = alloca(sizeof(*alloc));
alloc->ptr = (uint64_t)ret;
alloc->size = (uint64_t)task->pid;
server_send_msg(MT_REALLOC_DONE, task->leader->pid, alloc, sizeof(*alloc));
}
else {
struct mt_alloc_payload_32 *alloc = alloca(sizeof(*alloc));
alloc->ptr = (uint32_t)ret;
alloc->size = (uint32_t)task->pid;
server_send_msg(MT_REALLOC_DONE, task->leader->pid, alloc, sizeof(*alloc));
}
}
static void report_realloc(struct task *task, struct library_symbol *libsym)
{
unsigned long addr = fetch_param(task, 0);
assert(!task->in_realloc);
if (addr) {
task->in_realloc = 1;
report_alloc(task, MT_REALLOC_ENTER, addr, task->pid, options.sanity ? options.bt_depth : 0, libsym);
}
}
static void _report_calloc(struct task *task, struct library_symbol *libsym)
{
unsigned long size = fetch_param(task, 0) * fetch_param(task, 1);
unsigned long ret = fetch_retval(task);
report_alloc(task, MT_MALLOC, ret, size, options.bt_depth, libsym);
}
static ssize_t arch_pagesize = -1;
static void _report_mmap(struct task *task, struct library_symbol *libsym)
{
unsigned long ret = fetch_retval(task);
if ((void *)ret == MAP_FAILED)
return;
unsigned long size = fetch_param(task, 1);
if (unlikely(arch_pagesize==-1)) arch_pagesize=getpagesize();
// fixup size, if size is not a multiple of the pagesize, we get the "partial" page too. -
if (size % arch_pagesize) {
size += arch_pagesize - size % arch_pagesize;
}
report_alloc(task, MT_MMAP, ret, size, options.bt_depth, libsym);
}
static void _report_mmap64(struct task *task, struct library_symbol *libsym)
{
unsigned long ret = fetch_retval(task);
if ((void *)ret == MAP_FAILED)
return;
union {
uint64_t l;
struct {
uint32_t v1;
uint32_t v2;
} v;
} size;
size.l = fetch_param(task, 1);
if (!task_is_64bit(task)) {
size.v.v1 = fetch_param(task, 1);
size.v.v2 = fetch_param(task, 2);
}
else
size.l = fetch_param(task, 1);
if (unlikely(arch_pagesize == -1)) arch_pagesize=getpagesize();
// fixup size, if size is not a multiple of the pagesize, we get the "partial" page too. -
if (size.l % arch_pagesize) {
size.l += arch_pagesize - size.l % arch_pagesize;
}
report_alloc(task, MT_MMAP64, ret, size.l, options.bt_depth, libsym);
}
static void _report_munmap(struct task *task, struct library_symbol *libsym)
{
unsigned long addr = fetch_param(task, 0);
unsigned long size = fetch_param(task, 1);
unsigned long ret = fetch_retval(task);
if(ret != 0 ) return;
if(unlikely(arch_pagesize==-1)) arch_pagesize=getpagesize();
// fixup size, if needed: all pages in [addr, addr+size] are unmapped -- see munmap(2)
if(size % arch_pagesize) {
size += arch_pagesize - size % arch_pagesize;
}
report_alloc(task, MT_MUNMAP, addr, size, 0, libsym);
}
static void _report_memalign(struct task *task, struct library_symbol *libsym)
{
unsigned long size = fetch_param(task, 1);
unsigned long ret = fetch_retval(task);
report_alloc(task, MT_MEMALIGN, ret, size, options.bt_depth, libsym);
}
static void _report_posix_memalign(struct task *task, struct library_symbol *libsym)
{
unsigned long ret = fetch_retval(task);
if (ret)
return;
unsigned long size = fetch_param(task, 2);
unsigned long ptr = fetch_param(task, 0);
unsigned long new_ptr;
if (task_is_64bit(task))
copy_from_proc(task, ARCH_ADDR_T(ptr), &new_ptr, sizeof(new_ptr));
else {
uint32_t tmp;
copy_from_proc(task, ARCH_ADDR_T(ptr), &tmp, sizeof(tmp));
new_ptr = tmp;
}
report_alloc(task, MT_POSIX_MEMALIGN, new_ptr, size, options.bt_depth, libsym);
}
static void _report_aligned_alloc(struct task *task, struct library_symbol *libsym)
{
unsigned long size = fetch_param(task, 1);
unsigned long ret = fetch_retval(task);
report_alloc(task, MT_ALIGNED_ALLOC, ret, size, options.bt_depth, libsym);
}
static void _report_valloc(struct task *task, struct library_symbol *libsym)
{
unsigned long size = fetch_param(task, 0);
unsigned long ret = fetch_retval(task);
report_alloc(task, MT_VALLOC, ret, size, options.bt_depth, libsym);
}
static void _report_pvalloc(struct task *task, struct library_symbol *libsym)
{
unsigned long size = fetch_param(task, 0);
unsigned long ret = fetch_retval(task);
return report_alloc(task, MT_PVALLOC, ret, size, options.bt_depth, libsym);
}
static void _report_mremap(struct task *task, struct library_symbol *libsym)
{
unsigned long addr = fetch_param(task, 0);
unsigned long oldsize = fetch_param(task, 1);
unsigned long newsize = fetch_param(task, 2);
unsigned long ret = fetch_retval(task);
if( (void*)ret != MAP_FAILED) {
// mremap(2): if oldsize is zero and the mapping a shared mapping, a new mapping
// (Of the existing) will be created.
if (oldsize) report_alloc(task, MT_MUNMAP, addr, oldsize, 0, libsym);
report_alloc(task, MT_MMAP, ret, newsize, options.bt_depth, libsym);
}
}
static const struct function flist[] = {
{ "malloc", "malloc", 0, NULL, _report_malloc },
{ "free", "free", 0, report_free, NULL },
{ "realloc", "realloc", 0, report_realloc, _report_realloc },
{ "calloc", "calloc", 0, NULL, _report_calloc },
{ "posix_memalign", "posix_memalign", 0, NULL, _report_posix_memalign },
{ "mmap", "mmap", 0, NULL, _report_mmap },
{ "mmap64", "mmap64", 1, NULL, _report_mmap64 },
{ "munmap", "munmap", 0, NULL, _report_munmap },
{ "memalign", "memalign", 0, NULL, _report_memalign },
{ "aligned_alloc", "aligned_alloc", 1, NULL, _report_aligned_alloc },
{ "valloc", "valloc", 1, NULL, _report_valloc },
{ "pvalloc", "pvalloc", 1, NULL, _report_pvalloc },
{ "mremap", "mremap", 0, NULL, _report_mremap },
{ "cfree", "cfree", 1, report_free, NULL },
{ "reallocarray", "reallocarray", 0, NULL, _report_reallocarray },
#if 0
{ "strdup", "strdup", 0, NULL, _report_malloc1 },
{ "strndup", "strndup", 0, NULL, _report_malloc1 },
{ "__strdup", "__strdup", 0, NULL, _report_malloc1 },
{ "__strndup", "__strndup", 0, NULL, _report_malloc1 },
{ "asprintf", "asprintf", 0, NULL, _report_malloc1 },
{ "vasprintf", "vasprintf", 0, NULL, _report_malloc1 },
{ "__asprintf", "__asprintf", 0, NULL, _report_malloc1 },
#endif
{ "new(unsigned int)", "_Znwj", 1, NULL, _report_new },
{ "new[](unsigned int)", "_Znaj", 1, NULL, _report_new_array },
{ "new(unsigned int, std::nothrow_t const&)", "_ZnwjRKSt9nothrow_t", 1, NULL, _report_new },
{ "new[](unsigned int, std::nothrow_t const&)", "_ZnajRKSt9nothrow_t", 1, NULL, _report_new_array },
{ "new(unsigned long)", "_Znwm", 1, NULL, _report_new },
{ "new[](unsigned long)", "_Znam", 1, NULL, _report_new_array },
{ "new(unsigned long, std::nothrow_t const&)", "_ZnwmRKSt9nothrow_t", 1, NULL, _report_new },
{ "new[](unsigned long, std::nothrow_t const&)", "_ZnamRKSt9nothrow_t", 1, NULL, _report_new_array },
{ "new(unsigned int, std::align_val_t, std::nothrow_t const&)", "_ZnwjSt11align_val_tRKSt9nothrow_t", 1, NULL, _report_new },
{ "new[](unsigned int, std::align_val_t, std::nothrow_t const&)", "_ZnajSt11align_val_tRKSt9nothrow_t", 1, NULL, _report_new_array },
{ "new(unsigned int, std::align_val_t)", "_ZnwjSt11align_val_t", 1, NULL, _report_new },
{ "new[](unsigned int, std::align_val_t)", "_ZnajSt11align_val_t", 1, NULL, _report_new_array },
{ "new(unsigned long, std::align_val_t, std::nothrow_t const&)", "_ZnwmSt11align_val_tRKSt9nothrow_t", 1, NULL, _report_new },
{ "new[](unsigned long, std::align_val_t, std::nothrow_t const&)", "_ZnamSt11align_val_tRKSt9nothrow_t", 1, NULL, _report_new_array },
{ "new(unsigned long, std::align_val_t)", "_ZnwmSt11align_val_t", 1, NULL, _report_new },
{ "new[](unsigned long, std::align_val_t)", "_ZnamSt11align_val_t", 1, NULL, _report_new_array },
{ "delete(void*)", "_ZdlPv", 1, report_delete, NULL },
{ "delete[](void*)", "_ZdaPv", 1, report_delete_array, NULL },
{ "delete(void*, std::nothrow_t const&)", "_ZdlPvRKSt9nothrow_t", 1, report_delete, NULL },
{ "delete[](void*, std::nothrow_t const&)", "_ZdaPvRKSt9nothrow_t", 1, report_delete_array, NULL },
{ "delete(void*, unsigned int)", "_ZdlPvj", 1, report_delete, NULL },
{ "delete[](void*, unsigned int)", "_ZdaPvj", 1, report_delete_array, NULL },
{ "delete(void*, unsigned long)", "_ZdlPvm", 1, report_delete, NULL },
{ "delete[](void*, unsigned long)", "_ZdaPvm", 1, report_delete_array, NULL },
{ "delete(void*, std::align_val_t)", "_ZdlPvSt11align_val_t", 1, report_delete, NULL },
{ "delete[](void*, std::align_val_t)", "_ZdaPvSt11align_val_t", 1, report_delete_array, NULL },
{ "delete(void*, std::align_val_t, std::nothrow_t const&)", "_ZdlPvSt11align_val_tRKSt9nothrow_t", 1, report_delete, NULL },
{ "delete[](void*, std::align_val_t, std::nothrow_t const&)", "_ZdaPvSt11align_val_tRKSt9nothrow_t", 1, report_delete_array, NULL },
{ "delete(void*, unsigned int, std::align_val_t)", "_ZdlPvjSt11align_val_t", 1, report_delete, NULL },
{ "delete[](void*, unsigned int, std::align_val_t)", "_ZdaPvjSt11align_val_t", 1, report_delete_array, NULL },
{ "delete(void*, unsigned long, std::align_val_t)", "_ZdlPvmSt11align_val_t", 1, report_delete, NULL },
{ "delete[](void*, unsigned long, std::align_val_t)", "_ZdaPvmSt11align_val_t", 1, report_delete_array, NULL },
};
const struct function *flist_matches_symbol(const char *sym_name)
{
unsigned int i;
for(i = 0; i < ARRAY_SIZE(flist); ++i) {
if (options.nocpp && flist[i].name[0] == '_')
continue;
if (!strcmp(sym_name, flist[i].name))
return &flist[i];
}
return 0;
}
int _report_map(struct task *task, struct library *lib, enum mt_operation op)
{
struct libref *libref = lib->libref;
size_t len = strlen(libref->filename) + 1;
struct mt_map_payload *payload = alloca(sizeof(struct mt_map_payload) + len);
payload->addr = libref->txt_vaddr;
payload->offset = libref->txt_offset;
payload->size = libref->txt_size;
payload->bias = libref->bias;
memcpy(payload->filename, libref->filename, len);
return server_send_msg(op, task->pid, payload, sizeof(struct mt_map_payload) + len);
}
int report_add_map(struct task *task, struct library *lib)
{
if (!server_connected())
return -1;
return _report_map(task, lib, MT_ADD_MAP);
}
int report_del_map(struct task *task, struct library *lib)
{
if (!server_connected())
return -1;
return _report_map(task, lib, MT_DEL_MAP);
}
static void store_timer_info(struct memtrace_timer_info *info, struct mt_timer *timer)
{
info->max = timer->max;
info->count = timer->count;
info->culminate = timer->culminate;
}
int report_info(int do_trace)
{
struct memtrace_info mt_info;
if (!server_connected())
return -1;
mt_info.version = MEMTRACE_SI_VERSION;
mt_info.mode = 0;
mt_info.do_trace = do_trace ? 1 : 0;
mt_info.stack_depth = options.bt_depth;
mt_info.verbose = options.verbose;
store_timer_info(&mt_info.stop_time, &stop_time);
store_timer_info(&mt_info.sw_bp_time, &sw_bp_time);
store_timer_info(&mt_info.hw_bp_time, &hw_bp_time);
store_timer_info(&mt_info.backtrace_time, &backtrace_time);
store_timer_info(&mt_info.reorder_time, &reorder_time);
store_timer_info(&mt_info.report_in_time, &report_in_time);
store_timer_info(&mt_info.report_out_time, &report_out_time);
store_timer_info(&mt_info.skip_bp_time, &skip_bp_time);
if (options.verbose)
mt_info.mode |= MEMTRACE_SI_VERBOSE;
if (options.follow_exec)
mt_info.mode |= MEMTRACE_SI_EXEC;
if (options.follow)
mt_info.mode |= MEMTRACE_SI_FORK;
return server_send_msg(MT_INFO, 0, &mt_info, sizeof(mt_info));
}
int report_scan(pid_t pid, const void *data, unsigned int data_len)
{
if (!server_connected())
return -1;
return server_send_msg(MT_SCAN, pid, data, data_len);
}
int report_attach(struct task *task, int was_attached)
{
struct mt_attached_payload state = { .attached = !!was_attached };
if (!server_connected())
return -1;
return server_send_msg(task_is_64bit(task) ? MT_ATTACH64 : MT_ATTACH, task->pid, &state, sizeof(state));
}
int report_fork(struct task *task, struct task *ptask)
{
struct mt_pid_payload fork_pid = { .pid = ptask->leader->pid };
if (!server_connected())
return -1;
return server_send_msg(MT_FORK, task->pid, &fork_pid, sizeof(fork_pid));
}
int report_exit(struct task *task)
{
if (!server_connected())
return -1;
return server_send_msg(MT_EXIT, task->pid, NULL, 0);
}
int report_about_exit(struct task *task)
{
if (!server_connected())
return -1;
return server_send_msg(MT_ABOUT_EXIT, task->pid, NULL, 0);
}
int report_nofollow(struct task *task)
{
if (!server_connected())
return -1;
return server_send_msg(MT_NOFOLLOW, task->pid, NULL, 0);
}
int report_detach(struct task *task)
{
if (!server_connected())
return -1;
return server_send_msg(MT_DETACH, task->pid, NULL, 0);
}
int report_disconnect(void)
{
if (!server_connected())
return -1;
return server_send_msg(MT_DISCONNECT, 0, NULL, 0);
}
static void report_process(struct task *leader)
{
struct list_head *it;
report_attach(leader, 1);
list_for_each(it, &leader->libraries_list) {
struct library *lib = container_of(it, struct library, list);
report_add_map(leader, lib);
}
}
int report_processes(void)
{
if (!server_connected())
return -1;
each_process(&report_process);
return 0;
}