Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Arinerron/heaptrace
Browse files Browse the repository at this point in the history
  • Loading branch information
Arinerron committed Oct 15, 2021
2 parents 1d76be0 + 579ce29 commit 521c926
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,23 @@ int parse_args(int argc, char *argv[]) {
extern char **environ;
while ((opt = getopt_long(argc, argv, "vFDe:s:b:B:o:", long_options, NULL)) != -1) {
switch (opt) {
case 'v':
case 'v': {
OPT_VERBOSE = 1;
break;
case 'D':
}

case 'D': {
OPT_DEBUG = 1;
OPT_VERBOSE = 1;
break;
case 's':
}

case 's': {
symbol_defs_str = (char *)optarg;
break;
case 'e':
}

case 'e': {
char *_eq = strstr(optarg, "=");
if (!_eq) {
setenv(optarg, "", 1);
Expand All @@ -89,16 +95,24 @@ int parse_args(int argc, char *argv[]) {
setenv(optarg, val, 1);
}
break;
case 'b':
}

case 'b': {
BREAK_AT = parse_bp(optarg);
break;
case 'B':
}

case 'B': {
BREAK_AFTER = parse_bp(optarg);
break;
case 'F':
}

case 'F': {
OPT_FOLLOW_FORK = 1;
break;
case 'o':
}

case 'o': {
FILE *_output_file = fopen(optarg, "a+");
if (!_output_file) {
fatal("failed to open logging file \"%s\".\n", optarg);
Expand All @@ -107,8 +121,11 @@ int parse_args(int argc, char *argv[]) {
output_fd = _output_file;
}
break;
default:
}

default: {
exit_failure(argv);
}
}
}

Expand Down Expand Up @@ -171,7 +188,7 @@ void evaluate_symbol_defs(Breakpoint **bps, int bpsc, ProcMapsEntry *pme_head) {
_sym_sign = '+';
continue;
} else if (c == '-' || c == '+' || c == ',' || c == ';') {
parsevalue:
parsevalue:;
uint64_t val = 0;
if (strcmp(buf, "libc") == 0) val = libc_base;
else if (strcmp(buf, "bin") == 0) val = bin_base;
Expand Down

0 comments on commit 521c926

Please # to comment.