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
Wen_Liao
November 24, 2014
Technology
970
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
830
A successful Git branching model 導讀
wen_liao
0
740
GNU ld的linker script簡介
wen_liao
0
1.5k
淺談Debian套件打包
wen_liao
0
720
Other Decks in Technology
See All in Technology
DBについての基礎説明(MySQL編) - コロプラ 2026年度 新卒研修
colopl
0
120
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
200
JAWS-UGグッズ職人仕事の流儀
kentapapa
0
120
React改造してみた
tsukina_7mochi
0
110
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
160
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.4k
トークン化預金DCJPYの取り組みと活用ユースケース
finengine
0
110
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
600
Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical & Dynamic Search Spaces
pfn
PRO
0
140
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
360
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
490
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
1.7k
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Exploring anti-patterns in Rails
aemeredith
4
540
The World Runs on Bad Software
bkeepers
PRO
72
12k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Making Projects Easy
brettharned
120
6.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Rails Girls Zürich Keynote
gr2m
96
14k
The Limits of Empathy - UXLibs8
cassininazir
2
720
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
How to Talk to Developers About Accessibility
jct
2
580
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
500
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/