Posts

Showing posts from August, 2006

一点debug技巧

怎么样打印出一个函数的stack backtrace,也就是函数的调用路径? 可以使用glibc的backtrace()/backtrace_symbols()函数,info在这里 http://www.gnu.org/software/libc/manual/html_mono/libc.html#Backtraces 这里有一段代码,可以拿去用 #include<execinfo.h> int i; void *bt[128]; int bt_size; char **bt_sym; printf("\n########## Backtrace ##########\n"); bt_size = backtrace(bt, sizeof(bt) / sizeof(void *)); printf("Number of elements in backtrace: %d\n", bt_size); bt_sym = backtrace_symbols(bt, bt_size); for (i = 0; i < bt_size; i++) { printf("%s\n", bt_sym[i]); } free(bt_sym); printf("########## Done ##########\n"); 我参考了这个 http://sources.redhat.com/ml/crossgcc/2003-02/msg00013.html 如果不幸是C++程序可以利用c++filt来得到真正的函数原型 这里有段shell代码可以拿去用: sed -e 's/[^(]\+(/c++filt /' -e 's/+0x.*$//g' | xargs -0 sh -c 还有一个gcc内建函数,gcc的扩展,也可能有用,不过只能得到返回地址 http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Return-Address.html#Return-Address

当一个软件的文档与当前实现严重脱节的时候

应该怎么办? 恐怕答案只有一个:RTFS d4rkstar, how should i learn to program using bayonne script language, i am really frustrated also i was :) i adopted a tecnique the sources are always update the documentation often not so i use a text editor and greps the sources for the keywords i need for example search "foreach" in all .cpp files in bayonne directory and subdirectories (i include ccscript and bayonne in my search) so i look at the sources for keyword requirements thank you, may i can follow your way, :) s/may/maybe

Simplify or not to simplify, this is a question.

超级无敌全能forturn-zh脚本: #!/bin/bash # fortune-zh V1.0 # # Copyright (C) 2006 Zhang Le # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA FORTUNE="/usr/bin/fortune" CMD=`basename "$0"` if [ -f "${HOME}"/.fortune-zh.conf ] ; then CONF="${HOME}"/.fortune-zh.conf elif [ -f /etc/fortune-zh.conf ]; then

emake -j1

If you can manually make, but always fail in src_compile(), look at your MAKEOPTS, if it is "-j2", consider using "emake -j1"

I committed bayonne2-1.5.26.ebuild to voip overlay

First of all, thanks to genstef! Two days ago, I was very happy to see that bayonne2 was in voip overlay. After a while I was disappointed, coz I found the version was too old and would not compile sip driver. So I modified the original ebuild to make a ebuild for bayonne2's latest version. Now I have commited it to voip overlay. It was not that easy(well, at least not for a newbie like me). I made a patch for it, otherwise sandbox violation would occur. It is here: http://overlays.gentoo.org/proj/voip/browser/trunk/net-misc/bayonne2/bayonne2-1.5.26.ebuild

nogetch = on in prozilla.conf

If you want to enable parallel-fetch FEATURE and use prozilla as your fetch command, DO remember to enbale nogetch option in prozilla.conf. Otherwise there exists the possibility that you'll be driven mad, :)

I talked to Redhatter on #gentoo-mips about Godson

Wikipedia article about Godson. (zhllg) http://www.lemote.com/lmpc.wmv Linux running on China's Godson CPU (zhllg) Godson's instruction set is compatible with MIPS (redhatter) wmv? * Redhatter points out that Microsoft don't produce a Linux version of Windows Media Player (redhatter) s/don't/doesn't/ rather (zhllg) however, we can play it with mplayer if win32codec USE flag is enabled. (zhllg) btw, i just find that link somewhere else, i am not the publisher (redhatter) we can play it with mplayer on x86 with win32codecs USE flag :-) (redhatter) Those Godson machines _do_ look nice though... pity they're damn hard to get hold of outside of China. (zhllg) i have a dream that one day Gentoo could have Godson support, haha (redhatter) Indeed... although that won't happen unless one of us can get hold of one. (zhllg) Maybe you have known this, http://en.wikinews.org/wiki/Yellow_Sheep_River_develops_%E2%82%AC123_Linux_based_computer (redhatter) Indeed, those are

Compile kernel as a normal user

