25

I know the -s option should display longer arguments, but it doesn't work always (probably because of those curly brackets meaning array or nested arguments?).

Even after running strace -s1000 my_command this argument is still truncated:

ioctl(3, SNDCTL_TMR_TEMPO or TCGETA, {B9600 -opost -isig -icanon -echo ...}) = 0

How can I see the complete arguments?

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Marki555
  • 6,434
  • 3
  • 37
  • 59

4 Answers4

27

There is such option in the strace parameters - you should use -v command line switch. Furthermore, due to the opensource nature of this great utility, you can disable abbreviation totally by patching the defs.h header in the strace sources:

< #define abbrev(tcp)   ((tcp)->qual_flg & QUAL_ABBREV)
---
> #define abbrev(tcp)   0

I've patched that way strace-4.9 from my local gentoo /usr/portage/distfiles/ software sources storage. It doesn't require to download latest strace sources from sourceforge.

Vladimir Kunschikov
  • 1,735
  • 1
  • 16
  • 16
  • 2
    `-v` argument works as of 4.15 and seems to have been there since the creation time of the Git repo. – aitap Nov 16 '17 at 14:00
  • I wonder why it wasn't noted at that times. This option should work indeed. May be it wasn't noted because of the strace logging itself, judging by code there is being used some bitfield and macroses, which are checking presence of some bits; so it was a way simpler to clear this check totally. – Vladimir Kunschikov Nov 20 '17 at 09:54
  • Shame that as of `strace` 4.11 `-v` does not obey `-s` maximum line length and wraps around in my terminal. – Ciro Santilli OurBigBook.com Aug 15 '18 at 14:52
7

To verbosely describe what Vladimir Kunschikov said - run the following commands:

  1. git clone git://git.code.sf.net/p/strace/code strace-code
  2. cd strace-code
  3. Modify the part of defs.h file as described by Vladimir Kunschikov.
  4. ./bootstrap
  5. ./configure
  6. make
  7. make install

The modified version of strace should have been installed in /usr/local/bin/strace. Now, run the strace using a large value for the -s option. Example:

strace -s 65536 command_to_run_goes_here

Sources:

  1. Vladimir Kunschikov's answer.
  2. https://github.com/strace/strace/issues/2
Utku
  • 2,025
  • 22
  • 42
2

According to the manual and the source, the -v option should help you with large structures.

aitap
  • 325
  • 1
  • 9
0

Here it is not length problem.

./term.c:                       tprintf(" %sopost %sisig %sicanon %secho ...}",

You can add here more flags if you want. The flags are defined in /usr/include/asm-generic/termbits.h

Gábor
  • 371
  • 3
  • 8