platform/upstream/ltrace.git
9 years agotypes defined in .conf files now take precedence over DWARF types
Dima Kogan [Wed, 23 Apr 2014 22:54:49 +0000 (15:54 -0700)]
types defined in .conf files now take precedence over DWARF types

9 years agostyle whitespace
Dima Kogan [Wed, 23 Apr 2014 22:45:40 +0000 (15:45 -0700)]
style whitespace

9 years agoimport_DWARF_prototypes() now takes JUST a lib argument
Dima Kogan [Wed, 23 Apr 2014 10:41:55 +0000 (03:41 -0700)]
import_DWARF_prototypes() now takes JUST a lib argument

9 years agomoved DWARF prototype reading to library_get_prototype()
Dima Kogan [Wed, 23 Apr 2014 10:01:20 +0000 (03:01 -0700)]
moved DWARF prototype reading to library_get_prototype()

9 years agoupdated error message to reflect the new dwfl use case
Dima Kogan [Wed, 23 Apr 2014 09:43:21 +0000 (02:43 -0700)]
updated error message to reflect the new dwfl use case

9 years agowhitespace
Dima Kogan [Wed, 23 Apr 2014 09:42:58 +0000 (02:42 -0700)]
whitespace

9 years agoStylistic refactoring. No functional changes
Dima Kogan [Wed, 23 Apr 2014 07:47:52 +0000 (00:47 -0700)]
Stylistic refactoring. No functional changes

9 years agoI now import functions using their linkage name
Dima Kogan [Wed, 23 Apr 2014 07:06:45 +0000 (00:06 -0700)]
I now import functions using their linkage name

This is required for C++ methods

9 years agoenums are no longer assumed to have type 'int'
Dima Kogan [Wed, 23 Apr 2014 07:02:34 +0000 (00:02 -0700)]
enums are no longer assumed to have type 'int'

9 years agoreworked attr_numeric() to report failures
Dima Kogan [Tue, 22 Apr 2014 23:22:08 +0000 (16:22 -0700)]
reworked attr_numeric() to report failures

This whole file is thus copyright me

9 years agoadded a disabled stub for complex float support
Dima Kogan [Tue, 22 Apr 2014 22:15:55 +0000 (15:15 -0700)]
added a disabled stub for complex float support

9 years agoa bit more debug printing
Dima Kogan [Tue, 22 Apr 2014 22:15:27 +0000 (15:15 -0700)]
a bit more debug printing

9 years agostyle changes
Dima Kogan [Tue, 22 Apr 2014 20:21:32 +0000 (13:21 -0700)]
style changes

- no spaces in ()
- hanging braces
- no camelCase
- collapsed long lines

9 years agodebug-printing via complain()
Dima Kogan [Tue, 22 Apr 2014 19:58:13 +0000 (12:58 -0700)]
debug-printing via complain()

9 years agoadded explicit support for some more types
Dima Kogan [Tue, 22 Apr 2014 19:57:03 +0000 (12:57 -0700)]
added explicit support for some more types

- boolean constant
- long long double (as void)
- variable-length array (assuming len 0)
- union (as void)
- empty compile units

9 years agoadded some optional debug printing
Dima Kogan [Tue, 22 Apr 2014 11:20:32 +0000 (04:20 -0700)]
added some optional debug printing

9 years agotree dumping goes to stderr
Dima Kogan [Tue, 22 Apr 2014 11:19:25 +0000 (04:19 -0700)]
tree dumping goes to stderr

9 years agoinitial prototypes-from-dwarf implementation
Dima Kogan [Sat, 12 Apr 2014 03:39:34 +0000 (20:39 -0700)]
initial prototypes-from-dwarf implementation

9 years agofixed typo: toplevel_format_lens() now uses ptr data when talking about pointers
Dima Kogan [Sun, 13 Apr 2014 04:59:26 +0000 (21:59 -0700)]
fixed typo: toplevel_format_lens() now uses ptr data when talking about pointers

9 years agoFix lookup of prototypes from non-leader threads
Petr Machata [Tue, 6 May 2014 10:53:03 +0000 (12:53 +0200)]
Fix lookup of prototypes from non-leader threads

9 years agoAdd a couple TODO items
Petr Machata [Tue, 6 May 2014 10:23:54 +0000 (12:23 +0200)]
Add a couple TODO items

