mirror of
https://github.com/sstefani/mtrace.git
synced 2025-12-06 16:56:41 +08:00
minor fixes
This commit is contained in:
parent
da9ae73ea9
commit
7970712f70
11
options.c
11
options.c
@ -122,11 +122,12 @@ static void usage_debug(void)
|
|||||||
fprintf(stdout, "%s debugging option, --debug=<octal> or -D<octal>:\n", progname);
|
fprintf(stdout, "%s debugging option, --debug=<octal> or -D<octal>:\n", progname);
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"\n"
|
"\n"
|
||||||
" number ref. in source description\n"
|
" number description\n"
|
||||||
" 1 general Generally helpful progress information\n"
|
" 1 ptrace events\n"
|
||||||
" 10 event Shows every event received by a traced process\n"
|
" 2 dwarf issues\n"
|
||||||
" 20 process Shows actions carried upon a traced processes\n"
|
" 4 Shows every event received by a traced process\n"
|
||||||
" 40 function Shows every entry to internal functions\n"
|
" 8 Shows actions carried upon a traced processes\n"
|
||||||
|
" 16 Shows every entry to internal functions\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Debugging options are mixed using bitwise-or.\n"
|
"Debugging options are mixed using bitwise-or.\n"
|
||||||
"Note that the meanings and values are subject to change.\n"
|
"Note that the meanings and values are subject to change.\n"
|
||||||
|
|||||||
@ -40,8 +40,6 @@
|
|||||||
#define OPT_SORT_MISMATCHED 8
|
#define OPT_SORT_MISMATCHED 8
|
||||||
#define OPT_SORT_BADFREE 9
|
#define OPT_SORT_BADFREE 9
|
||||||
|
|
||||||
struct options_t options;
|
|
||||||
|
|
||||||
struct opt_p_t {
|
struct opt_p_t {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
struct opt_p_t *next;
|
struct opt_p_t *next;
|
||||||
@ -92,6 +90,8 @@ struct options_t {
|
|||||||
int lflag; /* long dump */
|
int lflag; /* long dump */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct options_t options;
|
||||||
|
|
||||||
char **process_options(int argc, char **argv);
|
char **process_options(int argc, char **argv);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
19
task.c
19
task.c
@ -112,18 +112,29 @@ static inline void insert_pid(struct task *task)
|
|||||||
{
|
{
|
||||||
unsigned int pidhash = PID_HASH(task->pid);
|
unsigned int pidhash = PID_HASH(task->pid);
|
||||||
struct pid_hash *entry = pid_hash[pidhash];
|
struct pid_hash *entry = pid_hash[pidhash];
|
||||||
|
unsigned long int size;
|
||||||
|
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
entry = malloc(sizeof(*entry) + 8 * sizeof(entry->tasks[0]));
|
size = 8;
|
||||||
|
|
||||||
|
entry = malloc(sizeof(*entry) + size * sizeof(entry->tasks[0]));
|
||||||
|
if (!entry)
|
||||||
|
abort();
|
||||||
|
|
||||||
entry->num = 0;
|
entry->num = 0;
|
||||||
entry->size = 8;
|
entry->size = size;
|
||||||
|
|
||||||
pid_hash[pidhash] = entry;
|
pid_hash[pidhash] = entry;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (entry->size == entry->num) {
|
if (entry->size == entry->num) {
|
||||||
entry->size += 8;
|
size = entry->size + 8;
|
||||||
entry = realloc(entry, sizeof(*entry) + entry->size * sizeof(entry->tasks[0]));
|
|
||||||
|
entry = realloc(entry, sizeof(*entry) + size * sizeof(entry->tasks[0]));
|
||||||
|
if (!entry)
|
||||||
|
abort();
|
||||||
|
|
||||||
|
entry->size = size;
|
||||||
|
|
||||||
pid_hash[pidhash] = entry;
|
pid_hash[pidhash] = entry;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user