Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Trace 程式碼之皮
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Wen_Liao
November 24, 2014
Technology
950
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Trace 程式碼之皮
Wen_Liao
November 24, 2014
More Decks by Wen_Liao
See All by Wen_Liao
COSCUP-2020-Linux 軟體組裝工和他的工具們
wen_liao
2
1.5k
開放街圖 自助旅行的好幫手
wen_liao
0
1.3k
GNU AS簡介
wen_liao
0
1.2k
UPnP 1.0 簡介
wen_liao
0
1.2k
自由軟體和 Richard Stallman
wen_liao
0
2.4k
Hello world在那邊?背景說明 0
wen_liao
0
810
A successful Git branching model 導讀
wen_liao
0
730
GNU ld的linker script簡介
wen_liao
0
1.4k
淺談Debian套件打包
wen_liao
0
700
Other Decks in Technology
See All in Technology
新機種発売前に見直そう!端末移行で再ログインが要るアプリ・要らないアプリは何が違うのか 〜シームレスに再開できる設計と実装〜
zozotech
PRO
0
220
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
360
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.4k
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
0
320
`t*(42&t>>10)`だけで音楽が鳴る、Swiftで実装するBytebeat / iOSDC Japan 2026
yutailang0119
0
120
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
520
人間はどの意思決定を手放せるのか
kawasima
15
7.5k
銀行勘定系システムにおける開発プロセス刷新×AIによる環境モダナイゼーション / Development Process Transformation and AI-Driven Environment Modernization
muit
1
2.4k
Reactの設計論
uhyo
24
14k
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
5
650
AI時代、データエンジニアが一番おもろい
genshun9
0
670
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
150
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
GraphQLとの向き合い方2022年版
quramy
50
15k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Music & Morning Musume
bryan
48
7.4k
30 Presentation Tips
portentint
PRO
1
400
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
510
The Limits of Empathy - UXLibs8
cassininazir
1
680
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Transcript
Trace 程式碼之皮 Wen Liao
Disclaimer 投影片資料為作者整理資料及個人意見,沒有經 過嚴謹確認,請讀者自行斟酌
目標 分享在Linux 下使用編輯器 trace 程式碼的技巧
測試環境: OS
測試環境: 編輯器
動機 • 菜鳥的痛苦,看不懂別人的程式碼。 • 花時間時間在找尋 ◦ 這變數誰在用的? ◦ 呼叫的這個函數到在那邊實作? ◦
這個函數是誰在呼叫的? ◦ 我找到的變數到底是在哪個函數內? ◦ ...
編輯器也是有效率高低的 • 找出現在游標的變數會被誰呼叫? ◦ 菜鳥式:以gedit為例 ▪ 游標移動到Search,按一下滑鼠左鍵 ▪ 選Find,從鍵盤輸入要找的變數名稱 ▪
游標移動到搜尋按鈕,看要往上找還是往下找 ◦ 非菜鳥式:以gedit為例 ▪ 複製變數,按ctrl + f,貼上 ▪ ctrl + g往下找, shift + crtl + g往上找 ◦ vim:單鍵搞定 ▪ * 自動幫你往下找,不用複製貼上變數名稱 ▪ # 自動幫你往上找,不用複製貼上變數名稱
我就喜歡用gedit慢慢 找,咬我啊
等你遇到一個檔案上萬行, 單一函數幾百行的時候就知 道厲害!
為什麼要用編輯器的進階功能? • 搜尋和定位是一種干擾 ◦ 你必須停下目前的思緒,找出下一筆資料才能夠繼續 思考。 • 這些功能能夠讓搜尋和定位這兩件事時間最 小化,切換程式思維的時間就會更少。
說明 • 本投影片只是vgod的文章:給程式設計師的 Vim入門圖解說明的註腳
範例程式,九九乘法表
快速找下一個相同字串 ①游標在這邊,按* ②游標移動了 _ _
快速找上一個相同字串 ①游標在這邊,按# ②游標移動了 _ _
馬上知道自己在哪個函數中 ①游標在這邊,按[[ ②游標移動了 _
直接跳到下一個函數 ①游標在這邊,按]] ②游標移動了 _
跳到目前block開頭 ①游標在這邊,按[{ ②游標移動了 _
跳到目前block結尾 ①游標在這邊,按]} ②游標移動了 _
成對跳躍 (1) 按%切換 _ _
成對跳躍 (2) 按%切換 _ _
成對跳躍%還可以用在 • [ ] • #ifdef …. #endif
切回上次游標位置 ①游標在這邊,按[[ ②游標移動了 _ ③按``切回上次游標位置
結論 • 善用編輯器功能,可以減少trace code的時 間。 • 上面的使用方式當專案程式碼大到某個程度 效益就不大了。 • 這些工具只是減少trace
code的搜尋定位時 間,理解程式碼拼湊並理解完全和工具無關。 而這些才是真正trace code的肉、骨、髓。
延伸作業 • 安裝ctags和cscope,嘗試操作。 • 學習grep和簡單的POSIX regular expression
參考資料 • 給程式設計師的Vim入門圖解說明 - vgod ◦ http://blog.vgod.tw/2009/12/08/vim-cheat-sheet-for- programmers/