9 years agoImprove wording on -e, -x, -l in ltrace.1
Petr Machata [Mon, 28 Apr 2014 09:50:49 +0000 (11:50 +0200)]
Improve wording on -e, -x, -l in ltrace.1

9 years agoAdd missing #include stdio.h
dann frazier [Wed, 12 Mar 2014 21:57:23 +0000 (15:57 -0600)]
Add missing #include stdio.h

Include stdio.h in files that use fprintf()

Signed-off-by: dann frazier <dannf@debian.org>
9 years agoadd missing <stdint.h> include
dann frazier [Wed, 12 Mar 2014 21:51:44 +0000 (15:51 -0600)]
add missing <stdint.h> include

aarch64's fetch.c uses the uintptr_t typedef defined by stdint.h without
including it. This doesn't currently cause a build failure because stdint.h
is indirectly included via proc.h.

Signed-off-by: dann frazier <dannf@debian.org>
9 years agoAdd --config to man, drop -X from options.c
Petr Machata [Fri, 28 Feb 2014 11:37:15 +0000 (12:37 +0100)]
Add --config to man, drop -X from options.c

9 years agoInitialize struct process.e_machine and .e_class for secondary threads
Petr Machata [Thu, 13 Feb 2014 15:02:50 +0000 (16:02 +0100)]
Initialize struct process.e_machine and .e_class for secondary threads

9 years agoAdd some stuff to libc.so.conf
Petr Machata [Wed, 5 Feb 2014 02:31:07 +0000 (21:31 -0500)]
Add some stuff to libc.so.conf

9 years agoUpdate NEWS, README
Petr Machata [Wed, 5 Feb 2014 01:46:07 +0000 (02:46 +0100)]
Update NEWS, README

9 years agoImplement aarch64 support
Petr Machata [Thu, 23 Jan 2014 23:50:06 +0000 (00:50 +0100)]
Implement aarch64 support

- IFUNC support is not implemented, the rest works well.  The only
  other failure is in wide char functions, and that occurs on x86_64
  as well.

9 years agoSet child stack alignment in trace-clone.c
Petr Machata [Wed, 5 Feb 2014 00:57:50 +0000 (19:57 -0500)]
Set child stack alignment in trace-clone.c

- This is important on aarch64, which requires 16-byte aligned
  stack pointer.  This might be relevant on other arches as well,
  I suspect we just happened to get the 16-byte boundary in some
  cases.

9 years agoForce use of SYS_open on aarch64 as well
Petr Machata [Fri, 31 Jan 2014 00:42:16 +0000 (19:42 -0500)]
Force use of SYS_open on aarch64 as well

- That system call is not implemented on aarch64, but we don't
  care, we are only calling it to see if the parameters get decoded
  properly.  So call using the "syscall" wrapper, and hard-code
  SYS_open value on aarch64, where glibc doesn't define it.

9 years agoRewrite system_calls.exp
Petr Machata [Fri, 31 Jan 2014 00:37:26 +0000 (19:37 -0500)]
Rewrite system_calls.exp

- Port this to new style test case

- Be more clever about what syscalls were invoked from main,
  as opposed to the multitude of calls that the dynamic linker
  typically makes

- Allow some basic calls to come in XXXat variants (e.g. openat
  instead of open), such is the case on aarch64.

9 years agoAdd some missing system calls to syscalls.conf
Petr Machata [Fri, 31 Jan 2014 00:35:56 +0000 (19:35 -0500)]
Add some missing system calls to syscalls.conf

9 years agoImprove HFA-related test cases
Petr Machata [Wed, 5 Feb 2014 01:03:14 +0000 (02:03 +0100)]
Improve HFA-related test cases

- Moved a bunch of preexisting HFA tests to a separate test case (and
  converted them to new style in the process).  Added another bunch of
  HFA tests.

9 years agoManpage and --help clarifications
Petr Machata [Tue, 14 Jan 2014 15:01:35 +0000 (16:01 +0100)]
Manpage and --help clarifications

9 years agoDon't crash untraced calls via PLT in prelinked PPC64 binaries
Petr Machata [Fri, 10 Jan 2014 19:06:51 +0000 (20:06 +0100)]
Don't crash untraced calls via PLT in prelinked PPC64 binaries

