From: Eric Bambach <eric@cisu.net>
To: linux prg <linux-c-programming@vger.kernel.org>
Subject: Re: strace write/read output
Date: Tue, 22 Mar 2005 20:17:21 -0600 [thread overview]
Message-ID: <200503222017.21879.eric@cisu.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0503221215250.31636@ns.isi.ulatina.ac.cr>
(forgot to cc the list)
On Tuesday 22 March 2005 12:16 pm, you wrote:
> > On Tuesday 22 March 2005 11:05 am, Fabio Miranda Hamburger wrote:
> > > hello,
> > >
> > > I am debugging a tcpip app on linux, I would like to use strace to show
> > > me *all* the data passed to read() and write() function to the sockets
> > > stream.
> > >
> > > thanks,
> >
> > Does strace with the -e option do what you want? man strace. It
> > seems to do read and write. Prepare for big logfiles ;)
>
> I was trying to figure out how to do it. Can you provide an example?
> Usually strace shows few characters and at the end, the total length of
> what was received. Well, I need the entire string of characters.
Here is a quick and dirty example on a small text file. Notice I dont know
what fd's cat uses so I just guessed 1-5. Below is the output of the example
too. It outputs the ENTIRE file that was read in hex and ascii you just have
to know what file desciptors you want to trace. To trace write calls this way
just change -e read=1,2,3,4,5 to -e write=1,2,3,4,5 or you could even use
them together.
command:
strace -e read=1,2,3,4,5 -o file.log cat unison.log
Outputs this to file.log (truncated for sake of the mailer and example):
read(3, "Fatal error: Lost connection wit"..., 131072) = 270
46 61 74 61 6c 20 65 72 72 6f 72 3a 20 4c 6f 73 Fatal er ror: Los |
74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 77 69 74 t connec tion wit |
68 20 74 68 65 20 73 65 72 76 65 72 0a 46 61 74 h the se rver.Fat |
61 6c 20 65 72 72 6f 72 3a 20 4c 6f 73 74 20 63 al error : Lost c |
6f 6e 6e 65 63 74 69 6f 6e 20 77 69 74 68 20 74 onnectio n with t |
68 65 20 73 65 72 76 65 72 0a 46 61 74 61 6c 20 he serve r.Fatal |
65 72 72 6f 72 3a 20 4c 6f 73 74 20 63 6f 6e 6e error: L ost conn |
65 63 74 69 6f 6e 20 77 69 74 68 20 74 68 65 20 ection w ith the |
73 65 72 76 65 72 0a 46 61 74 61 6c 20 65 72 72 server.F atal err |
6f 72 3a 20 4c 6f 73 74 20 63 6f 6e 6e 65 63 74 or: Lost connect |
69 6f 6e 20 77 69 74 68 20 74 68 65 20 73 65 72 ion with the ser |
76 65 72 0a 46 61 74 61 6c 20 65 72 72 6f 72 3a ver.Fata l error: |
20 4c 6f 73 74 20 63 6f 6e 6e 65 63 74 69 6f 6e Lost co nnection |
20 77 69 74 68 20 74 68 65 20 73 65 72 76 65 72 with th e server |
0a 46 61 74 61 6c 20 65 72 72 6f 72 3a 20 4c 6f .Fatal e rror: Lo |
73 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 77 69 st conne ction wi |
74 68 20 74 68 65 20 73 65 72 76 65 72 0a th the s erver. |
--
----------------------------------------
--EB
> All is fine except that I can reliably "oops" it simply by trying to read
> from /proc/apm (e.g. cat /proc/apm).
> oops output and ksymoops-2.3.4 output is attached.
> Is there anything else I can contribute?
The latitude and longtitude of the bios writers current position, and
a ballistic missile.
--Alan Cox LKML-December 08,2000
----------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2005-03-23 2:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-22 17:05 strace write/read output Fabio Miranda Hamburger
2005-03-22 19:05 ` Eric Bambach
2005-03-22 18:16 ` Fabio Miranda Hamburger
2005-03-23 2:17 ` Eric Bambach [this message]
2005-03-23 17:34 ` Rechberger Markus
2005-04-04 14:32 ` Array Empty Slots Chris
2005-04-05 8:39 ` M.Baris Demiray
2005-04-05 9:06 ` Chris
2005-04-05 15:03 ` M.Baris Demiray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200503222017.21879.eric@cisu.net \
--to=eric@cisu.net \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).