Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show complete arguments in strace even in curly brackets

Tags:

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?

like image 954
Marki555 Avatar asked Dec 19 '15 00:12

Marki555


People also ask

What does strace Show?

With the flag -c, strace displays a summary of the command run instead of each syscall and signals. As we can see from the output, the summary groups the result by syscall.

What is strace in Linux?

strace is a powerful command line tool for debugging and trouble shooting programs in Unix-like operating systems such as Linux. It captures and records all system calls made by a process and the signals received by the process.

How do I redirect a strace output to a file?

8.2. To redirect this output to a file, use the -o command line option followed by the file name: $ scl enable devtoolset-8 'strace -o file_name program argument...'


2 Answers

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
like image 36
Utku Avatar answered Dec 07 '22 23:12

Utku


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.

like image 178
Vladimir Kunschikov Avatar answered Dec 07 '22 23:12

Vladimir Kunschikov