[pulseaudio-discuss] [PATCH 2/2] Improve set-log-target functionality

Shuai Fan shuai900217 at 126.com
Mon May 20 20:47:54 PDT 2013


Hi Tanu,


On 05/21/2013 12:15 AM, Tanu Kaskinen wrote:

On Mon, 2013-05-20 at 17:17 +0800, Shuai Fan wrote:

Hi Tanu,

I'm sorry for not replying to your letter sooner.

No problem at all.


On 05/14/2013 09:59 PM, Tanu Kaskinen wrote:

On Fri, 2013-05-10 at 17:05 +0800, shuai wrote:

---
  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 @@
  

Patch 1/2 added fcntl.h include here. Out of curiosity, what is that
needed for?

For function open() and file open flags like O_CREAT.

OK, makes sense.


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.

"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.


Also, a large program with 
makefile, gdb could not be used(maybe just I don't know how to use it).

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.

I will have a try.

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.

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.


Yes, it is. I edited the profile, and it works.


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.

">" redirects only stdout, but the log is printed to stderr. Use "2>" to
redirect stderr to a file.

It's great. I think it is very useful too.



You can of course also use the file: and newfile: log targets to get the
log in a file.


Well, this is a good way too. And I have tried it. But, maybe the first two is better, "gdb" and "2>".

Thanks very much.


Best wishes,
    Shuai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20130521/85d77c50/attachment.html>


More information about the pulseaudio-discuss mailing list