In prelinked binaries, ltrace has to unprelinks PLT slots in order to
catch calls done through PLT.  This makes the calls done through these
slots invalid, because the special first PLT slot is not initialized,
and dynamic linker SIGSEGVs because of this.  Ltrace relies on
arranging breakpoints such that the dynamic linker is not actually
entered, and moves PC around itself to simulate the effects of a call
through PLT.

Originally, arch_elf_add_plt_entry was called only for symbols that
were actually traced.  Later this was changed and it's now called for
all PLT entries, and the resulting candidate list is filtered
afterwards.  This gives backends a chance to rename the symbol, as is
useful with IRELATIVE PLT calls, where symbol name may not be
available at all.  But the PPC backend was never updated to reflect
this, and unresolved all symbols for which arch_elf_add_plt_entry was
called, thus rendering _all_ PLT slots invalid, even those that
weren't later procted by breakpoints.  Thus calls done through any
untraced slots failed.

This patch fixes this problem by deferring the unprelinking of PLT
slots into the on_install hook of breakpoints.

9 years agoAdd a new per-breakpoint callback on_install
Petr Machata [Fri, 10 Jan 2014 19:05:15 +0000 (20:05 +0100)]
Add a new per-breakpoint callback on_install

9 years agoDrop unused function enable_all_breakpoints
Petr Machata [Fri, 10 Jan 2014 19:02:58 +0000 (20:02 +0100)]
Drop unused function enable_all_breakpoints

9 years agoType umovebytes properly
Petr Machata [Fri, 10 Jan 2014 19:02:12 +0000 (20:02 +0100)]
Type umovebytes properly

9 years agoInitialize libsym early in trace.c to help the compiler.
Mark Wielaard [Thu, 9 Jan 2014 21:56:35 +0000 (22:56 +0100)]
Initialize libsym early in trace.c to help the compiler.

GCC 4.4.7 isn't smart enough to realize own_libsym will always be zero
when it sees the goto done which might jump over the initialization of
libsym. And so will produce a warning like:

cc1: warnings being treated as errors
trace.c: In function ‘ifunc_ret_hit’:
trace.c:1433: error: ‘libsym’ may be used uninitialized in this function

9 years agoAdd support for using elfutils as unwinder.
Mark Wielaard [Tue, 7 Jan 2014 20:00:44 +0000 (21:00 +0100)]
Add support for using elfutils as unwinder.

This adds support for using elfutils as unwinder with -w. Since elfutils
0.158 elfutils contains a simple unwinder interface that matches nicely
on the ltrace backtrace support.

The code reuses the libunwind infrastructure already in ltrace where
possible (by defining HAVE_UNWINDER which is 1 if either libunwind or
elfutils is used). It also reuses the ltrace proc_add_library callback
to keep track of the ELF files mapped for the unwinder.

The current implementation matches the output as if libunwind was used.
But elfutils can also provide some more information since it can lookup
the DWARF debuginfo. So if the source info of an address can be found
through elfutils the backtrace will also include this as an additional
output line per frame.

9 years agoType proc_each_breakpoint properly
Petr Machata [Thu, 9 Jan 2014 22:50:07 +0000 (23:50 +0100)]
Type proc_each_breakpoint properly

9 years agoFix a problem in tracing across fork on PPC64
Petr Machata [Thu, 9 Jan 2014 22:41:50 +0000 (23:41 +0100)]
Fix a problem in tracing across fork on PPC64

In order to avoid single-stepping through large portions of the
dynamic linker, ltrace remembers at which address the instruction that
resolved a PLT slot is.  It then puts a breakpoint to this address so
that it can fast-forward to that address next time it needs to catch a
PLT slot being resolved.

When a process is cloned, the pointer to this breakpoint is simply
copied over to the new process, instead of being looked up in the new
process structures.  This patches fixes this.

9 years agominor fixes in manpages
Juan Cespedes [Thu, 9 Jan 2014 11:18:46 +0000 (12:18 +0100)]
minor fixes in manpages

9 years agoNits
Petr Machata [Tue, 7 Jan 2014 10:57:36 +0000 (11:57 +0100)]
Nits

- Fix some coding style issues in output.c
- Add a couple items to TODO

9 years agoFix infinite loop in stack unwind
Luca Clementi [Tue, 7 Jan 2014 08:00:59 +0000 (00:00 -0800)]
Fix infinite loop in stack unwind

