changeset 92:f5766148955f

update
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 05 Feb 2021 19:29:47 +0900
parents 4232c9dc1431
children b1febd693942
files paper/chapter/05-perl.tex paper/final.pdf paper/master_paper.pdf paper/src/debugGenerateStubLog.sh paper/src/debugGenerateStubLog.txt
diffstat 5 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/paper/chapter/05-perl.tex	Fri Feb 05 19:09:08 2021 +0900
+++ b/paper/chapter/05-perl.tex	Fri Feb 05 19:29:47 2021 +0900
@@ -324,3 +324,19 @@
 
 
 \section{ジェネリクスのサポート}
+
+
+\section{generate\_stub.plのデバッグ機能の追加}
+変換されたGearsOSのコードが意図しない結果になっていた場合、 generate\_stub.plのデバッグをする必要がある。
+PerlスクリプトであるのでPerlのデバッガを使えばデバッグは可能である。
+しかし、変換するGearsOSの行数もあり、さらにgenerate\_stub.pl自体の複雑度から、バグを生じている場所の検討をつけるのが難しい。
+
+generate\_stub.plは巨大な正規表現パターンマッチで構成されたスクリプトであるので、 CbCのコードのどの行を呼んでいる時に、 Perlスクリプトのどの行にマッチしたかが重要となる。
+本来マッチしてほしい正規表現パターンにマッチしていないケースは、どの行にマッチしたかのログが解れば一発で確認することができる。
+また、逆に怪しい正規表現パターンの行にPerlデバッガでbreak pointを張ってデバッグすることも可能である。
+
+Perlスクリプトでどの行にマッチしたかの情報は、 Perlの特殊変数\texttt{\_\_LINE\_\_}を利用した。
+この特殊変数は、特殊変数を呼び出したPerlの行番号が取得できるメタAPIである。
+
+\lstinputlisting[label=src:debugGenStubSh, caption=enumの番号が差し替えられたCodeGear]{src/debugGenerateStubLog.sh}
+\lstinputlisting[label=src:debugGenStub, caption=enumの番号が差し替えられたCodeGear]{src/debugGenerateStubLog.txt}
\ No newline at end of file
Binary file paper/final.pdf has changed
Binary file paper/master_paper.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/src/debugGenerateStubLog.sh	Fri Feb 05 19:29:47 2021 +0900
@@ -0,0 +1,1 @@
+$ perl generate_stub.pl --debug examples/DPP2/PhilsImpl.cbc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/src/debugGenerateStubLog.txt	Fri Feb 05 19:29:47 2021 +0900
@@ -0,0 +1,25 @@
+[getDataGear] match 199 : #impl "Phils.h" as "PhilsImpl.h"
+[getDataGear] match 142 : typedef struct Phils <> {
+[getDataGear] match 353 :   __code putdown_lfork(Impl* phils, __code next(...));
+[getDataGear] match 353 :   __code putdown_rfork(Impl* phils, __code next(...));
+[getDataGear] match 353 :   __code thinking(Impl* phils, __code next(...));
+[getDataGear] match 353 :   __code pickup_rfork(Impl* phils, __code next(...));
+[getCodeGear] match 409 : typedef struct Worker<>{
+[getCodeGear] match 414 :     __code taskReceive(Impl* worker, struct Queue* tasks);
+[getCodeGear] match 414 :     __code shutdown(Impl* worker);
+[getCodeGear] match 414 :     __code next(...);
+
+...
+
+[getDataGear] match 330 : } TaskManager;
+[getCodeGear] match 409 : typedef struct TaskManager<>{
+[getCodeGear] match 414 :   __code spawn(Impl* taskManager, struct Context* task, __code next(...));
+[getCodeGear] match 414 :   __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...));
+[getCodeGear] match 414 :   __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...));
+[getCodeGear] match 414 :   __code shutdown(Impl* taskManagerImpl, __code next(...));
+[getCodeGear] match 414 :   __code incrementTaskCount(Impl* taskManagerImpl, __code next(...));
+[getCodeGear] match 414 :   __code decrementTaskCount(Impl* taskManagerImpl, __code next(...));
+[getCodeGear] match 414 :   __code next(...);
+[getCodeGear] match 414 :   __code next1(...);
+[getDataGear] match 159 : Phils* createPhilsImpl(struct Context* context, int id, AtomicT_int* right, AtomicT_int* left) {
+...