<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-36303554</id><updated>2024-09-11T22:08:01.884+08:00</updated><category term="Linux"/><category term="Android"/><category term="Java"/><category term="cocos2d"/><category term="git"/><category term="opencv"/><category term="Debug"/><category term="image processing"/><category term="Life"/><category term="Ubuntu"/><category term="vim"/><category term="Investment"/><category term="LCD"/><category term="Running"/><category term="cocos2d-x"/><category term="cpp"/><category term="gcc"/><category term="Assembly"/><category term="Blogger"/><category term="RTOS"/><category term="Uefi"/><category term="display"/><category term="eclipse"/><category term="kernel"/><category term="priority inversion"/><category term="resume"/><category term="suspend"/><category term="xml"/><title type='text'>吉姆小窩</title><subtitle type='html'>年紀大了, 容易忘記, 隨意寫寫, 紀錄筆記, 提醒自己, 也與人分享 :)&#xa;如有侵犯到作者，也請告知，將會馬上移除</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>83</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-36303554.post-6286042046650088670</id><published>2017-06-17T16:36:00.004+08:00</published><updated>2017-06-17T16:40:46.082+08:00</updated><title type='text'>How to apply a patch made by repo diff?</title><content type='html'>Source: https://groups.google.com/forum/#!topic/repo-discuss/43juvD1qGIQ&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:shell&quot;&gt;## Script to patch up diff reated by `repo diff`

if [ -z &quot;$1&quot; ] || [ ! -e &quot;$1&quot; ]; then
    echo &quot;Usages: $0 &amp;lt;repo_diff_file&amp;gt;&quot;;
    exit 0;
fi

rm -fr _tmp_splits*
cat $1 | csplit -qf &#39;&#39; -b &quot;_tmp_splits.%d.diff&quot; - &#39;/^project.*\/$/&#39; &#39;{*}&#39;

working_dir=`pwd`

for proj_diff in `ls _tmp_splits.*.diff`
do
    chg_dir=`cat $proj_diff | grep &#39;^project.*\/$&#39; | cut -d &quot; &quot; -f 2`
    echo &quot;FILE: $proj_diff $chg_dir&quot;
    if [ -e $chg_dir ]; then
        ( cd $chg_dir; \
            cat $working_dir/$proj_diff | grep -v &#39;^project.*\/$&#39; | patch -Np1;);
    else
        echo &quot;$0: Project directory $chg_dir don&#39;t exists.&quot;;
    fi
done
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/6286042046650088670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/6286042046650088670' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/6286042046650088670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/6286042046650088670'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2017/06/how-to-apply-patch-made-by-repo-diff.html' title='How to apply a patch made by repo diff?'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-7187361325771659021</id><published>2017-06-17T16:33:00.001+08:00</published><updated>2017-06-17T16:35:29.040+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><title type='text'>Android 調試.so庫文件</title><content type='html'>資料來源: http://www.blogjava.net/anymobile/articles/314685.html&lt;br /&gt;
&lt;br /&gt;
作者：徐建祥(netpirate@gmail.com)&lt;br /&gt;
日期：2010/03/06&lt;br /&gt;
網址：http://www.anymobile.org&lt;br /&gt;
&lt;br /&gt;
調試步驟如下：&lt;br /&gt;
1/ 將異常的地址信息存到文本文件，並存放在項目根目錄；&lt;br /&gt;
2/ 使用panic.py解析該文件；&lt;br /&gt;
3/ 根據返回的信息(文件名;行號;方法名)調試程序。&lt;br /&gt;
&lt;br /&gt;
以操作第三方的Touch input 輸入法為例，過程如下：&lt;br /&gt;
&lt;br /&gt;
# 該輸入法的英文和手寫OK，操作中文輸入法時，出現異常，軟鍵盤消失，異常日誌如下&lt;br /&gt;
02-05 06:41:19.834 D/dalvikvm(&amp;nbsp; 751): Trying to load lib /system/lib/libimezi.so 0x43e2a788&lt;br /&gt;
02-05 06:41:19.874 D/dalvikvm(&amp;nbsp; 751): Added shared lib /system/lib/libimezi.so 0x43e2a788&lt;br /&gt;
02-05 06:41:20.035 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***&lt;br /&gt;
02-05 06:41:20.035 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551): Build fingerprint: &#39;unknown&#39;&lt;br /&gt;
02-05 06:41:20.035 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551): pid: 751, tid: 751&amp;nbsp; &amp;gt;&amp;gt;&amp;gt; com.htc.android.cime &amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
02-05 06:41:20.045 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551): signal 11 (SIGSEGV), fault addr 00000003&lt;br /&gt;
02-05 06:41:20.045 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; r0 00000000&amp;nbsp; r1 00000000&amp;nbsp; r2 807248ec&amp;nbsp; r3 807248ec&lt;br /&gt;
02-05 06:41:20.055 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; r4 00252d80&amp;nbsp; r5 00000004&amp;nbsp; r6 00000001&amp;nbsp; r7 00000000&lt;br /&gt;
02-05 06:41:20.055 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; r8 beff8550&amp;nbsp; r9 41459d28&amp;nbsp; 10 41459d18&amp;nbsp; fp 00000000&lt;br /&gt;
02-05 06:41:20.055 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; ip 8072430c&amp;nbsp; sp beff84f0&amp;nbsp; lr 80716b4f&amp;nbsp; pc 80717bce cpsr 60000030&lt;br /&gt;
02-05 06:41:20.135 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #00&amp;nbsp; pc 00017bce&amp;nbsp; /system/lib/libimezi.so&lt;br /&gt;
02-05 06:41:20.135 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #01&amp;nbsp; pc 00010f80&amp;nbsp; /system/lib/libimezi.so&lt;br /&gt;
02-05 06:41:20.145 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551): stack:&lt;br /&gt;
02-05 06:41:20.155 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84b0&amp;nbsp; ad083e10&amp;nbsp; &lt;br /&gt;
02-05 06:41:20.155 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84b4&amp;nbsp; ad05d44f&amp;nbsp; /system/lib/libdvm.so&lt;br /&gt;
02-05 06:41:20.155 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84b8&amp;nbsp; ad06b8a0&amp;nbsp; /system/lib/libdvm.so&lt;br /&gt;
02-05 06:41:20.155 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84bc&amp;nbsp; ad083e10&amp;nbsp; &lt;br /&gt;
02-05 06:41:20.167 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84c0&amp;nbsp; 43e2aa90&amp;nbsp; &lt;br /&gt;
02-05 06:41:20.175 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84c4&amp;nbsp; 00000003&amp;nbsp; &lt;br /&gt;
02-05 06:41:20.175 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84c8&amp;nbsp; 00000014&amp;nbsp; &lt;br /&gt;
02-05 06:41:20.185 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beff84cc&amp;nbsp; 80716b4f&amp;nbsp; /system/lib/libimezi.so&lt;br /&gt;
&lt;br /&gt;
# 保存異常日誌，存為文件: 20100205_ime.txt&lt;br /&gt;
02-05 06:41:20.045 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; r0 00000000&amp;nbsp; r1 00000000&amp;nbsp; r2 807248ec&amp;nbsp; r3 807248ec&lt;br /&gt;
02-05 06:41:20.055 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; r4 00252d80&amp;nbsp; r5 00000004&amp;nbsp; r6 00000001&amp;nbsp; r7 00000000&lt;br /&gt;
02-05 06:41:20.055 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; r8 beff8550&amp;nbsp; r9 41459d28&amp;nbsp; 10 41459d18&amp;nbsp; fp 00000000&lt;br /&gt;
02-05 06:41:20.055 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp; ip 8072430c&amp;nbsp; sp beff84f0&amp;nbsp; lr 80716b4f&amp;nbsp; pc 80717bce&amp;nbsp; cpsr 60000030&lt;br /&gt;
02-05 06:41:20.135 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #00&amp;nbsp; pc 00017bce&amp;nbsp; /system/lib/libimezi.so&lt;br /&gt;
02-05 06:41:20.135 I/DEBUG&amp;nbsp;&amp;nbsp; (&amp;nbsp; 551):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #01&amp;nbsp; pc 00010f80&amp;nbsp; /system/lib/libimezi.so&lt;br /&gt;
&lt;br /&gt;
# 執行腳本&lt;br /&gt;
xujianxiang@wingdroid-clone:~/workspace/xujx/wing15$ ./panic.py 20100205_ime.txt &lt;br /&gt;
read file ok&lt;br /&gt;
/home/xujianxiang/workspace/xujx/wing15/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-addr2line:
 
&#39;/home/xujianxiang/workspace/xujx/wing15/out/target/product/generic/symbols/system/lib/libimezi.so&#39;:
 No such file&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
&amp;nbsp; File &quot;./panic.py&quot;, line 69, in &amp;lt;module&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print &quot;%-30s%s&quot; % (list[1],list[0])&lt;br /&gt;
IndexError: list index out of range&lt;br /&gt;
&lt;br /&gt;
# 沒找到庫文件，因為這個文件是第三方的，只存放在/out/target/product/generic/system/lib 
/libimezi.so，拷貝一份存到/out/target/product/generic/symbols/system/lib 
/libimezi.so，再次執行腳本&lt;br /&gt;
xujianxiang@wingdroid-clone:~/workspace/xujx/wing15$ ./panic.py 20100205_ime.txt &lt;br /&gt;
read file ok&lt;br /&gt;
zi81keyd.c:0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Zi8GetTableData&lt;br /&gt;
zi81keyd.c:0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Zi8InitializeDynamic&lt;br /&gt;
&lt;br /&gt;
# 成功解析異常，沒有zi8庫文件所致，更新如下庫文件，輸入法支持中文拼音。&lt;br /&gt;
/system/lib/zi/Zi8DatPYP_CN.z8d&lt;br /&gt;
/system/lib/zi/Zi8DatPYS_CN.z8d&lt;br /&gt;
/system/lib/zi/Zi8DatZHA_CN.z8d&lt;br /&gt;
/system/lib/zi/Zi8DatZHA_HK.z8d&lt;br /&gt;
/system/lib/zi/Zi8DatZHA_TW.z8d&lt;br /&gt;
/system/lib/zi/Zi8DatZYP_TW.z8d&lt;br /&gt;
/system/lib/zi/Zi8DatZYS_TW.z8d&lt;br /&gt;
&lt;module&gt;&lt;/module&gt;&lt;br /&gt;
&lt;module&gt;&lt;/module&gt;&lt;module&gt;
&lt;br /&gt;
附 panic.py：&lt;br /&gt;
&lt;/module&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:python&quot;&gt;#!/usr/bin/python
# stack symbol parser

import os
import string
import sys

#define android product name
#ANDROID_PRODUCT_NAME = &#39;generic&#39;
ANDROID_PRODUCT_NAME = &#39;smdk6410&#39;