This bug was introduced in af452c6

Reported-by: Petr Machata <pmachata@redhat.com>
9 years agoMinor fixes in manpages
Juan Cespedes [Sun, 5 Jan 2014 16:24:50 +0000 (17:24 +0100)]
Minor fixes in manpages

9 years agocheck return value of unw_get_reg and unw_get_proc_name
Luca Clementi [Sat, 4 Jan 2014 06:05:03 +0000 (22:05 -0800)]
check return value of unw_get_reg and unw_get_proc_name

Before printng the current procedure name and IP verify their validity

9 years agoDrop debian/ directory
Juan Cespedes [Mon, 30 Dec 2013 16:01:12 +0000 (17:01 +0100)]
Drop debian/ directory

Every distribution should create its own specific files

9 years agoSupport IRELATIVE relocations on s390
Petr Machata [Wed, 27 Nov 2013 13:26:13 +0000 (14:26 +0100)]
Support IRELATIVE relocations on s390

9 years agoOn s390{,x}, r2 is scrambled after syscall entry
Petr Machata [Tue, 26 Nov 2013 23:42:51 +0000 (00:42 +0100)]
On s390{,x}, r2 is scrambled after syscall entry

This was caught by system_call_params.exp test case:

   exe->mount("source", "target", "filesystemtype", 0, nil <unfinished ...>
   mount@SYS("", "target", "filesystemtype", 0, nil)                 = -2
   <... mount resumed>                                               = -1

Note how the first parameter disappears--r2 now holds syscall number
(21 in this case), and the original value is stored in orig_gpr2 in
save area.

9 years agoOn x86{,_64}, PLT entries may not be ordered by their relocation
Petr Machata [Fri, 22 Nov 2013 17:26:24 +0000 (18:26 +0100)]
On x86{,_64}, PLT entries may not be ordered by their relocation

- In general they are.  But IRELATIVE relocations are sorted to come
  last, and PLT entries are not sorted accordingly.

9 years agoConsider exec and exit events an end of outstanding calls
Petr Machata [Thu, 21 Nov 2013 19:43:51 +0000 (20:43 +0100)]
Consider exec and exit events an end of outstanding calls

- This cleans up a lot of stuff.  The actual substance is addition of
  account_current_callstack in handle_event.c (which however uses
  those cleaned-up interfaces).

- trace-exec.exp was extended to check that the exec syscall can be
  seen in -c output.  That's one of the symptoms of what this fixes.

- This hides dict_opt_c in summary.c.  It also gets rid of the global
  variable current_time_spent--instead, the information is passed via
  a function argument in a struct timedelta (so that we never confuse
  absolute time with relative).  callstack_element.time_spent was renamed
  to .enter_time, as that is what it has always been.

9 years agoUpdate NEWS
Petr Machata [Thu, 14 Nov 2013 21:53:51 +0000 (22:53 +0100)]
Update NEWS

9 years agoAdd a test case for wide character functions
Petr Machata [Tue, 12 Nov 2013 23:11:24 +0000 (00:11 +0100)]
Add a test case for wide character functions

9 years agoUpdate NEWS
Petr Machata [Mon, 11 Nov 2013 23:14:23 +0000 (00:14 +0100)]
Update NEWS

9 years agoIn read_config_file.c, clone type info when unsharing it
Petr Machata [Mon, 11 Nov 2013 18:33:56 +0000 (19:33 +0100)]
In read_config_file.c, clone type info when unsharing it

9 years agoCleanups
Petr Machata [Mon, 11 Nov 2013 18:33:37 +0000 (19:33 +0100)]
Cleanups

9 years agoAdd many wide cheracter functions to libc.so.conf
Petr Machata [Mon, 11 Nov 2013 16:06:59 +0000 (17:06 +0100)]
Add many wide cheracter functions to libc.so.conf

9 years agoUse wcwidth to exactly determine how much space a character took
Petr Machata [Mon, 11 Nov 2013 15:08:42 +0000 (16:08 +0100)]
Use wcwidth to exactly determine how much space a character took

- So far we assumed it's one character worth of screen real-estaty per
  character written, but combining and wide characters can change
  this.

9 years agoAdd fdopen prototype to libc.so.conf
Petr Machata [Mon, 11 Nov 2013 01:29:40 +0000 (02:29 +0100)]
Add fdopen prototype to libc.so.conf

9 years agoWhen a typedef X_t is requested, don't match lens named X instead
Petr Machata [Mon, 11 Nov 2013 01:28:01 +0000 (02:28 +0100)]
When a typedef X_t is requested, don't match lens named X instead

9 years agoAdd error message if ltelf_init fails to open ELF
Petr Machata [Mon, 11 Nov 2013 01:27:33 +0000 (02:27 +0100)]
Add error message if ltelf_init fails to open ELF

9 years agoIn ltrace_init, don't call ltelf_destroy if ltelf_init fails
Petr Machata [Mon, 11 Nov 2013 01:27:08 +0000 (02:27 +0100)]
In ltrace_init, don't call ltelf_destroy if ltelf_init fails

9 years agoSupport wide character strings
Petr Machata [Mon, 11 Nov 2013 01:24:42 +0000 (02:24 +0100)]
Support wide character strings

- "string" lens and "format" pack were extended such that using an
  integer as underlying array type denotes a wide character string.

- several prototypes from wchar.h were added to libc.so.conf.

- ltrace.conf.5 was updated

9 years agoAdd a TODO item
Petr Machata [Wed, 6 Nov 2013 17:35:56 +0000 (18:35 +0100)]
Add a TODO item

9 years agoSupport pre-8.5 TCL's by providing our own lreverse in ltrace.exp
Petr Machata [Wed, 6 Nov 2013 11:10:18 +0000 (12:10 +0100)]
Support pre-8.5 TCL's by providing our own lreverse in ltrace.exp

9 years agoReplace a chain of stpcpy's with a sprintf
Petr Machata [Wed, 6 Nov 2013 10:59:59 +0000 (11:59 +0100)]
Replace a chain of stpcpy's with a sprintf

- That's clearer and doesn't require _POSIX_SOURCE defines (that are
  missing anyway)

9 years agoPlug a leak
Petr Machata [Wed, 6 Nov 2013 10:17:12 +0000 (11:17 +0100)]
Plug a leak

9 years agoPlug a leak
Petr Machata [Wed, 6 Nov 2013 10:16:41 +0000 (11:16 +0100)]
Plug a leak

9 years agoFix use-after-free
Petr Machata [Wed, 6 Nov 2013 09:14:23 +0000 (10:14 +0100)]
Fix use-after-free

9 years agoFix compilation on ARM
Petr Machata [Tue, 5 Nov 2013 03:50:11 +0000 (22:50 -0500)]
Fix compilation on ARM

- This was broken several commits back by removing pltrel from
  struct ltelf.

9 years agoIn ARM backend, move hooks for ltrace_elf and library to plt.c
Petr Machata [Tue, 5 Nov 2013 03:48:38 +0000 (22:48 -0500)]
In ARM backend, move hooks for ltrace_elf and library to plt.c

- That's the customary location for backend hooks.

9 years agoMove load_dynamic_entry from PPC backend to ltrace-elf.c/.h
Petr Machata [Tue, 5 Nov 2013 03:45:34 +0000 (22:45 -0500)]
Move load_dynamic_entry from PPC backend to ltrace-elf.c/.h

9 years agoAdd trace-irelative.exp to Makefile.am
Petr Machata [Tue, 5 Nov 2013 03:00:51 +0000 (04:00 +0100)]
Add trace-irelative.exp to Makefile.am

9 years agoUpdate TODO
Petr Machata [Tue, 5 Nov 2013 01:21:18 +0000 (02:21 +0100)]
Update TODO

9 years agoImported Upstream version 0.7.91 upstream upstream/0.7.91
Chanho Park [Fri, 22 Aug 2014 11:34:56 +0000 (20:34 +0900)]
Imported Upstream version 0.7.91

11 years agoImported Upstream version 0.7.2 upstream/0.7.2
Anas Nashif [Tue, 15 Jan 2013 16:32:18 +0000 (08:32 -0800)]
Imported Upstream version 0.7.2

11 years agoImported Upstream version 0.5.3 upstream/0.5.3
Anas Nashif [Tue, 13 Nov 2012 15:28:12 +0000 (07:28 -0800)]
Imported Upstream version 0.5.3