<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Hi Tanu,<br><div class="moz-cite-prefix">
<br>
On 05/21/2013 12:15 AM, Tanu Kaskinen wrote:<br>
</div>
<blockquote cite="mid:1369066547.6790.138.camel@dev-laptop" type="cite">
<pre wrap="">On Mon, 2013-05-20 at 17:17 +0800, Shuai Fan wrote:
</pre>
<blockquote type="cite"><pre wrap="">Hi Tanu,
I'm sorry for not replying to your letter sooner.
</pre></blockquote>
<pre wrap="">No problem at all.
</pre>
<blockquote type="cite"><pre wrap="">On 05/14/2013 09:59 PM, Tanu Kaskinen wrote:
</pre><blockquote type="cite"><pre wrap="">On Fri, 2013-05-10 at 17:05 +0800, shuai wrote:
</pre><blockquote type="cite"><pre wrap="">---
src/daemon/daemon-conf.c | 74 ++++++-------------
src/daemon/daemon-conf.h | 2 +-
src/daemon/main.c | 16 +++--
src/pulsecore/cli-command.c | 48 +++++++------
src/pulsecore/log.c | 171 ++++++++++++++++++++++++++++++++------------
src/pulsecore/log.h | 20 ++++--
src/utils/pactl.c | 18 +----
7 files changed, 202 insertions(+), 147 deletions(-)
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 1aa8b0e..a2b9f54 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -48,6 +48,7 @@
</pre></blockquote><pre wrap="">Patch 1/2 added fcntl.h include here. Out of curiosity, what is that
needed for?
</pre></blockquote><pre wrap="">For function open() and file open flags like O_CREAT.
</pre></blockquote>
<pre wrap="">OK, makes sense.
</pre>
<blockquote type="cite"><pre wrap="">Thank you very much for replying me patiently.
I'm sorry for lots of problems in this patch, I tried a new patch these
days after receiving your letter.
Can I ask you some questions, please?
First, can you tell me how to debug large programs, please? Currently, I
use lots of 'printf' to print values in program, but these printfs must
be removed when the "debug" is finished. And it is possible some of them
may not be removed, which is not expected.
</pre></blockquote>
<pre wrap="">"git add -p" can be helpful. It allows you to review each chunk that
will be added to a commit, so debug prints can be easily skipped. The
debug prints will still be available in the working tree, so you don't
have to lose them completely if you don't want to.
</pre>
<blockquote type="cite"><pre wrap="">Also, a large program with
makefile, gdb could not be used(maybe just I don't know how to use it).
</pre></blockquote>
<pre wrap="">I guess the problem is that src/pulseaudio isn't the real executable,
it's a shell script generated by libtool. The real executable is
src/.libs/pulseaudio, and gdb can be used with that. In my workflow I
tend to install pulseaudio always before testing, so I can use just "gdb
pulseaudio", but "gdb src/.libs/pulseaudio" should work from the build
directory also without installing.</pre>
</blockquote>
<br>
I will have a try.<br>
<blockquote cite="mid:1369066547.6790.138.camel@dev-laptop" type="cite">
<pre wrap="">
</pre>
<blockquote type="cite"><pre wrap="">Second, about pulseaudio, when I start the program with command
"src/pulseaudio -n -F src/default.pa -p $(pwd)/src/ -vvvv", Iots of
information prints on the screen, and I want to have a look at all
information, but only the last part could be seen. My desktop is ubuntu,
in terminal, with scrollbar, I could see the last part too.
</pre></blockquote>
<pre wrap="">Sorry, I'm not sure I follow. Is the problem that your terminal doesn't
have big enough buffer? It can be made bigger (at least with
gnome-terminal, which is the default in Ubuntu). Go to Edit -> Profile
Preferences. The Scrolling tab contains settings for the scrollback
buffer size.
</pre>
</blockquote>
<br>
Yes, it is. I edited the profile, and it works.<br>
<br>
<blockquote cite="mid:1369066547.6790.138.camel@dev-laptop" type="cite">
<blockquote type="cite"><pre wrap="">I tried ">"
to prints this information into one file, but failed. I think the reason
is the "pulseaudio" is a server, runs and not stops. So, can you tell me
how to see all information(especially the beginning of this information)
of this kind of program, please? Or only for pulseaudio, how to see all
log information when the program starts.
</pre></blockquote>
<pre wrap="">">" redirects only stdout, but the log is printed to stderr. Use "2>" to
redirect stderr to a file.</pre>
</blockquote>
<br>
It's great. I think it is very useful too.<br>
<br>
<blockquote cite="mid:1369066547.6790.138.camel@dev-laptop" type="cite">
<pre wrap="">
You can of course also use the file: and newfile: log targets to get the
log in a file.
</pre>
</blockquote>
Well, this is a good way too. And I have tried it. But, maybe the first two is better, "gdb" and "2>".<br>
<br>
Thanks very much.<br>
<br>
<br>
Best wishes,<br>
Shuai<br>
</div>