天天看點

Linux環境應用雜記...不斷更新

SCIM輸入法

sudo apt-get remove scim

sudo apt-get install scim

sudo apt-get install scim-chinese

sudo gedit /etc/X11/Xsession.d /95xinput

/usr/bin/scim -d

XMODIFIERS="@im=SCIM"

export XMODIFIERS

export GTK_IM_MODULE=scim

exit and relogin

彙編安裝 binutils

1. sudo -sH 切換root

2. apt-get install binutils-doc

2. dpkg -l | grep binutil(Debian類型查詢)

3. Kdbg在ubuntu軟體中心安裝

man手冊頁更新

sudo apt-get install manpages-dev

C庫函數編譯

as -o cpuid.o cpuid.s

ld -dynamic-linker /lib/ld-linux.so.2 -lc -o cpuid cpuid.o

gcc編譯器會自動連接配接所需C庫,不過用gcc編譯彙程式設計式時,必須把_start标簽改為main,gcc -o cpuid2 cpuid2.s

as -gstabs -o cpuid.o cpuid.s

ld -o cpuid cpuid.o

gcc -S *.c  生成彙編代碼

vim + cscope + tags

1. 軟體安裝

sudo apt-get install cscope

安裝ctags: http://ctags.sourceforge.net/,然後ctags -version檢視目前ctags的版本是否是emacs的。

要是安裝了emacs的話就必須使用上面這個位址的ctags,vim不支援emacs的ctags,是以要下載下傳安裝這個ctags,下載下傳之後在源檔案所在目錄運作

./configure,make,生成ctags檔案,将這個檔案儲存到“/usr/bin/”目錄下即可。

2. 生成索引檔案

make cscope

make tags

ls tags -l, ls cscope.* -l

3. 一般源檔案中生成索引檔案

編寫如下腳本

#!/bin/sh

find . -name "*.h" -o -name "*.c" -o -name "*.cc" > cscope.files

cscope -bkq -i cscope.files

ctags -R

4. 在VIM使用cscope查找

在源代碼目錄下打開vim,加載cscope.out檔案,在vim指令行下執行:

:cs add cscope.out

vim指令行下執行:

:cs help

例:查找do_fork函數定義 :cs f g do_fork

5. 在VIM中使用tags查找符号

:tag xxx

6. 其它指令

ctrl+]:在函數調用的地方跳轉到函數定義的地方

ctrl+t:傳回上一個查找的地方

7. 特别注意

所生成的cscope.out和tags檔案要在打開VIM所在的檔案夾,否則VIM無法找到相關符号資訊

挂載 xxx.iso.gz檔案

解壓:gunzip xxx.iso.gz

挂載:mount -o loop file.iso /mnt/cdrom

繼續閱讀