ANDROID_WORKSPACE = os.getcwd()+&quot;/&quot;

# addr2line tool path and symbol path
addr2line_tool = ANDROID_WORKSPACE + &#39;prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-addr2line&#39;
symbol_dir = ANDROID_WORKSPACE + &#39;out/target/product/&#39; + ANDROID_PRODUCT_NAME +&#39;/symbols&#39;
symbol_bin = symbol_dir + &#39;/system/bin/&#39;
symbol_lib = symbol_dir + &#39;/system/lib/&#39;

class ReadLog:
    def __init__(self,filename):
        self.logname = filename
    def parse(self):
        f = file(self.logname,&#39;r&#39;)
        lines = f.readlines()
        if lines != []:
            print &#39;read file ok&#39;
        else:
            print &#39;read file failed&#39;
        result =[]
        for line in lines:
            if line.find(&#39;stack&#39;) != -1:
                print &#39;stop search&#39;
                break
            elif line.find(&#39;system&#39;) != -1:
                #print &#39;find one item&#39; + line
                result.append(line)
        return result

class ParseContent:
    def __init__(self,addr,lib):
            self.address = addr # pc address
            self.exename = lib  # executable or shared library
    def addr2line(self):
        cmd = addr2line_tool + &quot; -C -f -s -e &quot; + symbol_dir + self.exename + &quot; &quot; + self.address
        #print cmd
        stream = os.popen(cmd)
        lines = stream.readlines();
        list = map(string.strip,lines)
        return list
    
inputarg = sys.argv
if len(inputarg) &amp;lt; 2:
    print &#39;Please input panic log&#39;
    exit()

filename = inputarg[1]
readlog = ReadLog(filename)
inputlist = readlog.parse()

for item in inputlist:
    itemsplit = item.split()
    test = ParseContent(itemsplit[-2],itemsplit[-1])
    list = test.addr2line()
    print &quot;%-30s%s&quot; % (list[1],list[0])

&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/7187361325771659021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/7187361325771659021' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/7187361325771659021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/7187361325771659021'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2017/06/android-so.html' title='Android 調試.so庫文件'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-745035786286065415</id><published>2017-02-07T12:55:00.001+08:00</published><updated>2017-02-07T12:55:37.282+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="git"/><title type='text'>[轉] 關於refs/for/</title><content type='html'>資料來源: http://lishicongli.blog.163.com/blog/static/146825902013213439500/&lt;br /&gt;
&lt;br /&gt;
1.     這個不是git的規則，而是gerrit的規則，&lt;br /&gt;
2.     Branches, remote-tracking branches, and tags等等都是對commite的引用（reference）,引用都以 「refs/……」表示. 比如remote branch: origin/git_int(=refs/remotes/origin/git_int)， local tag: v2.0(=refs/tags/v2.0)， local branch: git_int(=refs/heads/git_int)…&lt;br /&gt;
3.     簡單點說，就是refs/for/mybranch需要經過code review之後才可以提交；refs/heads/mybranch不需要code review。&lt;br /&gt;
&lt;br /&gt;
（since you want to directly push into the branch, rather than create code reviews. Pushing to refs/for/* creates code reviews which must be approved and then submitted. Pushing to refs/heads/* bypasses review entirely, and just enters the commits directly into the branch. The latter does not check committer identity, making it appropriate for importing past project history）&lt;br /&gt;
如果需要code review，直接push&lt;br /&gt;
$git push origin master&lt;br /&gt;
那麼就會有「! [remote rejected] master -&gt; master (prohibited by Gerrit)」的錯誤信息&lt;br /&gt;
而這樣push就沒有問題，&lt;br /&gt;
$git push origin HEAD:refs/for/mybranch&lt;br /&gt;
&lt;br /&gt;
下面一段是對「refs/for」更詳細的描述：&lt;br /&gt;
The documentation for Gerrit explains that you push to the &quot;magical refs/for/&#39;branch&#39; ref using any Git client tool&quot;. &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkd_qEocUK4soLoNszjOXLlFCsHwuxClfisOI6Js3Dflf_e_mqDN_pZRpWD_puyz57Dv0yrpLWmYEhGL2t6E4s8C7x7x7_rk9dbPg7FGFpACwWDQh-z5RGT7scWvmOhAFSNNw6lg/s1600/6598167079261567773.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkd_qEocUK4soLoNszjOXLlFCsHwuxClfisOI6Js3Dflf_e_mqDN_pZRpWD_puyz57Dv0yrpLWmYEhGL2t6E4s8C7x7x7_rk9dbPg7FGFpACwWDQh-z5RGT7scWvmOhAFSNNw6lg/s320/6598167079261567773.png&quot; width=&quot;320&quot; height=&quot;274&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This image is taken from the Intro to Gerrit. When you push to Gerrit, you do git push gerrit HEAD:refs/for/&lt;BRANCH&gt;. This pushes your changes to the staging area (in the diagram, &quot;Pending Changes&quot;). Gerrit doesn&#39;t actually have a branch called &lt;BRANCH&gt;; it lies to the git client.&lt;br /&gt;
Internally, Gerrit has it&#39;s own implementation for the Git and SSH stacks. This allows it to provide the &quot;magical&quot; refs/for/&lt;BRANCH&gt; refs.&lt;br /&gt;
When a push request is received to create a ref in one of these namespaces Gerrit performs its own logic to update the database, and then lies to the client about the result of the operation. A successful result causes the client to believe that Gerrit has created the ref, but in reality Gerrit hasn&#39;t created the ref at all.  &lt;br /&gt;
After a successful patch (i.e, the patch has been pushed to Gerrit, [putting it into the &quot;Pending Changes&quot; staging area], reviewed, and the review has passed), Gerrit pushes the change from the &quot;Pending Changes&quot; into the &quot;Authoritative Repository&quot;, calculating which branch to push it into based on the magic it did when you pushed to refs/for/&lt;BRANCH&gt;. This way, successfully reviewed patches can be pulled directly from the correct branches of the Authoritative Repository.</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/745035786286065415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/745035786286065415' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/745035786286065415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/745035786286065415'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2017/02/refsfor.html' title='[轉] 關於refs/for/'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkd_qEocUK4soLoNszjOXLlFCsHwuxClfisOI6Js3Dflf_e_mqDN_pZRpWD_puyz57Dv0yrpLWmYEhGL2t6E4s8C7x7x7_rk9dbPg7FGFpACwWDQh-z5RGT7scWvmOhAFSNNw6lg/s72-c/6598167079261567773.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-164863810894958160</id><published>2016-11-19T14:35:00.000+08:00</published><updated>2016-11-19T14:35:00.972+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="opencv"/><title type='text'>How to binarize image.</title><content type='html'>* Binary image has following steps:&lt;br /&gt;
** To convert image to gray scale.&lt;br /&gt;
** To check every pixel if greater than threshold, set value to maximum(255), otherwise minimum(0).&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;#include &amp;lt;cv.hpp&amp;gt;

using namespace cv;
#define THRESHOLD 100

int main( int argc, char** argv )
{
&amp;nbsp; Mat image;
&amp;nbsp; image = imread( &quot;resource/lena.png&quot;, IMREAD_COLOR );
&amp;nbsp; Mat Output( image.rows, image.cols, CV_8UC3, Scalar(0, 0, 0) );
&amp;nbsp; int height = image.rows;
&amp;nbsp; int width = image.cols;

&amp;nbsp; for(int row = 0; row &amp;lt; height; row++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; for(int col = 0; col &amp;lt; width; col++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; uchar val = (image.at&amp;lt;Vec3b&amp;gt;(row, col)[0] * 0.2999 + image.at&amp;lt;Vec3b&amp;gt;(row, col)[1] * 0.587 + image.at&amp;lt;Vec3b&amp;gt;(row, col)[2] * 0.114);

&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Output.at&amp;lt;Vec3b&amp;gt;(row, col)[0] = (val &amp;gt; THRESHOLD ? 255 : 0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Output.at&amp;lt;Vec3b&amp;gt;(row, col)[1] = (val &amp;gt; THRESHOLD ? 255 : 0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Output.at&amp;lt;Vec3b&amp;gt;(row, col)[2] = (val &amp;gt; THRESHOLD ? 255 : 0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }

&amp;nbsp; namedWindow(&quot;out&quot;, WINDOW_NORMAL);
&amp;nbsp; imshow(&quot;out&quot;, Output);

&amp;nbsp; waitKey(0);

&amp;nbsp; return 0;
}
&lt;/pre&gt;Result:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkggueeavVVUpSV0t7S1pqVaZfPyVKt_SdUo9L480qajY3u_S_NlQpoaXWpNA2qFHEdP3GoVscjS3BPUa4BQLYcH2eHYAWAL2SVdj3bVuMmsYOhXKZZHKcSRFocSF_h8_yf-YASQ/s1600/lenabinary100.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkggueeavVVUpSV0t7S1pqVaZfPyVKt_SdUo9L480qajY3u_S_NlQpoaXWpNA2qFHEdP3GoVscjS3BPUa4BQLYcH2eHYAWAL2SVdj3bVuMmsYOhXKZZHKcSRFocSF_h8_yf-YASQ/s1600/lenabinary100.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/164863810894958160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/164863810894958160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/164863810894958160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/164863810894958160'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2016/11/how-to-binarize-image.html' title='How to binarize image.'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkggueeavVVUpSV0t7S1pqVaZfPyVKt_SdUo9L480qajY3u_S_NlQpoaXWpNA2qFHEdP3GoVscjS3BPUa4BQLYcH2eHYAWAL2SVdj3bVuMmsYOhXKZZHKcSRFocSF_h8_yf-YASQ/s72-c/lenabinary100.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-2413665630982019859</id><published>2016-11-18T01:54:00.000+08:00</published><updated>2016-11-18T01:54:29.853+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="opencv"/><title type='text'>How to convert grayscale image.</title><content type='html'>&lt;pre class=&quot;brush:cpp&quot;&gt;#include &amp;lt;cv.hpp&amp;gt;

using namespace cv;

int main( int argc, char** argv )
{
&amp;nbsp; Mat image;
&amp;nbsp; image = imread( &quot;resource/lena.png&quot;, IMREAD_COLOR );
&amp;nbsp; Mat Output( image.rows, image.cols, CV_8UC3, Scalar(0, 0, 0) );
&amp;nbsp; int height = image.rows;
&amp;nbsp; int width = image.cols;

&amp;nbsp; for(int row = 0; row &amp;lt; height; row++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; for(int col = 0; col &amp;lt; width; col++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; uchar val = (image.at&amp;lt;Vec3b&amp;gt;(row, col)[0] * 0.2999 + image.at&amp;lt;Vec3b&amp;gt;(row, col)[1] * 0.587 + image.at&amp;lt;Vec3b&amp;gt;(row, col)[2] * 0.114);
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Output.at&amp;lt;Vec3b&amp;gt;(row, col)[0] = val;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Output.at&amp;lt;Vec3b&amp;gt;(row, col)[1] = val;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Output.at&amp;lt;Vec3b&amp;gt;(row, col)[2] = val;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }

&amp;nbsp; namedWindow(&quot;out&quot;, WINDOW_NORMAL);
&amp;nbsp; imshow(&quot;out&quot;, Output);

&amp;nbsp; waitKey(0);

&amp;nbsp; return 0;
}
&lt;/pre&gt;&lt;br /&gt;
Result:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTqxYj4ylZdThZYhPpvm0K9xYt_wz_N5ZPF7pnLYZotPA-J6s_xxDMWEuM2W1fh_4sX_nui-63tTGIEvgK46CEPAfUvsmraLDGnqB-Oq23BG60tU6ythmMUeJK-NrHxGx9k2c2Vg/s1600/lenagray.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTqxYj4ylZdThZYhPpvm0K9xYt_wz_N5ZPF7pnLYZotPA-J6s_xxDMWEuM2W1fh_4sX_nui-63tTGIEvgK46CEPAfUvsmraLDGnqB-Oq23BG60tU6ythmMUeJK-NrHxGx9k2c2Vg/s1600/lenagray.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/2413665630982019859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/2413665630982019859' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2413665630982019859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2413665630982019859'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2016/11/how-to-convert-grayscale-image.html' title='How to convert grayscale image.'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTqxYj4ylZdThZYhPpvm0K9xYt_wz_N5ZPF7pnLYZotPA-J6s_xxDMWEuM2W1fh_4sX_nui-63tTGIEvgK46CEPAfUvsmraLDGnqB-Oq23BG60tU6ythmMUeJK-NrHxGx9k2c2Vg/s72-c/lenagray.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-2012830192982646752</id><published>2016-11-17T00:09:00.002+08:00</published><updated>2016-11-17T01:52:51.584+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="opencv"/><title type='text'>To get RGB channel and output.</title><content type='html'>&lt;pre class=&quot;brush:cpp&quot;&gt;#include &amp;lt;cv.hpp&amp;gt;

using namespace cv;

int main( int argc, char** argv )
{
  Mat image;
  image = imread( &quot;resource/lena.png&quot;, IMREAD_COLOR );
  Mat OutputR( image.rows, image.cols, CV_8UC3, Scalar(0, 0, 0) );
  Mat OutputG( image.rows, image.cols, CV_8UC3, Scalar(0, 0, 0) );
  Mat OutputB( image.rows, image.cols, CV_8UC3, Scalar(0, 0, 0) );
  int height = image.rows;
  int width = image.cols;

  for(int row = 0; row &amp;lt; height; row++) {
   for(int col = 0; col &amp;lt; width; col++) {

    OutputB.at&amp;lt;Vec3b&amp;gt;(row, col)[0] = image.at&amp;lt;Vec3b&amp;gt;(row, col)[0];
    OutputB.at&amp;lt;Vec3b&amp;gt;(row, col)[1] = 0;
    OutputB.at&amp;lt;Vec3b&amp;gt;(row, col)[2] = 0;
    OutputG.at&amp;lt;Vec3b&amp;gt;(row, col)[0] = 0;
    OutputG.at&amp;lt;Vec3b&amp;gt;(row, col)[1] = image.at&amp;lt;Vec3b&amp;gt;(row, col)[1];
    OutputG.at&amp;lt;Vec3b&amp;gt;(row, col)[2] = 0;
    OutputR.at&amp;lt;Vec3b&amp;gt;(row, col)[0] = 0;
    OutputR.at&amp;lt;Vec3b&amp;gt;(row, col)[1] = 0;
    OutputR.at&amp;lt;Vec3b&amp;gt;(row, col)[2] = image.at&amp;lt;Vec3b&amp;gt;(row, col)[2];
   }
  }

  namedWindow(&quot;outr&quot;, WINDOW_NORMAL);
  imshow(&quot;outr&quot;, OutputR);

  namedWindow(&quot;outg&quot;, WINDOW_NORMAL);
  imshow(&quot;outg&quot;, OutputG);

  namedWindow(&quot;outb&quot;, WINDOW_NORMAL);
  imshow(&quot;outb&quot;, OutputB);

  waitKey(0);

  return 0;
}

&lt;/pre&gt;&lt;br /&gt;
Results:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsu45WOQDffTsCFmnfO2vW7XHsuudUPp5UxFXLq956aLzJtHep4-zkxyS7-jYc-_JLeV0kQ9Nd1wrw4mYCaZoKZVo2tS6C4_qDJfrhoK1VNSKuSYjKHNfnErynLfmCgvPM5lbtiA/s1600/outr.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsu45WOQDffTsCFmnfO2vW7XHsuudUPp5UxFXLq956aLzJtHep4-zkxyS7-jYc-_JLeV0kQ9Nd1wrw4mYCaZoKZVo2tS6C4_qDJfrhoK1VNSKuSYjKHNfnErynLfmCgvPM5lbtiA/s1600/outr.png&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoKSo_04CgLulkpRMA0c3Pj1dMjaLzzOXi5tQQzFjdGRoqomTfDgAlXRksNBWy2p2N-GErLw7DG3DemHeCCO-YrJ1SwlNNu1BR3zAC3rzqG5EvEMMRCs1XyABwhmZFHNzUu0vtyw/s1600/outg.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoKSo_04CgLulkpRMA0c3Pj1dMjaLzzOXi5tQQzFjdGRoqomTfDgAlXRksNBWy2p2N-GErLw7DG3DemHeCCO-YrJ1SwlNNu1BR3zAC3rzqG5EvEMMRCs1XyABwhmZFHNzUu0vtyw/s1600/outg.png&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiNUvEp-EN7EVDQq4FYx-NQA3tbhyOksTiN3tv1ICmLZveeIF_q76AdvOL6gzPlol26BQ5zLN0xQKLnDwHdMtZ-AD1z-tLXtqvRdlWAi3t8Z0flSO-LfoMGW-QI9hjaZf_5pHR_Q/s1600/outb.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiNUvEp-EN7EVDQq4FYx-NQA3tbhyOksTiN3tv1ICmLZveeIF_q76AdvOL6gzPlol26BQ5zLN0xQKLnDwHdMtZ-AD1z-tLXtqvRdlWAi3t8Z0flSO-LfoMGW-QI9hjaZf_5pHR_Q/s1600/outb.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/2012830192982646752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/2012830192982646752' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2012830192982646752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2012830192982646752'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2016/11/to-get-rgb-channel-and-output.html' title='To get RGB channel and output.'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsu45WOQDffTsCFmnfO2vW7XHsuudUPp5UxFXLq956aLzJtHep4-zkxyS7-jYc-_JLeV0kQ9Nd1wrw4mYCaZoKZVo2tS6C4_qDJfrhoK1VNSKuSYjKHNfnErynLfmCgvPM5lbtiA/s72-c/outr.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-6180678391634350019</id><published>2016-11-17T00:09:00.001+08:00</published><updated>2016-11-17T00:21:52.216+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="opencv"/><title type='text'>Using opencv to inverse Image.</title><content type='html'>&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;#include &amp;lt;cv.hpp&amp;gt;

using namespace cv;

int main( int argc, char** argv )
{
&amp;nbsp; Mat image;
&amp;nbsp; int height, width;
&amp;nbsp; // load lena picture and convert to grayscale
&amp;nbsp; image = imread(&quot;resource/lena.png&quot;, IMREAD_GRAYSCALE);
&amp;nbsp; // store height and width
&amp;nbsp; height = image.rows;
&amp;nbsp; width = image.cols;
&amp;nbsp; // show image
&amp;nbsp; imshow(&quot;lena1&quot;, image);
&amp;nbsp; // inverse image
&amp;nbsp; for(int i = 0; i &amp;lt; height; i++) {
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; for(int j = 0; j &amp;lt; width; j++) {
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; image.at&amp;lt;uchar&amp;gt;(i, j) = 255 - image.at&amp;lt;uchar&amp;gt;(i,j);
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; // show image again to compare
&amp;nbsp; imshow(&quot;lena2&quot;, image);

&amp;nbsp; waitKey(0);

&amp;nbsp; return 0;
}
&lt;/pre&gt;Result: &lt;br&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTQP5-4f74jSqO_8yCsQwc56Dlr-ERetkK1vKXzmUtOiexBP3b4MEh4zrTy0CBJddfcZG_fJiTqyMVmWEv3s16K2mmRnYOgCQL_CFHSv9wtmgy_1qGZvPQpBnjcRVjNgS5dx7phA/s1600/lena_inverse.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTQP5-4f74jSqO_8yCsQwc56Dlr-ERetkK1vKXzmUtOiexBP3b4MEh4zrTy0CBJddfcZG_fJiTqyMVmWEv3s16K2mmRnYOgCQL_CFHSv9wtmgy_1qGZvPQpBnjcRVjNgS5dx7phA/s1600/lena_inverse.png&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/6180678391634350019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/6180678391634350019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/6180678391634350019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/6180678391634350019'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2016/11/using-opencv-to-inverse-image.html' title='Using opencv to inverse Image.'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTQP5-4f74jSqO_8yCsQwc56Dlr-ERetkK1vKXzmUtOiexBP3b4MEh4zrTy0CBJddfcZG_fJiTqyMVmWEv3s16K2mmRnYOgCQL_CFHSv9wtmgy_1qGZvPQpBnjcRVjNgS5dx7phA/s72-c/lena_inverse.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-2301657368984401157</id><published>2016-11-17T00:09:00.000+08:00</published><updated>2016-11-17T00:10:13.401+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="opencv"/><title type='text'>Eclipse mars.2 opencv configuration for mac</title><content type='html'>How to configure opencv on eclipse mars.2 Release(4.5.2).&lt;br /&gt;
You have to install opencv3 by issue command &quot;brew install opencv3&quot; &lt;br /&gt;
* Elipse-&amp;gt;Projects(right click)-&amp;gt;Properties-&amp;gt;C/C++ General-&amp;gt;Paths and Symbols-&amp;gt;Includes-&amp;gt;GNU C++ -&amp;gt; Add&lt;br /&gt;
** /usr/local/Cellar/opencv3/3.1.0_2/include/opencv&lt;br /&gt;
** /usr/local/Cellar/opencv3/3.1.0_2/include&lt;br /&gt;
&lt;br /&gt;
*&amp;nbsp; Elipse-&amp;gt;Projects(right click)-&amp;gt;Properties-&amp;gt;C/C++ General-&amp;gt;Paths and Symbols-&amp;gt;Libraries -&amp;gt; Add&lt;br /&gt;
** opencv_core (required)&lt;br /&gt;
** opencv_imgproc (required)&lt;br /&gt;
** opencv_highgui (required)&lt;br /&gt;
** opencv_imgcodecs (required)&lt;br /&gt;
** opencv_flann&lt;br /&gt;
** opencv_video&lt;br /&gt;
** opencv_features2d&lt;br /&gt;
** opencv_calib3d&lt;br /&gt;
** opencv_ml&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;*&amp;nbsp; Elipse-&amp;gt;Projects(right click)-&amp;gt;Properties-&amp;gt;C/C++ General-&amp;gt;Paths and Symbols-&amp;gt;Library Paths-&amp;gt;Add&lt;br /&gt;
** /usr/local/Cellar/opencv3/3.1.0_2/lib </content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/2301657368984401157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/2301657368984401157' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2301657368984401157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2301657368984401157'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2016/11/opencv-eclipse-mars2-configuration-for.html' title='Eclipse mars.2 opencv configuration for mac'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-7485458341418681146</id><published>2015-06-27T02:27:00.000+08:00</published><updated>2015-06-27T02:27:04.579+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Debug"/><title type='text'>如何在 Android 各 level ( 包含 user space 與 kernel space ) 使用dump call stack的方法</title><content type='html'>資料來源: &lt;a href=&quot;http://janbarry0914.blogspot.tw/2014/07/androiddump-call-stack.html&quot; target=&quot;_blank&quot;&gt;如何在 Android 各 level ( 包含 user space 與 kernel space ) 使用dump call stack的方法&lt;/a&gt;&lt;br /&gt;
&lt;h3 class=&quot;post-title entry-title&quot; itemprop=&quot;name&quot;&gt;
&amp;nbsp;&lt;/h3&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;dump call stack&lt;/span&gt;&lt;/h2&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 14pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 17px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/h3&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 14pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 17px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;[文章重點]&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-size: 17px; white-space: pre-wrap;&quot;&gt;了解 Android 各 level ( UI, framework 與 HAL) 與 kernel 間, 如何印出 call stack, 方便追 code 與 debug&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-size: 17px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-size: 17px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;[文章目錄]&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial; font-size: 17px; white-space: pre-wrap;&quot;&gt;kernel call stack&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial; font-size: 17px; white-space: pre-wrap;&quot;&gt;Android Java layer&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial; font-size: 17px; white-space: pre-wrap;&quot;&gt;Android framework ( written by c++)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial; font-size: 17px; white-space: pre-wrap;&quot;&gt;Android HAL ( written by c )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: 17px; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 17.25px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Call Stack&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; 沒有出現 &lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;function name&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 14pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 17px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;kernel call stack&lt;/span&gt;&lt;/h3&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;如果想知道call stack,也就是說, 我們想知道是誰call到func_foo(). 此時,我們可以利用 dump_stack(),放在你想dump back trace的地方就OK囉.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;void func_foo(void){&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;int a=3;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;dump_stack();&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Java layer call stack&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;在Java檔案, 可以使用下述方法得到dump call stack&lt;/span&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-d436d515-237e-200b-710f-3fc92c09af9a&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;public void foo(boolean state, int flags) {&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;... &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;Log.d(TAG,&quot;xxxx&quot;, new Throwable());&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 14pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 17px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;C++ layer call stack&lt;/span&gt;&lt;/h3&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;在C/C++ 檔案, Android 已經有寫了frameworks/native/libs/utils/CallStack.cpp 供我們使用&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#include &amp;lt;utils/CallStack.h&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;void foo(void) {&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;android::CallStack stack;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;stack.update();&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;stack.dump(&quot;XXX&quot;);&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;如果你所使用是Android 4.4 之後&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;請改用&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#include &amp;lt;utils/CallStack.h&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;void foo(void) {&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;android::CallStack stack;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;stack.update( );&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;stack.log(&quot;XXX&quot;);&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;在Android.mk 記得要加&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;LOCAL_SHARED_LIBRARIES += libutils&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 14pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 17px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;C layer call stack&lt;/span&gt;&lt;/h3&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;由於C去call C++需要做一些宣告, 所以將它獨立出來方便使用(dump_stack.cpp與 dump_stack.h)&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;dump_stack.h&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#ifdef __cplusplus&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;extern &quot;C&quot; {&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#endif&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;void dump_stack_android(void);&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#ifdef __cplusplus&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#endif&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;dump_stack.cpp&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#include &quot;dump_stack.h&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#include &amp;lt;utils/CallStack.h&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;using namespace android;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;extern &quot;C&quot;{&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;void dump_stack_android(void)&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;{&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;CallStack stack;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;stack.update();&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;stack.dump(&quot;XXX&quot;);&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;}&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;如果你所使用是Android 4.4 之後&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;請改用&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#include &quot;dump_stack.h&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;#include &amp;lt;utils/CallStack.h&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;using namespace android;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;extern &quot;C&quot;{&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;void dump_stack_android(void)&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;{&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;CallStack stack;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;stack.update();&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;stack.log(&quot;XXX&quot;);&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;}&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;同樣地, Android.mk也需要修改&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;LOCAL_SRC_FILES := \&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;…... \&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dump_stack.cpp&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;LOCAL_SHARED_LIBRARIES += libutils&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;接下來在C file中要使用時只要&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;extern void dump_stack_android();&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;void function_a()&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;…&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;dump_stack_android();&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;…&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;[ Call Stack 沒有出現 function name]&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;有時我們會發現在C++ 或 C 語言中使用 CallStack , 在 call dump 中並沒有出現 function name&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #00 &amp;nbsp;pc 00001b90 &amp;nbsp;/system/lib/hw/audio.primary.mrvl.so (dump_stack_android+19)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #01 &amp;nbsp;pc 00004b56 &amp;nbsp;/system/lib/hw/audio.primary.mrvl.so&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #02 &amp;nbsp;pc 0001f828 &amp;nbsp;/system/lib/libaudioflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #03 &amp;nbsp;pc 00019138 &amp;nbsp;/system/lib/libaudioflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #04 &amp;nbsp;pc 00023bb6 &amp;nbsp;/system/lib/libaudioflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #05 &amp;nbsp;pc 0000e9fe &amp;nbsp;/system/lib/libutils.so (android::Thread::_threadLoop(void*)+213)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #06 &amp;nbsp;pc 0000e530 &amp;nbsp;/system/lib/libutils.so&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #07 &amp;nbsp;pc 0000d208 &amp;nbsp;/system/lib/libc.so (__thread_entry+72)&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;D/XXX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;( &amp;nbsp;147): #08 &amp;nbsp;pc 0000d3a4 &amp;nbsp;/system/lib/libc.so (pthread_create+240)&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; 我們追一下 CallStack 是如何被實作&lt;br /&gt;
先回顧一下 CallStack 是如何被使用 (以 Android 4.4 為例)&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPKPx46bHRYJVdLMbyR1VV5k0zOWlmvj9HyblEW3Fi5w3JvWH2oTF4KCMPrdpGh3TfsQLweSHG4mLl-3IP1wNIReU60WzuJGpmvoDbOtmJ1g6t26GoAQxDjAOKXVgzxbdpESmmoA/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; CallStack stack;  
 stack.update();  
 stack.log();  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
先看一下 update( ) function 的定義 ( it is under system/core/include/utils/CallStack.h)&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPKPx46bHRYJVdLMbyR1VV5k0zOWlmvj9HyblEW3Fi5w3JvWH2oTF4KCMPrdpGh3TfsQLweSHG4mLl-3IP1wNIReU60WzuJGpmvoDbOtmJ1g6t26GoAQxDjAOKXVgzxbdpESmmoA/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;   // Immediately collect the stack traces for the specified thread.  
   void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH, pid_t tid=CURRENT_THREAD);  
&lt;/code&gt;&lt;/pre&gt;
所以透過 update( ) function, 我們可以設定想看哪一個 thread 並 dump 出多少層的 call stack, 如果都沒寫, 就是以當前的 thread 去做 call stack dump, update( ) function 會將實際可以 dump 多少的 frame 給抓出來, 其中 frame 的數量記錄在 mCount 變數, 各 frame 的資訊則記錄在 mStack[ ] 裡面, 接下來再透過 log( ) function 把 call stack 裡的 program counter 所記載的記憶體位址去把相對應的 function name 給解析出來.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPKPx46bHRYJVdLMbyR1VV5k0zOWlmvj9HyblEW3Fi5w3JvWH2oTF4KCMPrdpGh3TfsQLweSHG4mLl-3IP1wNIReU60WzuJGpmvoDbOtmJ1g6t26GoAQxDjAOKXVgzxbdpESmmoA/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; log( )  
 |--&amp;gt; print( )  
    |--&amp;gt; get_backtrace_symbols( )  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
看一下 get_backtrace_symbols( ) 在做些什麼&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-left: 0pt;&quot;&gt;
&lt;table style=&quot;border-collapse: collapse; border: none; width: 624px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;*&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 0px;&quot;&gt;&lt;td style=&quot;border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;void get_backtrace_symbols(const backtrace_frame_t* backtrace, size_t frames,&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;backtrace_symbol_t* backtrace_symbols) {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;...&amp;nbsp;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;for (size_t i = 0; i &amp;lt; frames; i++) {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Dl_info info;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;if (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;dladdr&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;((const void*)frame-&amp;gt;absolute_pc, &amp;amp;info) &amp;amp;&amp;amp; info.dli_sname) {&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;symbol-&amp;gt;relative_symbol_addr = (uintptr_t)info.dli_saddr&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;- (uintptr_t)info.dli_fbase;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;symbol-&amp;gt;symbol_name = strdup(info.dli_sname);&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;symbol-&amp;gt;demangled_name = &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;demangle_symbol_name(symbol-&amp;gt;symbol_name);&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &amp;nbsp;&amp;nbsp;...&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;release_my_map_info_list(milist);&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;這是因為它是使用 dladdr() 去讀取該share lib的 dynamic symbol 而獲取 function name&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;(&lt;a href=&quot;http://stackoverflow.com/questions/11731229/dladdr-doesnt-return-the-function-name&quot; style=&quot;text-decoration: none;&quot;&gt;http://stackoverflow.com/questions/11731229/dladdr-doesnt-return-the-function-name&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; )&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;但是如果該 function 是宣告成 static, 該 function name 就不會出現在 dynamic symbol 裡 (你可以使用 arm-linux-androideabi-nm -D xxxx.so | grep the_function_name , 如果沒有出現, 就表示該 funciton name 並不在 dynamic symbol 裡), &amp;nbsp;遇到這情況就只好使用 add2line 指令去讀 out folder 下的 symbol 了, 各位可以參考我另一篇文章 &lt;a href=&quot;http://janbarry0914.blogspot.tw/2011/07/android-crash-tombstone.html&quot;&gt;http://janbarry0914.blogspot.tw/2011/07/android-crash-tombstone.html&lt;/a&gt; . 感謝.&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;post-title entry-title&quot; itemprop=&quot;name&quot;&gt;
&amp;nbsp;&lt;/h3&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/7485458341418681146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/7485458341418681146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/7485458341418681146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/7485458341418681146'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/06/android-level-user-space-kernel-space.html' title='如何在 Android 各 level ( 包含 user space 與 kernel space ) 使用dump call stack的方法'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-8502518322683480598</id><published>2015-06-23T10:21:00.000+08:00</published><updated>2015-06-23T10:21:23.467+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Debug"/><title type='text'>當Android crash 該如何有效利用tombstone</title><content type='html'>資料來: &lt;a href=&quot;http://janbarry0914.blogspot.tw/2011/07/android-crash-tombstone.html&quot; target=&quot;_blank&quot;&gt;當Android crash 該如何有效利用tombstone &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
當Android發生crash時會產生一個類似core dump的檔案在&amp;nbsp;&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;/data/tombstones/tombstone_XX where XX is a number increased by one with each crash. 我們要如何使用該檔案呢?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;tombstones_XX 檔案內容如下, 我們可以利用addr2line將pc所指的位置的function name給找出來&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;pid: 153, tid: 161 &amp;nbsp;&amp;gt;&amp;gt;&amp;gt; system_server &amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 43bf3000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;r0 003dc4a0 &amp;nbsp;r1 43bf3000 &amp;nbsp;r2 00000400 &amp;nbsp;r3 00000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;r4 002cbc98 &amp;nbsp;r5 002cbc98 &amp;nbsp;r6 00000000 &amp;nbsp;r7 00000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;r8 00000001 &amp;nbsp;r9 00000140 &amp;nbsp;10 00000019 &amp;nbsp;fp 00301e04&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;ip 8090a1e0 &amp;nbsp;sp 43f1eb68 &amp;nbsp;lr 80c92cbb &amp;nbsp;pc afd0cdfc &amp;nbsp;cpsr 20000010&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d0 &amp;nbsp;003b3a700033c9f8 &amp;nbsp;d1 &amp;nbsp;00301280002eb23b&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d2 &amp;nbsp;000000000000003b &amp;nbsp;d3 &amp;nbsp;0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d4 &amp;nbsp;43bbc00043bb8000 &amp;nbsp;d5 &amp;nbsp;43d4800043bb8000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d6 &amp;nbsp;3f80000000000000 &amp;nbsp;d7 &amp;nbsp;000001e03f000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d8 &amp;nbsp;0000000000000000 &amp;nbsp;d9 &amp;nbsp;0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d10 0000000000000000 &amp;nbsp;d11 0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d12 0000000000000000 &amp;nbsp;d13 0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d14 0000000000000000 &amp;nbsp;d15 0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d16 3effff003effff00 &amp;nbsp;d17 3f80000041808889&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d18 3f80000041c4cccd &amp;nbsp;d19 0701070100700798&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d20 0000000000000c27 &amp;nbsp;d21 0000043f00890000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d22 0000000000000000 &amp;nbsp;d23 0000000000000008&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d24 3fc74721cad6b0ed &amp;nbsp;d25 3fc39a09d078c69f&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d26 0000000000000000 &amp;nbsp;d27 0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d28 0000000000000000 &amp;nbsp;d29 0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;d30 0000000000000000 &amp;nbsp;d31 0000000000000000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;scr 20000010&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#00 &amp;nbsp;pc 0000cdfc &amp;nbsp;/system/lib/libc.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#01 &amp;nbsp;pc 00092cb8 &amp;nbsp;/system/lib/egl/libGLESv2_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#02 &amp;nbsp;pc 00093814 &amp;nbsp;/system/lib/egl/libGLESv2_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#03 &amp;nbsp;pc 00093890 &amp;nbsp;/system/lib/egl/libGLESv2_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#04 &amp;nbsp;pc 000938bc &amp;nbsp;/system/lib/egl/libGLESv2_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#05 &amp;nbsp;pc 00095cce &amp;nbsp;/system/lib/egl/libGLESv2_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#06 &amp;nbsp;pc 0006526a &amp;nbsp;/system/lib/egl/libGLESv2_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#07 &amp;nbsp;pc 000655cc &amp;nbsp;/system/lib/egl/libGLESv2_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#08 &amp;nbsp;pc 000188c4 &amp;nbsp;/system/lib/egl/libGLESv1_CM_adreno200.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#09 &amp;nbsp;pc 000265ca &amp;nbsp;/system/lib/libsurfaceflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#10 &amp;nbsp;pc 0001b04c &amp;nbsp;/system/lib/libsurfaceflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#11 &amp;nbsp;pc 0001bda8 &amp;nbsp;/system/lib/libsurfaceflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#12 &amp;nbsp;pc 0001bf52 &amp;nbsp;/system/lib/libsurfaceflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#13 &amp;nbsp;pc 00020f3c &amp;nbsp;/system/lib/libsurfaceflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#14 &amp;nbsp;pc 00023df6 &amp;nbsp;/system/lib/libsurfaceflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#15 &amp;nbsp;pc 000259de &amp;nbsp;/system/lib/libsurfaceflinger.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#16 &amp;nbsp;pc 0001c52c &amp;nbsp;/system/lib/libutils.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#17 &amp;nbsp;pc 0001ca8a &amp;nbsp;/system/lib/libutils.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#18 &amp;nbsp;pc 00011bc4 &amp;nbsp;/system/lib/libc.so&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#19 &amp;nbsp;pc 00011790 &amp;nbsp;/system/lib/libc.so&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;1. Android 產生出來的還沒進行strip的&lt;/span&gt;&lt;span style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;執行檔或shared libraries 是放在&lt;/span&gt;$android_root/out/target/product/YOUR_PRODUCT_NAME/symbols/system/bin   與&amp;nbsp;$android_root/out/target/product/YOUR_PRODUCT_NAME/symbols/system/lib目 錄下&lt;/div&gt;
&lt;div&gt;
2. Android所使用的toolchain是放在$android_root/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/ 下面&lt;/div&gt;
&lt;div&gt;
3. 假設我們要看&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;#09 &amp;nbsp;pc 000265ca &amp;nbsp;/system/lib/libsurfaceflinger.so 是 call 到哪一個function&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp;(假設&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;tombstone_XX 是在 $android_root 目錄下&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; $ ./&lt;/span&gt;prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-addr2line  -f -e ./out/target/product/YOUR_PRODUCT_NAME/symbols/system/lib/&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;libsurfaceflinger.so &amp;nbsp;0x&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;000265ca &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&amp;nbsp; 它會show出&lt;/span&gt;_ZN7android14TextureManager12initEglImageEPNS_5ImageEPvRKNS_2spINS_13GraphicBufferEEE&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; $android_root/frameworks/base/services/surfaceflinger/TextureManager.cpp:164&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;這樣的訊息&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 15px;&quot;&gt;參考網站:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://crazydaks.com/debugging-in-android-with-tombstones.html&quot;&gt;http://crazydaks.com/debugging-in-android-with-tombstones.html&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/8502518322683480598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/8502518322683480598' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8502518322683480598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8502518322683480598'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/06/android-crash-tombstone.html' title='當Android crash 該如何有效利用tombstone'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-6292337337342020035</id><published>2015-06-01T23:23:00.000+08:00</published><updated>2015-06-01T23:23:19.512+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Debug"/><category scheme="http://www.blogger.com/atom/ns#" term="kernel"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>How do you read a segfault kernel log message</title><content type='html'>Reference: &lt;a href=&quot;http://stackoverflow.com/questions/2179403/how-do-you-read-a-segfault-kernel-log-message&quot; target=&quot;_blank&quot;&gt;How do you read a segfault kernel log message&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This can be a very simple question, I&#39;m am attempting to debug an application which generates the following segfault error in the kern.log&lt;br /&gt;
&lt;br /&gt;
kernel: myapp[15514]: segfault at 794ef0 ip 080513b sp 794ef0 error 6 in myapp[8048000+24000]&lt;br /&gt;
&lt;br /&gt;
Here are my questions:&lt;br /&gt;
&lt;br /&gt;
Is there any documentation as to what are the diff error numbers on segfault, in this instance it is error 6, but i&#39;ve seen error 4, 5&lt;br /&gt;
&lt;br /&gt;
What is the meaning of the information at bf794ef0 ip 0805130b sp bf794ef0 and myapp[8048000+24000]?&lt;br /&gt;
&lt;br /&gt;
So far i was able to compile with symbols, and when i do a x 0x8048000+24000 it returns a symbol, is that the correct way of doing it? My assumptions thus far are the following:&lt;br /&gt;
&lt;br /&gt;
sp = stack pointer?&lt;br /&gt;
ip = instruction pointer&lt;br /&gt;
at = ????&lt;br /&gt;
myapp[8048000+24000] = address of symbol?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Based on my limited knowledge, your assumptions are correct.&lt;br /&gt;
&lt;br /&gt;
sp = stack pointer&lt;br /&gt;
ip = instruction pointer&lt;br /&gt;
myapp[8048000+24000] = address&lt;br /&gt;
&lt;br /&gt;
If I were debugging the problem I would modify the code to produce a core dump or log a stack backtrace on the crash. You might also run the program under (or attach) GDB.&lt;br /&gt;
&lt;br /&gt;
The error code is just the architectural error code for page faults and seems to be architecture specific. They are often documented in arch/*/mm/fault.c in the kernel source. My copy of Linux/arch/i386/mm/fault.c has the following definition for error_code:&lt;br /&gt;
&lt;br /&gt;
bit 0 == 0 means no page found, 1 means protection fault&lt;br /&gt;
bit 1 == 0 means read, 1 means write&lt;br /&gt;
bit 2 == 0 means kernel, 1 means user-mode&lt;br /&gt;
&lt;br /&gt;
My copy of Linux/arch/x86_64/mm/fault.c adds the following:&lt;br /&gt;
&lt;br /&gt;
bit 3 == 1 means fault was an instruction fetch&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Answer:&lt;br /&gt;
&lt;br /&gt;
When the report points to a program, not a shared library&lt;br /&gt;
&lt;br /&gt;
Run addr2line -e myapp 080513b (and repeat for the other instruction pointer values given) to see where the error is happening. Better, get a debug-instrumented build, and reproduce the problem under a debugger such as gdb.&lt;br /&gt;
If it&#39;s a shared library&lt;br /&gt;
&lt;br /&gt;
In the libfoo.so[NNNNNN+YYYY] part, the NNNNNN is where the library was loaded. Subtract this from the instruction pointer (ip) and you&#39;ll get the offset into the .so of the offending instruction. Then you can use objdump -DCgl libfoo.so and search for the instruction at that offset. You should easily be able to figure out which function it is from the asm labels. If the .so doesn&#39;t have optimizations you can also try using addr2line -e libfoo.so &lt;offset&gt;.&lt;br /&gt;
What the error means&lt;br /&gt;
&lt;br /&gt;
Here&#39;s the breakdown of the fields:&lt;br /&gt;
&lt;br /&gt;
address - the location in memory the code is trying to access (it&#39;s likely that 10 and 11 are offsets from a pointer we expect to be set to a valid value but which is instead pointing to 0)&lt;br /&gt;
ip - instruction pointer, ie. where the code which is trying to do this lives&lt;br /&gt;
sp - stack pointer&lt;br /&gt;
error - Architecture-specific flags; see arch/*/mm/fault.c for your platform.&lt;br /&gt;
&lt;br /&gt;
&lt;/offset&gt;</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/6292337337342020035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/6292337337342020035' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/6292337337342020035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/6292337337342020035'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/06/how-do-you-read-segfault-kernel-log.html' title='How do you read a segfault kernel log message'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-801589784427610303</id><published>2015-05-23T02:44:00.003+08:00</published><updated>2015-05-23T02:45:30.874+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d-x"/><category scheme="http://www.blogger.com/atom/ns#" term="cpp"/><title type='text'>Implement Camera (former: CCCamera) v2 in cocos2d-x v3.3</title><content type='html'>Reference: &lt;a href=&quot;http://gamedev.stackexchange.com/questions/90117/implement-camera-former-cccamera-v2-in-cocos2d-x-v3-3&quot; target=&quot;_blank&quot;&gt;Implement Camera (former: CCCamera) v2 in cocos2d-x v3.3&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
we want to port camera code from cocos2d-x version 2 to version 3.3 with the goal to imitate the behaviour of a CCCamera in cocos2d-x version 2 exactly.&lt;br /&gt;
&lt;br /&gt;
You can assume that values for &quot;eye&quot; and &quot;up&quot; are calculated correctly.&lt;br /&gt;
&lt;br /&gt;
Old code operating on CCCamera:&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;camera-&amp;gt;setEyeXYZ(eye.x, eye.y, 0);
camera-&amp;gt;setCenterXYZ(eye.x, eye.y, -1);
camera-&amp;gt;setUpXYZ(up.x, up.y, 0);
&lt;/pre&gt;New code operating on Camera:&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;camera-&amp;gt;setPosition3D(Vec3(eye.x, eye.y, 0.0f));
camera-&amp;gt;lookAt(Vec3(eye.x, eye.y, -1), Vec3(up.x, up.y, 0.0f));
&lt;/pre&gt;The setPosition3D part works fine and this is also a good indicator that I&#39;ve set up the camera correctly in terms of setCameraFlag and Mask, correct layers, etc. but for some reason the tilting (modification of the up vector) doesn&#39;t work fine, it&#39;s kind of hard to describe, but it doesn&#39;t seem that the view matrix is calculated as intended.&lt;br /&gt;
&lt;br /&gt;
The examples only contain code with fixed up vectors, e.g. Vec3(0, 1, 0), but I really need a dynamic one.&lt;br /&gt;
&lt;br /&gt;
Thanks in advance, Chris</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/801589784427610303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/801589784427610303' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/801589784427610303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/801589784427610303'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/implement-camera-former-cccamera-v2-in.html' title='Implement Camera (former: CCCamera) v2 in cocos2d-x v3.3'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-9124403208850373014</id><published>2015-05-23T02:37:00.000+08:00</published><updated>2015-05-23T02:37:54.018+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d-x"/><category scheme="http://www.blogger.com/atom/ns#" term="cpp"/><title type='text'>&amp;nbsp;Cocos2d-x v3 C++ Tutorial 36 - Touch Began Using onTouchBegan - 學習筆記</title><content type='html'>資料來源: &lt;a href=&quot;https://www.youtube.com/watch?v=QiXNP2X-kIk&amp;list=PLRtjMdoYXLf4od_bOKN3WjAPr7snPXzoe&amp;index=36&quot; target=&quot;_blank&quot;&gt;Cocos2d-x v3 C++ Tutorial 36 - Touch Began Using onTouchBegan&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* 如何在 Cocos2d-x v3.6 C++ 收 onTouchBegan 事件&lt;br /&gt;
** 增加下列代碼在 cpp init 函數&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;auto listener = EventListenerTouchOneByOne::create();
listener-&amp;gt;setSwallowTouches(true);
listener-&amp;gt;onTouchBegan = CC_CALLBACK_2(HelloWorld::onTouchBegan, this);
_eventDispatcher-&amp;gt;addEventListenerWithSceneGraphPriority(listener, this);&lt;/pre&gt;&lt;br /&gt;
** 增加下列代碼(函數)在 cpp 檔&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;bool HelloWorld::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCLOG(&quot;onTouchBegan x = %f, y = %f&quot;, touch-&amp;gt;getLocation().x, touch-&amp;gt;getLocation().y);
&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;
}&lt;/pre&gt;&lt;br /&gt;
** 增加下列代碼(函數宣告) 在 header 檔&lt;br /&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/9124403208850373014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/9124403208850373014' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/9124403208850373014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/9124403208850373014'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/v3-c-tutorial-36-touch-began-using.html' title='&amp;nbsp;Cocos2d-x v3 C++ Tutorial 36 - Touch Began Using onTouchBegan - 學習筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-7082133064258889559</id><published>2015-05-17T19:43:00.000+08:00</published><updated>2015-05-17T19:43:35.686+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 游戲開發基礎 10 - 時間調度 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* 為什麼需要時間調度&lt;br /&gt;
* schedule() 方法的使用&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; this.schedule(&quot;func&quot;, 1)&lt;br /&gt;
// delta 往往用來表示增量，在當前的例子當中，該變量的值為上次調用 fun 函數與這次調用 fun 函數之間的時間差&lt;br /&gt;
public void fun(float delta) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;調用的 fun 函數, delta 的值為 &quot; + delta);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
* delta 參數的作用&lt;br /&gt;
** delta 為上次和這次執行函數 func 的時間差&lt;br /&gt;
* unschedule() 方法的使用&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; this.unschedule(&quot;func&quot;)&lt;br /&gt;
* 總結 </content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/7082133064258889559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/7082133064258889559' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/7082133064258889559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/7082133064258889559'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-10-android-httpwww.html' title='cocos2d android Java 游戲開發基礎 10 - 時間調度 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-4363971017825259703</id><published>2015-05-16T17:16:00.002+08:00</published><updated>2015-05-16T17:16:28.498+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 游戲開發基礎 9 - 觸屏事件 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* Android 平台觸摸事件回顧&lt;br /&gt;
* 設置圖層接收觸摸事件&lt;br /&gt;
** this.setIsTouchEnabled(true)&lt;br /&gt;
* 觸摸回調函數&lt;br /&gt;
** ccTouchesBegan(), ccTouchesMoved(), ccTouchesEnded()&lt;br /&gt;
* 觸摸點坐標轉換&lt;br /&gt;
** CCDirector.sharedDirector().convertToGL(CGPoint)&lt;br /&gt;
* 總結</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/4363971017825259703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/4363971017825259703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/4363971017825259703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/4363971017825259703'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-9.html' title='cocos2d android Java 游戲開發基礎 9 - 觸屏事件 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-4255480930685899506</id><published>2015-05-16T02:14:00.000+08:00</published><updated>2015-05-16T02:14:18.780+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 游戲開發基礎 8 - CCAction 初步 (四)學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* CCFadeIn 與 CCFadeOut&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCFadeIn ccFadeIn = CCFadeIn.action(3);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(ccFadeIn);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCFadeOut ccFadeOut = CCFadeOut.action(3);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(ccFadeOut);&lt;br /&gt;
&lt;br /&gt;
* CCTintTo 與 CCTintBy&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ccColor3B color3b = ccColor3B.ccc3(0, 0, 255);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCTintTo ccTintTo = CCTintTo.action(3, color3b);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(ccTintTo);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ccColor3B color3b = ccColor3B.ccc3(-120, -255, -120);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCTintBy ccTintBy = CCTintBy.action(3, color3b);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(ccTintBy); &lt;br /&gt;
&lt;br /&gt;
* CCRepeat&lt;br /&gt;
&amp;nbsp; &amp;nbsp; CGPoint cgPoint = CGPoint.ccp(100, 300); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint targetPoint = CGPoint.ccp(400, 300);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCMoveTo moveTo1 = CCMoveTo.action(2, targetPoint);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCMoveTo moveTo2 = CCMoveTo.action(2, cgPoint);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCSequence ccSequence = CCSequence.actions(moveTo1, moveTo2);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ﻿﻿﻿﻿CCRepeat ccRepeat = CCRepeat.action(ccSequence, 3);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(ccRepeat);&lt;br /&gt;
&lt;br /&gt;
* CCRepeatForever&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCRepeatForever ccRepeatForever &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;CCRepeatForever&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;.&lt;/span&gt;action(ccSequence);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player&lt;span class=&quot;pl-k&quot;&gt;.&lt;/span&gt;runAction(ccRepeatForever); &lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/4255480930685899506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/4255480930685899506' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/4255480930685899506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/4255480930685899506'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-8-ccaction.html' title='cocos2d android Java 游戲開發基礎 8 - CCAction 初步 (四)學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-8988208636909458503</id><published>2015-05-14T20:25:00.000+08:00</published><updated>2015-05-14T20:25:07.807+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="priority inversion"/><category scheme="http://www.blogger.com/atom/ns#" term="RTOS"/><title type='text'>Priority inversion learning note</title><content type='html'>* Bounded priority inversion&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9UQngUzGS8OCwF4obxw8JeZFuvf-6usQzhSImXGG6ucmGMFENNpXmGOFOEhEwTWwHMh56HHnfN84avSnBzRLfdPQqP-SRDCaBGHYm78te5O6g2YgQlSzYUpdK-jicHzuEXXfsZw/s1600/bounded_inversion.gif&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9UQngUzGS8OCwF4obxw8JeZFuvf-6usQzhSImXGG6ucmGMFENNpXmGOFOEhEwTWwHMh56HHnfN84avSnBzRLfdPQqP-SRDCaBGHYm78te5O6g2YgQlSzYUpdK-jicHzuEXXfsZw/s320/bounded_inversion.gif&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* Unbounded priority inversion&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuRZya3QiFrbNBe587hTopf5gmwaiyIC-fQiNrStwercAGvX4bYnoYtR4emjvPB5rZVqHExUmlMRT0T2119QUnKyUNzwHfh63AGRpgmTrLukEKj4V3bS-vQ7XkKjFpIWeIkyaPBw/s1600/unbounded_inversion.gif&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuRZya3QiFrbNBe587hTopf5gmwaiyIC-fQiNrStwercAGvX4bYnoYtR4emjvPB5rZVqHExUmlMRT0T2119QUnKyUNzwHfh63AGRpgmTrLukEKj4V3bS-vQ7XkKjFpIWeIkyaPBw/s320/unbounded_inversion.gif&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
How to solve&lt;br /&gt;
* Priority inheritance protocol&lt;br /&gt;
Raised the low priority task which locked shared resource to high priority to finish task and release shared resource soon.&lt;br /&gt;
&lt;br /&gt;
* Priority ceiling protocol&lt;br /&gt;
** OCPP: Original Ceiling Priority Protocol&lt;br /&gt;
Raised the task (locked resource) priority to high priority when another task tries to acquire shared resource.&lt;br /&gt;
&lt;br /&gt;
** ICPP: Immediate Ceiling Priority Protocol&lt;br /&gt;
Raised the task priority to high priority when it acquires resource.&lt;br /&gt;
&lt;br /&gt;
Reference:&lt;br /&gt;
http://en.wikipedia.org/wiki/Priority_inheritance&lt;br /&gt;
http://en.wikipedia.org/wiki/Priority_ceiling_protocol&lt;br /&gt;
http://blog.linux.org.tw/~jserv/archives/001299.html&lt;br /&gt;
http://oss.org.cn/ossdocs/rt_embed/rt/priority.html&lt;br /&gt;
http://wen00072-blog.logdown.com/posts/183461-note-priority-inversion-on-mars&lt;br /&gt;
http://www.embedded.com/design/configurable-systems/4024970/How-to-use-priority-inheritance</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/8988208636909458503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/8988208636909458503' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8988208636909458503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8988208636909458503'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/priority-inversion-learning-note.html' title='Priority inversion learning note'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9UQngUzGS8OCwF4obxw8JeZFuvf-6usQzhSImXGG6ucmGMFENNpXmGOFOEhEwTWwHMh56HHnfN84avSnBzRLfdPQqP-SRDCaBGHYm78te5O6g2YgQlSzYUpdK-jicHzuEXXfsZw/s72-c/bounded_inversion.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-5966786353044697614</id><published>2015-05-14T20:24:00.000+08:00</published><updated>2015-05-14T20:24:17.402+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 游戲開發基礎 7 - CCAction 初步 (三) 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* CCSequence 的使用方法&lt;br /&gt;
** 一連串的動作依序執行&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint targetPoint = CGPoint.ccp(500, 500);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCMoveTo moveTo = CCMoveTo.action(5, targetPoint);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCRotateTo rotateTo = CCRotateTo.action(5, 180);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCScaleTo scaleTo = CCScaleTo.action(2, 2);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCSequence ccSequence = CCSequence.actions(moveTo, rotateTo, scaleTo);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; player.runAction(ccSequence); &lt;br /&gt;
&lt;br /&gt;
* CCSpawn 的使用方法&lt;br /&gt;
** 一連串的動作同時間執行&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCSpawn ccSpawn = CCSpawn.actions(moveTo, rotateTo, scaleTo);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(ccSpawn);&lt;br /&gt;
&lt;br /&gt;
* CCCallfuncN 的使用方法&lt;br /&gt;
** 用於一個動作作完後所要執行的動作&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCCallFuncN funcN = CCCallFuncN.action(this, &quot;onActionFinished&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; player.runAction(funcN); &lt;br /&gt;
&lt;br /&gt;
* CCFollow 的使用方法&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCFollow ccFollow = CCFollow.action(followedNode, rect);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(ccFollow);&lt;br /&gt;
* 總結 </content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/5966786353044697614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/5966786353044697614' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/5966786353044697614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/5966786353044697614'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-7-ccaction.html' title='cocos2d android Java 游戲開發基礎 7 - CCAction 初步 (三) 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-5751460339622683532</id><published>2015-05-14T20:11:00.000+08:00</published><updated>2015-05-14T20:13:03.934+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 游戲開發基礎 6 - CCAction 初步 (二) 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* 什麼是向量&lt;br /&gt;
* 基于向量的計算&lt;br /&gt;
** 向量的加減法&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint deltaPoint = CGPoint.ccp(0, 200);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint targetPoint = CGPoint.ccpAdd(cgPoint, deltaPoint);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; CGPoint subPoint = CGPoint.ccp(200, 300);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint tgPoint = CGPoint.ccpSub(targetPoint, subPoint);&lt;br /&gt;
** 向量的乘除法&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint newPoint = CGPoint.ccpMult(tgPoint, 2);&lt;br /&gt;
** 計算單位向量&lt;br /&gt;
* 使用 CGPoint 對象代表向量&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint anotherPoint = CGPoint.ccpNormalize(tgPoint);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
* 基于向量的運算&lt;br /&gt;
* CCMoveBy 與 CCJumpBy&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint onePoint = CGPoint.ccp(500, 300);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCMoveBy moveBy = CCMoveBy.action(5, onePoint);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint jumpPoint = CGPoint.ccp(300, 100);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCJumpBy jumpBy = CCJumpBy.action(5, deltaPoint, 500, 5);&lt;br /&gt;
* 總結 </content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/5751460339622683532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/5751460339622683532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/5751460339622683532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/5751460339622683532'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-6-ccaction-android.html' title='cocos2d android Java 游戲開發基礎 6 - CCAction 初步 (二) 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-4341839698313175080</id><published>2015-05-12T20:13:00.001+08:00</published><updated>2015-05-14T20:12:38.467+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 游戲開發基礎 5 - CCAction 初步 (一) 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* 動作類的基本概念&lt;br /&gt;
** 動作類對象通常不會單獨存在&lt;br /&gt;
** 動作類對象需要作用在精靈，圖層等對象上才能發揮作用&lt;br /&gt;
** 動作類包含有很多種類型，例如位移，縮放和旋轉等&lt;br /&gt;
&lt;br /&gt;
* 動作類的分類方法&lt;br /&gt;
** CCAction -- CCFiniteTimeAction -- CCActionInstant&lt;br /&gt;
**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; |- CCActionInterval&lt;br /&gt;
**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; |- CCFollow&lt;br /&gt;
**&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |- CCSpeed&lt;br /&gt;
&lt;br /&gt;
* 基礎瞬時動作使用方法 - CCActionInstant&lt;br /&gt;
**&amp;nbsp;&amp;nbsp; 動作&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 描述&lt;br /&gt;
** CCFlipX&amp;nbsp; X軸鏡像翻轉&lt;br /&gt;
** CCFlipY&amp;nbsp; Y軸鏡像翻轉&lt;br /&gt;
** CCHide&amp;nbsp;&amp;nbsp; 隱藏&lt;br /&gt;
** CCShow&amp;nbsp;&amp;nbsp; 顯示&lt;br /&gt;
&lt;br /&gt;
* 基礎延時動作使用方法 - CCActionInterval&lt;br /&gt;
**&amp;nbsp;&amp;nbsp; 動作&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 描述&lt;br /&gt;
** CCMoveTo&amp;nbsp;&amp;nbsp;&amp;nbsp; 移動至目標&lt;br /&gt;
** CCRotateTo&amp;nbsp; 旋轉至指定的角度&lt;br /&gt;
** CCScaleTo&amp;nbsp;&amp;nbsp; 縮放至指定的倍數&lt;br /&gt;
** CCBlink&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 閃爍&lt;br /&gt;
&lt;br /&gt;
* 總結</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/4341839698313175080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/4341839698313175080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/4341839698313175080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/4341839698313175080'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-5-ccaction-android.html' title='cocos2d android Java 游戲開發基礎 5 - CCAction 初步 (一) 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-2173763997111379121</id><published>2015-05-12T20:12:00.003+08:00</published><updated>2015-05-14T20:12:27.217+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 游戲開發基礎 4 - 精靈初體驗 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
* 什麼是精靈&lt;br /&gt;
** 精靈是游戲中的一個元素，通常用於代表畫面當中的一個事物，例如主人公，NPC 和背景元素等等&lt;br /&gt;
** 一個精靈對象通常都與一張圖片關聯&lt;br /&gt;
** 精靈對象通常可以通過運行動作對象 (CCAction) 來產生動畫效果&lt;br /&gt;
&lt;br /&gt;
** 如何生成一個精靈對象&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCSprite player;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player = CCSprite.sprite(&quot;player.png&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
** 讓精靈對象添加至布景層當中&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; this.addChild(player);&lt;br /&gt;
** 運行動作對象 (CCAction)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CGPoint target = CGPoint.ccp(400, 100); // 設定目標座標&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCJumpTo jumpTo = CCJumpTo.action(3, target, 200, 3);&amp;nbsp; //設定 JumpTo(CCAction) 參數說明 (執行3秒, 跳到 target 座標, 跳動高度, 跳動次數)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; player.runAction(jumpTo);&lt;br /&gt;
&lt;br /&gt;
** 總結 </content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/2173763997111379121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/2173763997111379121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2173763997111379121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/2173763997111379121'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-4-android-httpwww.html' title='cocos2d android Java 游戲開發基礎 4 - 精靈初體驗 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-5996263152473113121</id><published>2015-05-12T20:12:00.001+08:00</published><updated>2015-05-14T20:12:17.813+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 遊戲開發基礎 3 - Cocos2d 創世紀 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
*創建第一個 Cocos2d 應用程序&lt;br /&gt;
** 創建一個 Android 應用程序&lt;br /&gt;
** 生成一個 SurfaceView 對象，作為 Activity 當中所顯示的內容&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; view = new CCGLSurfaceView(this);&lt;br /&gt;
** 得到 CCDirector 對象，並通過該對象設置應用程序的各種屬性&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CCDirector director = CCDirector.sharedDirector(); &lt;br /&gt;
&lt;br /&gt;
** 設置應用程序基本屬性&lt;br /&gt;
*** 用於設置應用程序所使用的 GL 視圖對象&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; director.attachInView(mGLSurfaceView) &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
*** 用於設置應用程序的方向&lt;br /&gt;
&amp;nbsp; &amp;nbsp; director.setDeviceOrientation(CCDirector.kCCDeviceOrientationLandscapeLeft); &lt;br /&gt;
*** 設置應用程序是否需要顯示應用程序的 FPS 值&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; director.setDisplayFPS(true); &lt;br /&gt;
*** 設置每幀所需要的時間&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; director.setAnimationInterval(1.0f / 30)&lt;br /&gt;
&lt;br /&gt;
** 生成場景與布景層&lt;br /&gt;
*** 創建一個布景層類，繼承 CCLayer&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public class GameLayer extends CCLayer {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public GameLayer() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
*** 調用 CCScene 類的 node() 方法生成場景對象&lt;br /&gt;
&amp;nbsp; &amp;nbsp; CCScene scene = CCScene.node(); &lt;br /&gt;
*** 生成布景層對象，並添加至場景對象當中&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; GameLayer gameLayer = new GameLayer(); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; scene.addChild(gameLayer);&lt;br /&gt;
*** 執行場景對象&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; director.runWithScene(scene); &lt;br /&gt;
&lt;br /&gt;
** 運行 Cocos2d 應用程序&lt;br /&gt;
** 總結 </content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/5996263152473113121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/5996263152473113121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/5996263152473113121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/5996263152473113121'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-3-cocos2d-android.html' title='cocos2d android Java 遊戲開發基礎 3 - Cocos2d 創世紀 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-8854870142130542114</id><published>2015-05-12T20:11:00.001+08:00</published><updated>2015-05-14T20:12:07.505+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 遊戲開發基礎 2 - 安裝 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
抓包來安裝：到 github 找 cocos2d android, 抓 ZhouWeikuan 的 zip 檔下來套用到 Android 已存在項目.&lt;br /&gt;
修改 library 和把重覆的類改名後，即可編譯。</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/8854870142130542114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/8854870142130542114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8854870142130542114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8854870142130542114'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-2-android-httpwww.html' title='cocos2d android Java 遊戲開發基礎 2 - 安裝 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-530902977934229417</id><published>2015-05-12T00:04:00.002+08:00</published><updated>2015-05-14T20:11:53.834+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>cocos2d android Java 遊戲開發基礎1 - 介紹 學習視頻筆記</title><content type='html'>資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》&lt;a href=&quot;http://www.mobiletrain.org/about/news/android_video3.html&quot;&gt;http://www.mobiletrain.org/about/news/android_video3.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
導演－－場景1－－布景層1 -- 精靈1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;       | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;         |&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;     | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |-- 精靈2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |-- 布景層2&amp;nbsp;&amp;nbsp; |-- 精靈3&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |-- 場景2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |-- 布景層3&amp;nbsp;&amp;nbsp; |-- 精靈4&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - 精靈5&lt;br /&gt;
&lt;br /&gt;
CCDirector: 導演類&lt;br /&gt;
CCScene:    場景類&lt;br /&gt;
CCLayer:    布景層&lt;br /&gt;
CCSprite:   精靈</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/530902977934229417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/530902977934229417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/530902977934229417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/530902977934229417'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2015/05/cocos2d-android-java-1-android-httpwww.html' title='cocos2d android Java 遊戲開發基礎1 - 介紹 學習視頻筆記'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36303554.post-8936891739126505806</id><published>2014-12-29T15:35:00.000+08:00</published><updated>2015-05-12T00:09:49.125+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="xml"/><title type='text'>使用 xmllint 處理/驗證 xml</title><content type='html'>&lt;br /&gt;
&lt;div&gt;
資料來源: &lt;a href=&quot;http://blog.csdn.net/qmhball/article/details/8955588&quot;&gt;http://blog.csdn.net/qmhball/article/details/8955588&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
xmllint是一個很方便的處理及驗證xml的工具，linux下只要安裝libxml2就可以使用這個命令，下面整理一些常用功能&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;1. --format&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
此參數用於格式化xml，使其具有良好的可讀性。&lt;/div&gt;
&lt;div&gt;
假設有xml（person.xml）內容如下:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;person&amp;gt;&amp;lt;name&amp;gt;ball&amp;lt;/name&amp;gt;&amp;lt;age&amp;gt;30&amp;lt;/age&amp;gt;&amp;lt;sex&amp;gt;male&amp;lt;/sex&amp;gt;&amp;lt;/person&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
執行：&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;xmllint&amp;nbsp;--format&amp;nbsp;person.xml&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
得到易讀的xml&lt;br /&gt;
&lt;br /&gt;
&lt;ol class=&quot;dp-xml&quot; start=&quot;1&quot;&gt;&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;person&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;ball&amp;lt;/name&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;age&amp;gt;30&amp;lt;/age&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sex&amp;gt;male&amp;lt;/sex&amp;gt;&amp;nbsp; 
&amp;lt;/person&amp;gt;&lt;/pre&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;2.&amp;nbsp;--noblanks&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
與--format相反，有時為了節省傳輸量，我們希望去掉xml中的空白，這時我們可以使用--noblanks命令。&lt;/div&gt;
&lt;div&gt;
假設xml（person.xml）內容如下&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&amp;nbsp; 
&amp;lt;person&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;name&amp;gt;ball&amp;lt;/name&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;age&amp;gt;30&amp;lt;/age&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;sex&amp;gt;male&amp;lt;/sex&amp;gt;&amp;nbsp; 
&amp;lt;/person&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_html&quot;&gt;
&lt;ol class=&quot;dp-xml&quot; start=&quot;1&quot;&gt;&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
執行：&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;xmllint&amp;nbsp;--noblanks&amp;nbsp;person.xml&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
得到去掉空白後的xml&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_html&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&lt;person&gt;&lt;name&gt;ball&lt;/name&gt;&lt;age&gt;30&lt;/age&gt;&lt;sex&gt;male&lt;/sex&gt;&lt;/person&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;3.--schema&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
使用scheam驗證xml文件的正確性（瞭解schema的知識請猛擊&lt;a href=&quot;http://www.w3school.com.cn/schema/schema_intro.asp&quot; target=&quot;_blank&quot;&gt;這裡&lt;/a&gt;）&lt;/div&gt;
&lt;div&gt;
假設有xml文件（person.xml）和scheam文件（person.xsd）文件，內容分別如下&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
person.xml&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&amp;nbsp; 
&amp;lt;person&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;name&amp;gt;ball&amp;lt;/name&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;age&amp;gt;30&amp;lt;/age&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;sex&amp;gt;male&amp;lt;/sex&amp;gt; 
&amp;lt;/person&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
person.xsd&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_html&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&amp;nbsp; 
&amp;lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;xs:element name=&quot;name&quot; type=&quot;xs:string&quot;/&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;xs:element name=&quot;age&quot; type=&quot;xs:integer&quot;/&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;xs:element name=&quot;sex&quot;&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:simpleType&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:restriction base=&quot;xs:string&quot;&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:enumeration value=&quot;male&quot;/&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:enumeration value=&quot;female&quot;/&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:restriction&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:simpleType&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;/xs:element&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;xs:element name=&quot;person&quot;&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:complexType&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:all&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element ref=&quot;name&quot;/&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element ref=&quot;age&quot;/&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element ref=&quot;sex&quot;/&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:all&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:complexType&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;/xs:element&amp;gt;&amp;nbsp; 
&amp;lt;/xs:schema&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
執行:&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;xmllint&amp;nbsp;--schema&amp;nbsp;person.xsd&amp;nbsp;person.xml&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
得到&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;&lt;person&gt;  
  &lt;name&gt;ball&lt;/name&gt;  
  &lt;age&gt;30&lt;/age&gt;  
  &lt;sex&gt;male&lt;/sex&gt;  
&lt;/person&gt;  
person.xml validates 
&lt;/pre&gt;
&lt;/div&gt;
注意，默認情況下，驗證後會輸出驗證的文件內容，可以使用&amp;nbsp;--noout選項去掉此輸出，這樣我們可以只得到最後的驗證結果。&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
執行&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;xmllint&amp;nbsp;--noout&amp;nbsp;--schema&amp;nbsp;person.xsd&amp;nbsp;person.xml&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
得到&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;person.xml&amp;nbsp;validates&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
下面我們改動person.xml&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_html&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&amp;nbsp; 
&amp;lt;person&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;name&amp;gt;ball&amp;lt;/name&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;age&amp;gt;not age&amp;lt;/age&amp;gt;&amp;nbsp; 
&amp;nbsp; &amp;lt;sex&amp;gt;test&amp;lt;/sex&amp;gt;&amp;nbsp; 
&amp;lt;/person&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
顯然，這份文件age字段和sex都是不符合xsd定義的。&lt;/div&gt;
&lt;div&gt;
執行&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;xmllint&amp;nbsp;--noout&amp;nbsp;--schema&amp;nbsp;person.xsd&amp;nbsp;person.xml&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;得到：&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: 微软雅黑; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;div class=&quot;dp-highlighter bg_plain&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;person.xml:4: element age: Schemas validity error : Element &#39;age&#39;: &#39;not age&#39; is not a valid value of the atomic type &#39;xs:integer&#39;.  
person.xml:5: element sex: Schemas validity error : Element &#39;sex&#39;: [facet &#39;enumeration&#39;] The value &#39;test&#39; is not an element of the set {&#39;male&#39;, &#39;female&#39;}.  
person.xml:5: element sex: Schemas validity error : Element &#39;sex&#39;: &#39;test&#39; is not a valid value of the local atomic type.  
person.xml fails to validate 
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
good！xmllint成功的報出了錯誤！&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;4. 關於--schema的輸出&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
在講輸出之前先看下面一個場景，假如你想通過php執行xmllint然後拿到返回結果，你的代碼通常應該是這個樣子&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
valid.php&lt;/div&gt;
&lt;div class=&quot;dp-highlighter bg_php&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&amp;nbsp; 
$command = &quot;xmllint --noout --schema person.xsd person.xml&quot;;&amp;nbsp; 
exec($command, $output, $retval);&amp;nbsp; 
//出錯時返回值不為0&amp;nbsp; 
if ($retval != 0){&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var_dump($output);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}&amp;nbsp; 
else{&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;yeah!&quot;;&amp;nbsp; 
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
我們保持上文中person.xml的錯誤。&lt;/div&gt;
&lt;div&gt;
執行此代碼，你會發現，你拿到的output不是錯誤，而是array(0) {}, amazing！&lt;/div&gt;
&lt;div&gt;
為什麼會這樣呢？&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
因為xmllint --schema，如果驗證出錯誤，錯誤信息並不是通過標準輸出（stdout）顯示的，而是通過標準錯誤（stderr）進行顯示的。&lt;/div&gt;
&lt;div&gt;
而exec的output參數拿到的，只能是標準輸出（stdout）顯示的內容。&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
所以，為了拿到出錯信息，我們需要將標準錯誤重定向到標準輸出，對應修改代碼：&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;dp-highlighter bg_php&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush:php&quot;&gt;$command&amp;nbsp;=&amp;nbsp;&quot;xmllint&amp;nbsp;--noout&amp;nbsp;--schema&amp;nbsp;person.xsd&amp;nbsp;person.xml&amp;nbsp;2&amp;gt;&amp;amp;1&quot;;&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
再次執行valid.php，錯誤信息順利拿到！&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
附小問題&lt;/div&gt;
&lt;div&gt;
--noout參數關閉的是什麼輸出呢:)&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jimpai.blogspot.com/feeds/8936891739126505806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/36303554/8936891739126505806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8936891739126505806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36303554/posts/default/8936891739126505806'/><link rel='alternate' type='text/html' href='http://jimpai.blogspot.com/2014/12/xmllint-xml-httpblog.html' title='使用 xmllint 處理/驗證 xml'/><author><name>吉姆小窩</name><uri>http://www.blogger.com/profile/12902817884747702105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>