Posts

一点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...