Compare commits
No commits in common. 'c9' and 'c8' have entirely different histories.
@ -1,151 +0,0 @@
|
||||
diff -rupN a/options.c b/options.c
|
||||
--- a/options.c 2019-06-28 17:15:31.515626363 -0400
|
||||
+++ b/options.c 2019-06-28 17:18:59.490632337 -0400
|
||||
@@ -440,7 +440,8 @@ parse_int(const char *optarg, char opt,
|
||||
}
|
||||
|
||||
int
|
||||
-parse_colon_separated_list(const char *paths, struct vect *vec)
|
||||
+parse_colon_separated_list(const char *paths, struct vect *vec,
|
||||
+ enum opt_F_origin origin)
|
||||
{
|
||||
/* PATHS contains a colon-separated list of directories and
|
||||
* files to load. It's modeled after shell PATH variable,
|
||||
@@ -467,6 +468,7 @@ parse_colon_separated_list(const char *p
|
||||
struct opt_F_t arg = {
|
||||
.pathname = tok,
|
||||
.own_pathname = tok == clone,
|
||||
+ .origin = origin,
|
||||
};
|
||||
if (VECT_PUSHBACK(vec, &arg) < 0)
|
||||
/* Presumably this is not a deal-breaker. */
|
||||
@@ -494,16 +496,18 @@ opt_F_get_kind(struct opt_F_t *entry)
|
||||
if (entry->kind == OPT_F_UNKNOWN) {
|
||||
struct stat st;
|
||||
if (lstat(entry->pathname, &st) < 0) {
|
||||
- fprintf(stderr, "Couldn't stat %s: %s\n",
|
||||
- entry->pathname, strerror(errno));
|
||||
+ if (entry->origin == OPT_F_CMDLINE)
|
||||
+ fprintf(stderr, "Couldn't stat %s: %s\n",
|
||||
+ entry->pathname, strerror(errno));
|
||||
entry->kind = OPT_F_BROKEN;
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
entry->kind = OPT_F_DIR;
|
||||
} else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
|
||||
entry->kind = OPT_F_FILE;
|
||||
} else {
|
||||
- fprintf(stderr, "%s is neither a regular file, "
|
||||
- "nor a directory.\n", entry->pathname);
|
||||
+ if (entry->origin == OPT_F_CMDLINE)
|
||||
+ fprintf(stderr, "%s is neither a regular file, "
|
||||
+ "nor a directory.\n", entry->pathname);
|
||||
entry->kind = OPT_F_BROKEN;
|
||||
}
|
||||
}
|
||||
@@ -607,7 +611,8 @@ process_options(int argc, char **argv)
|
||||
options.follow = 1;
|
||||
break;
|
||||
case 'F':
|
||||
- parse_colon_separated_list(optarg, &opt_F);
|
||||
+ parse_colon_separated_list(optarg, &opt_F,
|
||||
+ OPT_F_CMDLINE);
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
diff -rupN a/options.h b/options.h
|
||||
--- a/options.h 2019-06-28 17:15:31.515626363 -0400
|
||||
+++ b/options.h 2019-06-28 17:18:55.984632238 -0400
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ltrace.
|
||||
- * Copyright (C) 2012,2013 Petr Machata, Red Hat Inc.
|
||||
+ * Copyright (C) 2012, 2013, 2015 Petr Machata, Red Hat Inc.
|
||||
* Copyright (C) 2009,2010 Joe Damato
|
||||
* Copyright (C) 1998,2002,2008 Juan Cespedes
|
||||
* Copyright (C) 2006 Ian Wienand
|
||||
@@ -77,10 +77,16 @@ enum opt_F_kind {
|
||||
OPT_F_DIR,
|
||||
};
|
||||
|
||||
+enum opt_F_origin {
|
||||
+ OPT_F_CMDLINE = 0,
|
||||
+ OPT_F_ENVIRON,
|
||||
+};
|
||||
+
|
||||
struct opt_F_t {
|
||||
char *pathname;
|
||||
int own_pathname : 1;
|
||||
enum opt_F_kind kind : 2;
|
||||
+ enum opt_F_origin origin : 1;
|
||||
};
|
||||
|
||||
/* If entry->kind is OPT_F_UNKNOWN, figure out whether it should be
|
||||
@@ -98,7 +104,8 @@ void opt_F_destroy(struct opt_F_t *entry
|
||||
* The list is split and added to VEC, which shall be a vector
|
||||
* initialized like VECT_INIT(VEC, struct opt_F_t); Returns 0 on
|
||||
* success or a negative value on failure. */
|
||||
-int parse_colon_separated_list(const char *paths, struct vect *vec);
|
||||
+int parse_colon_separated_list(const char *paths, struct vect *vec,
|
||||
+ enum opt_F_origin origin);
|
||||
|
||||
/* Vector of struct opt_F_t. */
|
||||
extern struct vect opt_F;
|
||||
diff -rupN a/sysdeps/linux-gnu/hooks.c b/sysdeps/linux-gnu/hooks.c
|
||||
--- a/sysdeps/linux-gnu/hooks.c 2013-11-04 20:08:03.000000000 -0500
|
||||
+++ b/sysdeps/linux-gnu/hooks.c 2019-06-28 17:18:55.989632238 -0400
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ltrace.
|
||||
- * Copyright (C) 2012, 2013 Petr Machata
|
||||
+ * Copyright (C) 2012, 2013, 2015 Petr Machata
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
@@ -153,7 +153,7 @@ again:
|
||||
if (xdg_sys != NULL) {
|
||||
struct vect v;
|
||||
VECT_INIT(&v, struct opt_F_t);
|
||||
- if (parse_colon_separated_list(xdg_sys, &v) < 0
|
||||
+ if (parse_colon_separated_list(xdg_sys, &v, OPT_F_ENVIRON) < 0
|
||||
|| VECT_EACH(&v, struct opt_F_t, NULL,
|
||||
add_dir_component_cb, &dirs) != NULL)
|
||||
fprintf(stderr,
|
||||
diff -rupN a/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp b/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp
|
||||
--- a/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ b/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp 2019-06-28 17:18:55.989632238 -0400
|
||||
@@ -0,0 +1,35 @@
|
||||
+# This file is part of ltrace.
|
||||
+# Copyright (C) 2015 Petr Machata, Red Hat Inc.
|
||||
+#
|
||||
+# 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
|
||||
+
|
||||
+set bin [ltraceCompile {} [ltraceSource c {
|
||||
+ int main() { return 0; }
|
||||
+}]]
|
||||
+
|
||||
+setenv XDG_CONFIG_DIRS "blah"
|
||||
+ltraceRun -L -- $bin
|
||||
+unsetenv XDG_CONFIG_DIRS
|
||||
+
|
||||
+if {[catch "exec $LTRACE -L -F blah -- $bin" output]} {
|
||||
+ ltraceMatch [ltraceSource ltrace "$output"] {
|
||||
+ {blah == 1}
|
||||
+ }
|
||||
+} else {
|
||||
+ fail "expected error message regarding `blah`"
|
||||
+}
|
||||
+
|
||||
+ltraceDone
|
@ -1,24 +0,0 @@
|
||||
Index: ltrace-0.7.91/sysdeps/linux-gnu/aarch64/regs.c
|
||||
===================================================================
|
||||
--- ltrace-0.7.91.orig/sysdeps/linux-gnu/aarch64/regs.c
|
||||
+++ ltrace-0.7.91/sysdeps/linux-gnu/aarch64/regs.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <linux/uio.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
#include "backend.h"
|
||||
#include "proc.h"
|
||||
Index: ltrace-0.7.91/sysdeps/linux-gnu/aarch64/trace.c
|
||||
===================================================================
|
||||
--- ltrace-0.7.91.orig/sysdeps/linux-gnu/aarch64/trace.c
|
||||
+++ ltrace-0.7.91/sysdeps/linux-gnu/aarch64/trace.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <asm/ptrace.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
#include "backend.h"
|
||||
#include "proc.h"
|
@ -1,14 +0,0 @@
|
||||
diff --git a/output.c b/output.c
|
||||
index 7cab383..18f9cf0 100644
|
||||
--- a/output.c
|
||||
+++ b/output.c
|
||||
@@ -598,6 +598,9 @@ frame_callback (Dwfl_Frame *state, void *arg)
|
||||
NULL, NULL, NULL);
|
||||
symname = dwfl_module_addrinfo(mod, pc, &off, &sym,
|
||||
NULL, NULL, NULL);
|
||||
+ } else {
|
||||
+ modname = "unknown";
|
||||
+ symname = "unknown";
|
||||
}
|
||||
|
||||
/* This mimics the output produced by libunwind below. */
|
@ -1,20 +0,0 @@
|
||||
diff -rup a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c
|
||||
--- a/sysdeps/linux-gnu/ppc/trace.c 2021-02-08 14:35:16.876494095 -0500
|
||||
+++ b/sysdeps/linux-gnu/ppc/trace.c 2021-02-08 15:05:59.468107311 -0500
|
||||
@@ -57,6 +57,7 @@ get_arch_dep(struct process *proc)
|
||||
}
|
||||
|
||||
#define SYSCALL_INSN 0x44000002
|
||||
+#define SYSCALL2_INSN 0x44000001
|
||||
|
||||
/* Returns 1 if syscall, 2 if sysret, 0 otherwise. */
|
||||
int
|
||||
@@ -75,7 +76,7 @@ syscall_p(struct process *proc, int stat
|
||||
0);
|
||||
#endif
|
||||
|
||||
- if (insn == SYSCALL_INSN) {
|
||||
+ if (insn == SYSCALL_INSN || insn == SYSCALL2_INSN) {
|
||||
*sysnum =
|
||||
(int)ptrace(PTRACE_PEEKUSER, proc->pid,
|
||||
sizeof(long) * PT_R0, 0);
|
@ -1,16 +0,0 @@
|
||||
diff -rup a/expr.c b/expr.c
|
||||
--- a/expr.c 2013-10-10 08:43:55.000000000 -0400
|
||||
+++ b/expr.c 2020-02-06 17:05:40.658679755 -0500
|
||||
@@ -189,10 +189,10 @@ int
|
||||
expr_clone(struct expr_node *retp, const struct expr_node *node)
|
||||
{
|
||||
*retp = *node;
|
||||
+ struct expr_node *nlhs;
|
||||
+ struct expr_node *nrhs = NULL;
|
||||
|
||||
switch (node->kind) {
|
||||
- struct expr_node *nlhs;
|
||||
- struct expr_node *nrhs;
|
||||
|
||||
case EXPR_OP_ARGNO:
|
||||
case EXPR_OP_SELF:
|
@ -1,68 +0,0 @@
|
||||
diff -rup a/testsuite/Makefile.am b/testsuite/Makefile.am
|
||||
--- a/testsuite/Makefile.am 2012-12-16 20:53:45.000000000 -0500
|
||||
+++ b/testsuite/Makefile.am 2019-06-28 16:59:19.935602953 -0400
|
||||
@@ -39,6 +39,7 @@ env.exp: Makefile
|
||||
rm -f env.exp
|
||||
echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
|
||||
echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
|
||||
+ echo set PREFIX '"$(prefix)"' >> $@
|
||||
|
||||
CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp
|
||||
|
||||
diff -rup a/testsuite/Makefile.in b/testsuite/Makefile.in
|
||||
--- a/testsuite/Makefile.in 2013-11-04 20:22:47.000000000 -0500
|
||||
+++ b/testsuite/Makefile.in 2019-06-28 16:59:12.075602806 -0400
|
||||
@@ -648,6 +648,7 @@ env.exp: Makefile
|
||||
rm -f env.exp
|
||||
echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
|
||||
echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
|
||||
+ echo set PREFIX '"$(prefix)"' >> $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
diff -rup a/testsuite/ltrace.main/system_call_params.exp b/testsuite/ltrace.main/system_call_params.exp
|
||||
--- a/testsuite/ltrace.main/system_call_params.exp 2019-06-28 16:44:07.542584754 -0400
|
||||
+++ b/testsuite/ltrace.main/system_call_params.exp 2019-06-28 17:00:35.811604355 -0400
|
||||
@@ -1,5 +1,5 @@
|
||||
# This file is part of ltrace.
|
||||
-# Copyright (C) 2013, 2014 Petr Machata, Red Hat Inc.
|
||||
+# Copyright (C) 2013, 2014, 2015 Petr Machata, Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
@@ -60,8 +60,35 @@ set conf [ltraceNamedSource "$dir/syscal
|
||||
# somelib.conf is passed, and syscalls.conf is not available, or
|
||||
# doesn't list readdir, that would be taken from somelib.conf with a
|
||||
# wrong prototype.
|
||||
+#
|
||||
+# This test relies on the fact that there is no global config file
|
||||
+# that would provide legitimate system call prototypes. But that
|
||||
+# doesn't have to be true, maybe ltrace is already installed on the
|
||||
+# system with the right prefix. So first compile a wrapper that we
|
||||
+# use to redirect fopen calls.
|
||||
+
|
||||
+set libfopen_so [ltraceCompile libfopen.so -ldl \
|
||||
+ [ltraceSource c [string map [list "@PREFIX@" "$PREFIX"] {
|
||||
+ #define _GNU_SOURCE
|
||||
+ #include <dlfcn.h>
|
||||
+ #include <stdio.h>
|
||||
+ #include <string.h>
|
||||
+
|
||||
+ FILE *
|
||||
+ fopen(const char *path, const char *mode)
|
||||
+ {
|
||||
+ #define PATH "@PREFIX@/share"
|
||||
+ if (strncmp(path, PATH, sizeof(PATH) - 1) == 0)
|
||||
+ path = "/dev/null";
|
||||
|
||||
+ return ((FILE *(*)(const char *, const char *))
|
||||
+ dlsym(RTLD_NEXT, "fopen")) (path, mode);
|
||||
+ }
|
||||
+}]]]
|
||||
+
|
||||
+setenv LD_PRELOAD $libfopen_so
|
||||
ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^open@SYS\("/some/path", 0\)} == 0
|
||||
+unsetenv LD_PRELOAD
|
||||
|
||||
# On the other hand, if -F somedir/ is given, we want to accept
|
||||
# syscalls.conf found there.
|
@ -1,12 +0,0 @@
|
||||
diff -Nrup a/testsuite/ltrace.minor/trace-irelative.exp b/testsuite/ltrace.minor/trace-irelative.exp
|
||||
--- a/testsuite/ltrace.minor/trace-irelative.exp 2013-11-04 18:08:03.000000000 -0700
|
||||
+++ b/testsuite/ltrace.minor/trace-irelative.exp 2015-06-01 12:30:59.737371166 -0600
|
||||
@@ -54,6 +54,8 @@ set src [ltraceSource c {
|
||||
}]
|
||||
|
||||
foreach ext {{} .pie} {
|
||||
+ # ltrace does not yet support AARCH64's ifuncs
|
||||
+ setup_xfail aarch64*-*-*
|
||||
set bin1 [ltraceCompile $ext $src]
|
||||
do_tests $bin1 ""
|
||||
}
|
Loading…
Reference in new issue