啟動 fidlcat 並
並且會開始記錄已傳送的系統呼叫,
是透過 FIDL 接收的。
請查看以下 fidlcat 的基本輸出內容範例:
Monitoring echo_client.cm koid=193974 echo_client.cm 193974:193976 zx_channel_create(options: uint32 = 0) -> ZX_OK (out0: handle = d7e9f83b(channel:0), out1: handle = d6c9fd5f(channel:1))
範例輸出內容包含以下資訊:
echo_client.cm:產生此顯示器的程序名稱。
193974:程序 koid。
193976:執行緒 koid。
zx_channel_create:攔截/顯示系統呼叫的名稱。
系統呼叫輸入參數 (例如 handle 和 options), 名稱、類型和值
系統呼叫傳回值 (
ZX_OK) 和輸出參數
針對代表 FIDL 交易的系統呼叫,fidlcat 會顯示額外
輸入和輸出參數請參閱以下範例
fuchsia.examples/Echo.EchoString 要求:
echo_client.cm 193974:193976 zx_channel_call_etc(handle: handle = Channel:d089f8fb(dir:/svc/fuchsia.examples.Echo), options: uint32 = ZX_CHANNEL_WRITE_USE_IOVEC, deadline: zx.time = ZX_TIME_INFINITE, rd_num_bytes: uint32 = 64, rd_num_handles: uint32 = 64) sent request fuchsia.examples/Echo.EchoString = { value: string = "hello" } -> ZX_OK received response fuchsia.examples/Echo.EchoString = { response: string = "hello" }
請注意顯示輸出內容中的 FIDL 要求和回應訊息,包括 方法名稱和參數
修改顯示畫面
根據預設,fidlcat 只會在
。使用 --with-process-info 旗標,在以下位置加入這些詳細資料:
每一行:
echo_client.cm 60014:60016 zx_channel_call_etc(handle: handle = Channel:35272afb(dir:/svc/fuchsia.examples.Echo), options: uint32 = ZX_CHANNEL_WRITE_USE_IOVEC, deadline: zx.time = ZX_TIME_INFINITE, rd_num_bytes: uint32 = 64, rd_num_handles: uint32 = 64) echo_client.cm 60014:60016 sent request fuchsia.examples/Echo.EchoString = { value: string = "hello" } echo_client.cm 60014:60016 -> ZX_OK echo_client.cm 60014:60016 received response fuchsia.examples/Echo.EchoString = { response: string = "hello" }
堆疊框架
使用 --stack 旗標可顯示每個系統的堆疊框架
呼叫。根據預設 (--stack=0),系統不會顯示堆疊框架。
使用 --stack=1 時,系統只會顯示呼叫站點 (1 到 4 個影格):
echo_client.cm 675407:675409 at zircon/system/ulib/fidl/llcpp_message.cc:243:12 fidl::OutgoingMessage::CallImpl echo_client.cm 675407:675409 zx_channel_call_etc(handle: handle = Channel:8b745347(dir:/svc/fuchsia.examples.Echo), options: uint32 = ZX_CHANNEL_WRITE_USE_IOVEC, deadline: zx.time = ZX_TIME_INFINITE, rd_num_bytes: uint32 = 64, rd_num_handles: uint32 = 64) sent request fuchsia.examples/Echo.EchoString = { value: string = "hello" } -> ZX_OK received response fuchsia.examples/Echo.EchoString = { response: string = "hello" }
這個選項不會增加任何負擔 (顯示畫面除外)。
在 --stack=2 的情況下,所有影格都會顯示:
echo_client.cm 717533:717535 at 3ac285b4811 _start echo_client.cm 717533:717535 at zircon/third_party/ulib/musl/src/env/__libc_start_main.c:215:5 __libc_start_main echo_client.cm 717533:717535 at zircon/third_party/ulib/musl/src/env/__libc_start_main.c:140:3 start_main echo_client.cm 717533:717535 at examples/fidl/llcpp/client_sync/main.cc:30:27 main echo_client.cm 717533:717535 at fidling/gen/examples/fidl/fuchsia.examples/fuchsia.examples/llcpp/fidl/fuchsia.examples/cpp/wire_messaging.h:2711:12 fidl::internal::WireSyncClientImpl<fuchsia_examples::Echo>::EchoString echo_client.cm 717533:717535 at fidling/gen/examples/fidl/fuchsia.examples/fuchsia.examples/llcpp/fidl/fuchsia.examples/cpp/wire_messaging.cc:1051:12 fidl::WireResult<fuchsia_examples::Echo::EchoString>::WireResult echo_client.cm 717533:717535 at zircon/system/ulib/fidl/include/lib/fidl/llcpp/message.h:205:3 fidl::OutgoingMessage::Call<fidl::WireResponse<fuchsia_examples::Echo::EchoString>, zx::unowned<zx::channel> > echo_client.cm 717533:717535 at zircon/system/ulib/fidl/include/lib/fidl/llcpp/message.h:196:5 fidl::OutgoingMessage::Call<fidl::WireResponse<fuchsia_examples::Echo::EchoString> > echo_client.cm 717533:717535 at zircon/system/ulib/fidl/llcpp_message.cc:243:12 fidl::OutgoingMessage::CallImpl echo_client.cm 717533:717535 zx_channel_call_etc(handle: handle = Channel:f751d2fb(dir:/svc/fuchsia.examples.Echo), options: uint32 = ZX_CHANNEL_WRITE_USE_IOVEC, deadline: zx.time = ZX_TIME_INFINITE, rd_num_bytes: uint32 = 64, rd_num_handles: uint32 = 64) sent request fuchsia.examples/Echo.EchoString = { value: string = "hello" } -> ZX_OK received response fuchsia.examples/Echo.EchoString = { response: string = "hello" }
這個選項會增加負擔,因為我們必須要求 zxdb 來取得完整堆疊 ,而 fidlcat 會更完整。應使用 只有在您需要瞭解程式碼的哪些部分稱為系統呼叫時,才需要付費。
篩選輸出內容
Syscalls
根據預設,fidlcat 只會顯示 zx_channel 系統呼叫。
--syscalls 選項可讓您定義選取的規則運算式
以便解碼並顯示內容
如要顯示所有系統呼叫,請使用 --syscalls=".\*"
--exclude-syscalls 旗標會定義要排除的一般到期時間
來自 --syscalls 所選集合的系統呼叫。
系統呼叫必須符合 --syscalls 模式,才能顯示
滿足 --exclude-syscalls 模式。
以下範例顯示所有 Syscall,但 zx_handle 除外:
--syscalls ".\*" --exclude-syscalls "zx_handle_.\*"
訊息
根據預設,fidlcat 會顯示所有訊息。
您可以使用下列方式指定要顯示的訊息:
--messages可讓您指定一或多個規則運算式 訊息必須符合這些條件才會顯示。--exclude-messages可讓您指定一或多個規則運算式 訊息不符合顯示條件
如果同時使用這兩種選項,要顯示的訊息必須
符合其中一個使用 --messages 指定的規則運算式
符合任何使用 --exclude-messages 指定的規則運算式。
訊息篩選適用於方法的完整名稱。例如: 下列標記:
--messages=".*Open"
比對方法包括:
fuchsia.io/Directory.Open
fuchsia.io/Node.OnOpen
執行緒
使用 --thread=<thread koid> 選項時,只有指定中的事件
執行緒之間的關係。這個選項可用於多次顯示
。
分組輸出內容
通訊協定
使用 --with=top 和 --with=top=<path> 選項即可產生
會依程序、通訊協定和方法將輸出內容分組。群組排序依據
事件數,因此相關事件較多的群組會較早顯示。
執行緒
使用 --with=group-by-thread 和 --with=group-by-thread=<path> 選項,即可
會產生檢視畫面,顯示每個執行緒的所有事件簡短版。
延後顯示訊息
根據預設,fidlcat 會在附加完成後立即開始顯示訊息
加入一些計畫
您可以使用 --trigger 選項延後顯示畫面,直到提供
規則運算式比對收到的郵件。
如果在參閱之後需要瞭解情況,這個就能派上用場 或發出特定訊息
摘要檢視
設定 fidlcat 以顯示工作階段的概要摘要,而非顯示
列出個別訊息,請使用選項 --with=summary 和
--with=summary=<path>。
echo_client.cm 1505832: 16 handles
Process:ac4ce043(proc-self)
startup Vmar:a43cfe53(vmar-root)
startup Thread:d5dce00f(thread-self)
startup Channel:91cce2f3(dir:/svc)
write request fuchsia.io/Directory.Open(".")
-> Channel:c65ce1c3(dir:/svc)
startup Channel:daece3fb(dir:/pkg)
startup Socket:cb8ce31f(fd:1)
closed by zx_handle_close
startup Socket:df8ce687(fd:2)
closed by zx_handle_close
startup Channel:93ccfcf7(directory-request:/)
startup Clock:b7ecfe9b()
startup Job:674ce17f(job-default)
startup Vmo:adbcfc9f(vdso-vmo)
startup Vmo:ef2ce06f(stack-vmo)
Channel:c65ce1c3(dir:/svc)
linked to Channel:da9cebcb(channel:1)
created by zx_channel_create
write request fuchsia.io/Directory.Open("fuchsia.examples.Echo")
-> Channel:767ce3f3(dir:/svc/fuchsia.examples.Echo)
closed by zx_handle_close
Channel:da9cebcb(channel:1)
linked to Channel:c65ce1c3(dir:/svc)
created by zx_channel_create
closed by Channel:91cce2f3(dir:/svc) sending fuchsia.io/Directory.Open
Channel:767ce3f3(dir:/svc/fuchsia.examples.Echo)
linked to Channel:f4bce307(channel:3)
created by zx_channel_create
call request fuchsia.examples/Echo.EchoString
write request fuchsia.examples/Echo.SendString
read event fuchsia.examples/Echo.OnString
closed by zx_handle_close
Channel:f4bce307(channel:3)
linked to Channel:767ce3f3(dir:/svc/fuchsia.examples.Echo)
created by zx_channel_create
closed by Channel:c65ce1c3(dir:/svc) sending fuchsia.io/Directory.Open
這裡會列出所有受監控的處理程序、帳號代碼和管道 課程中會有詳細說明
帳號代碼:帳號代碼是否為啟動帳號代碼 (在活動期間沿用 程序建立) 或建立。 如果是非啟動控點,
fidlcat也會顯示 用來建立和關閉每個帳號代碼的系統呼叫。聲道:顯示 以及收發的 FIDL 訊息清單。
持續監控
根據預設,fidlcat 工作階段會在所有附加的程序終止時終止
結束。
使用 --stay-alive 選項,即可讓工作階段保持運作,直到手動為止
結束 fidlcat (例如使用 Ctrl-C 鍵)。
這可以讓您在相同的監控內多次重新啟動程式
會很有幫助每次重新啟動時,fidlcat 工作階段都會附加至新程序
。