I just heard this trick from my friend, rae . It is quite easy: make a dir, cd into it cp /boot/config .config (suppose you use "make install" to install kernel, :-D) make -C /usr/src/linux O=$PWD oldconfig , (and optionally make menuconfig to tweak a little bit) make && sudo make modules_install && sudo make install The trick is on step 3, ;) PS: However, there is a problem with this approach. My original intention is to avoid touching the sources in /usr/src/linux and running as root. But in fact, before you emerge kernel modules such as x11-drm, you still have to run 'make modules_prepare' in /usr/src/linux as root. Even I have used this command: sudo env KBUILD_OUTPUT=/home/zhangle/build emerge x11-drm What's worse, the hints given in the output of the above command can't solve the problem: * Found kernel source directory: * /usr/src/linux * Found kernel object directory: * /home/zhangle/build * Found sources for kernel version: *

制作中文可以拷贝的PDF

本来如果严格按照 中文Gentoo wiki 上的 这篇文章 来做的话应该是没有问题的,这篇文章使用的字符集是GBK。 不过我曾经按照及永刚大哥的 一篇文章 配置过UTF-8环境下的teTeX。 前者的主要文件放在/usr/local/share里,后者放在$HOME里。有些文件是重复的,这就有个取舍的问题,到底用的是哪个。 生成可以拷贝中文的pdf要用dvipdfmx,这个都有共识。 可是还要配置两个文件,一个是UGBK.sfd,一个是cid-x.map。 这次就栽在了后一个文件上,没有搞清楚用的是哪个。 我用strace分析了dvipdfmx运行时打开的配置文件,发现dvipdfmx依据的是$HOME里的cid-x.map。 strace dvipdfmx test.dvi 2>&1 | grep cid-x.map 然后我又发现了 FerretL的 这篇文章 ,原来有个命令可以查的 kpsewhich cid-x.map

今天重温了去年与一个Fedora Core使用者的吵架贴

有一点感悟 虽然他对Gentoo的某些指责有悖事实,但是有些话还是有些道理 以前谈到Gentoo的好,文档丰富是必须要夸赞的 可是我现在却突然感觉到 与其说那是我们的优点,倒不如说那是我们赖以生存的根本

#gentoo-cn on freenode

I registered #gentoo-cn several days ago. I am still a irc newbie op. But I am trying my best to catch up. I am playing with supybot . It is interesting. I will try to write some plugins for it. That will be more interesting! Yesterday Alastair Tse dropped in #gentoo-cn, I asked him if there are some better irc bot. To my surprise, he is the maintainer of supybot. Such a coincidents! hehe. PS: The number of people hanging on #gentoo-cn reached 23 yesterday, although 2-3 of them are bots, :).

Screenshot

Image
My friend midx's desktop

Fwd: zh_cn GWN 20060731

WOO~~ Thanks to ALL members of zh_CN GWN translations team!!!! This is not just my honur, but also everyone else's honor!!! Thank you!!! ---------- Forwarded message ---------- From: Chris Gianelloni Date: Aug 8, 2006 11:26 PM Subject: Re: zh_cn GWN 20060731 To: Zhang Le Cc: gwn-feedback AT gentoo DOT org , neysx AT gentoo DOT org On Sun, 2006-08-06 at 19:23 +0800, Zhang Le wrote: > Please help to commit, thanks! > > -- > Zhang Le, Robert They're now committed to the tree. I'm going to put you in touch with Xavier Neys, who is the Gentoo Documentation Project lead. He (or someone from his team) is going to mentor you so you can become a Gentoo staff member. This will allow you to commit your translations directly, as you and your team have been doing an excellent job, and I'm just holding you guys back now. -- Chris Gianelloni Release Engineering - Strategic Lead x86 Architecture Team Games - Developer Gentoo Linux -- Zhang Le, Robert Linux Engineer/Train

Gentoo takes you a lot of time?

I saw someone expressed this concern about Gentoo in a Chinese Linux forum. His original word is "Gentoo and LFS are only suitable for those who have a lot of time and a good machine". I replied him. Here are my main points: Maybe inevitable at the beginning, especially for Chinese users. Lots of apps need to be tuned, configured. But not necessarily afterwards, especially if the number of packages on your systme remains unchanged or fluctuates not so much. Your time maybe wasted under probably only one situation, i.e. you need a software desperately, but you haven't installed it yet. But if someone really often faces this situation, my suggestion to him is to choose something else, be it Debian or Arch. Also, I expressed one of my speculations of the future: Software compiling speed and the complexity of software, which increases faster? I think it's the former. :) But will OOo be compiled in minutes someday in the future? I am not sure.

[Gentoo]Two things for me to remember

Never try to use x11-drivers/ati-drivers , it stopped to function normally on my hp pavilion zt3000 since several months ago. Never try to enable option " FastAGPWrite " in xorg.conf, my notebook simply hangs whenever I startx with this option enabled.