sync with master
authorSehong Na <sehong.na@samsung.com>
Wed, 27 Mar 2013 00:28:21 +0000 (09:28 +0900)
committerSehong Na <sehong.na@samsung.com>
Wed, 27 Mar 2013 00:28:21 +0000 (09:28 +0900)
59 files changed:
AUTHOR [new file with mode: 0644]
LICENSE.LGPLv2.1 [new file with mode: 0644]
LICENSE.MIT [new file with mode: 0644]
Makefile [new file with mode: 0644]
NOTICE [new file with mode: 0644]
custom_chart/da_chart.c [new file with mode: 0755]
custom_chart/da_chart.h [new file with mode: 0755]
custom_chart/da_chart_dummy.c [new file with mode: 0755]
helper/addr-capi.c [new file with mode: 0644]
helper/addr-tizen.c [new file with mode: 0644]
helper/btsym.c [new file with mode: 0755]
helper/dacapture.c [new file with mode: 0755]
helper/dacollection.c [new file with mode: 0755]
helper/dahelper.c [new file with mode: 0755]
helper/libdaprobe.c [new file with mode: 0755]
helper/private_link.h [new file with mode: 0644]
include/dacollection.h [new file with mode: 0755]
include/daerror.h [new file with mode: 0755]
include/dahelper.h [new file with mode: 0755]
include/daprobe.h [new file with mode: 0644]
include/dautil.h [new file with mode: 0644]
include/khash.h [new file with mode: 0755]
include/osp_probe.h [new file with mode: 0755]
include/probeinfo.h [new file with mode: 0755]
packaging/dynamic-analysis-probe.spec [new file with mode: 0644]
probe_badaapi/bada_file.cpp [new file with mode: 0755]
probe_badaapi/bada_lifecycle.cpp [new file with mode: 0755]
probe_badaapi/bada_sync.cpp [new file with mode: 0755]
probe_badaapi/bada_thread.cpp [new file with mode: 0755]
probe_badaapi/osp_constructor.cpp [new file with mode: 0755]
probe_badaapi/osp_controls.cpp [new file with mode: 0755]
probe_event/da_event.c [new file with mode: 0755]
probe_event/da_event.h [new file with mode: 0755]
probe_event/gesture.cpp [new file with mode: 0755]
probe_event/gesture.h [new file with mode: 0644]
probe_event/keytouch.c [new file with mode: 0755]
probe_file/da_io.h [new file with mode: 0755]
probe_file/da_io_posix.c [new file with mode: 0755]
probe_file/da_io_stdc.c [new file with mode: 0644]
probe_memory/da_memory.h [new file with mode: 0644]
probe_memory/libdamemalloc.c [new file with mode: 0755]
probe_memory/libdamemmanage.c [new file with mode: 0644]
probe_memory/libdanew.cpp [new file with mode: 0644]
probe_socket/da_socket.h [new file with mode: 0644]
probe_socket/libdasocket.c [new file with mode: 0644]
probe_third/libdaemon.c [new file with mode: 0644]
probe_thread/da_sync.h [new file with mode: 0644]
probe_thread/da_thread.h [new file with mode: 0644]
probe_thread/libdasync.c [new file with mode: 0644]
probe_thread/libdathread.c [new file with mode: 0644]
probe_tizenapi/tizen_appfw.c [new file with mode: 0644]
probe_ui/da_ui.h [new file with mode: 0755]
probe_ui/osp_capture.cpp [new file with mode: 0755]
probe_ui/osp_display.cpp [new file with mode: 0644]
probe_ui/osp_frameani.cpp [new file with mode: 0644]
probe_ui/osp_frameani.h [new file with mode: 0644]
probe_ui/osp_scenemanager.cpp [new file with mode: 0755]
probe_ui/tizen_capture.c [new file with mode: 0755]
probe_userfunc/libdauserfunc.c [new file with mode: 0755]

diff --git a/AUTHOR b/AUTHOR
new file mode 100644 (file)
index 0000000..bd2e3c1
--- /dev/null
+++ b/AUTHOR
@@ -0,0 +1,7 @@
+Jaewon Lim <jaewon81.lim@samsung.com>
+Woojin Jung <woojin2.jung@samsung.com>
+Yeongtaik Byeon <yeongtaik.byeon@samsung.com>
+Jooyoul Lee <jy.exe.lee@samsung.com>
+Sanghyun Lee <sanghyunnim.lee@samsung.com>
+Juyoung Kim <j0.kim@samsung.com>
+HyunGoo Kang <hyungoo1.kang@samsung.com>
diff --git a/LICENSE.LGPLv2.1 b/LICENSE.LGPLv2.1
new file mode 100644 (file)
index 0000000..816d2c9
--- /dev/null
@@ -0,0 +1,503 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE\r
+                      Version 2.1, February 1999\r
+\r
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.\r
+       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+[This is the first released version of the Lesser GPL.  It also counts\r
+ as the successor of the GNU Library Public License, version 2, hence\r
+ the version number 2.1.]\r
+\r
+                           Preamble\r
+\r
+  The licenses for most software are designed to take away your\r
+freedom to share and change it.  By contrast, the GNU General Public\r
+Licenses are intended to guarantee your freedom to share and change\r
+free software--to make sure the software is free for all its users.\r
+\r
+  This license, the Lesser General Public License, applies to some\r
+specially designated software packages--typically libraries--of the\r
+Free Software Foundation and other authors who decide to use it.  You\r
+can use it too, but we suggest you first think carefully about whether\r
+this license or the ordinary General Public License is the better\r
+strategy to use in any particular case, based on the explanations below.\r
+\r
+  When we speak of free software, we are referring to freedom of use,\r
+not price.  Our General Public Licenses are designed to make sure that\r
+you have the freedom to distribute copies of free software (and charge\r
+for this service if you wish); that you receive source code or can get\r
+it if you want it; that you can change the software and use pieces of\r
+it in new free programs; and that you are informed that you can do\r
+these things.\r
+\r
+  To protect your rights, we need to make restrictions that forbid\r
+distributors to deny you these rights or to ask you to surrender these\r
+rights.  These restrictions translate to certain responsibilities for\r
+you if you distribute copies of the library or if you modify it.\r
+\r
+  For example, if you distribute copies of the library, whether gratis\r
+or for a fee, you must give the recipients all the rights that we gave\r
+you.  You must make sure that they, too, receive or can get the source\r
+code.  If you link other code with the library, you must provide\r
+complete object files to the recipients, so that they can relink them\r
+with the library after making changes to the library and recompiling\r
+it.  And you must show them these terms so they know their rights.\r
+\r
+  We protect your rights with a two-step method: (1) we copyright the\r
+library, and (2) we offer you this license, which gives you legal\r
+permission to copy, distribute and/or modify the library.\r
+\r
+  To protect each distributor, we want to make it very clear that\r
+there is no warranty for the free library.  Also, if the library is\r
+modified by someone else and passed on, the recipients should know\r
+that what they have is not the original version, so that the original\r
+author's reputation will not be affected by problems that might be\r
+introduced by others.\r
+\r
+  Finally, software patents pose a constant threat to the existence of\r
+any free program.  We wish to make sure that a company cannot\r
+effectively restrict the users of a free program by obtaining a\r
+restrictive license from a patent holder.  Therefore, we insist that\r
+any patent license obtained for a version of the library must be\r
+consistent with the full freedom of use specified in this license.\r
+\r
+  Most GNU software, including some libraries, is covered by the\r
+ordinary GNU General Public License.  This license, the GNU Lesser\r
+General Public License, applies to certain designated libraries, and\r
+is quite different from the ordinary General Public License.  We use\r
+this license for certain libraries in order to permit linking those\r
+libraries into non-free programs.\r
+\r
+  When a program is linked with a library, whether statically or using\r
+a shared library, the combination of the two is legally speaking a\r
+combined work, a derivative of the original library.  The ordinary\r
+General Public License therefore permits such linking only if the\r
+entire combination fits its criteria of freedom.  The Lesser General\r
+Public License permits more lax criteria for linking other code with\r
+the library.\r
+\r
+  We call this license the "Lesser" General Public License because it\r
+does Less to protect the user's freedom than the ordinary General\r
+Public License.  It also provides other free software developers Less\r
+of an advantage over competing non-free programs.  These disadvantages\r
+are the reason we use the ordinary General Public License for many\r
+libraries.  However, the Lesser license provides advantages in certain\r
+special circumstances.\r
+\r
+  For example, on rare occasions, there may be a special need to\r
+encourage the widest possible use of a certain library, so that it becomes\r
+a de-facto standard.  To achieve this, non-free programs must be\r
+allowed to use the library.  A more frequent case is that a free\r
+library does the same job as widely used non-free libraries.  In this\r
+case, there is little to gain by limiting the free library to free\r
+software only, so we use the Lesser General Public License.\r
+\r
+  In other cases, permission to use a particular library in non-free\r
+programs enables a greater number of people to use a large body of\r
+free software.  For example, permission to use the GNU C Library in\r
+non-free programs enables many more people to use the whole GNU\r
+operating system, as well as its variant, the GNU/Linux operating\r
+system.\r
+\r
+  Although the Lesser General Public License is Less protective of the\r
+users' freedom, it does ensure that the user of a program that is\r
+linked with the Library has the freedom and the wherewithal to run\r
+that program using a modified version of the Library.\r
+\r
+  The precise terms and conditions for copying, distribution and\r
+modification follow.  Pay close attention to the difference between a\r
+"work based on the library" and a "work that uses the library".  The\r
+former contains code derived from the library, whereas the latter must\r
+be combined with the library in order to run.\r
+\r
+                 GNU LESSER GENERAL PUBLIC LICENSE\r
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+  0. This License Agreement applies to any software library or other\r
+program which contains a notice placed by the copyright holder or\r
+other authorized party saying it may be distributed under the terms of\r
+this Lesser General Public License (also called "this License").\r
+Each licensee is addressed as "you".\r
+\r
+  A "library" means a collection of software functions and/or data\r
+prepared so as to be conveniently linked with application programs\r
+(which use some of those functions and data) to form executables.\r
+\r
+  The "Library", below, refers to any such software library or work\r
+which has been distributed under these terms.  A "work based on the\r
+Library" means either the Library or any derivative work under\r
+copyright law: that is to say, a work containing the Library or a\r
+portion of it, either verbatim or with modifications and/or translated\r
+straightforwardly into another language.  (Hereinafter, translation is\r
+included without limitation in the term "modification".)\r
+\r
+  "Source code" for a work means the preferred form of the work for\r
+making modifications to it.  For a library, complete source code means\r
+all the source code for all modules it contains, plus any associated\r
+interface definition files, plus the scripts used to control compilation\r
+and installation of the library.\r
+\r
+  Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope.  The act of\r
+running a program using the Library is not restricted, and output from\r
+such a program is covered only if its contents constitute a work based\r
+on the Library (independent of the use of the Library in a tool for\r
+writing it).  Whether that is true depends on what the Library does\r
+and what the program that uses the Library does.\r
+  \r
+  1. You may copy and distribute verbatim copies of the Library's\r
+complete source code as you receive it, in any medium, provided that\r
+you conspicuously and appropriately publish on each copy an\r
+appropriate copyright notice and disclaimer of warranty; keep intact\r
+all the notices that refer to this License and to the absence of any\r
+warranty; and distribute a copy of this License along with the\r
+Library.\r
+\r
+  You may charge a fee for the physical act of transferring a copy,\r
+and you may at your option offer warranty protection in exchange for a\r
+fee.\r
+\r
+  2. You may modify your copy or copies of the Library or any portion\r
+of it, thus forming a work based on the Library, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+    a) The modified work must itself be a software library.\r
+\r
+    b) You must cause the files modified to carry prominent notices\r
+    stating that you changed the files and the date of any change.\r
+\r
+    c) You must cause the whole of the work to be licensed at no\r
+    charge to all third parties under the terms of this License.\r
+\r
+    d) If a facility in the modified Library refers to a function or a\r
+    table of data to be supplied by an application program that uses\r
+    the facility, other than as an argument passed when the facility\r
+    is invoked, then you must make a good faith effort to ensure that,\r
+    in the event an application does not supply such function or\r
+    table, the facility still operates, and performs whatever part of\r
+    its purpose remains meaningful.\r
+\r
+    (For example, a function in a library to compute square roots has\r
+    a purpose that is entirely well-defined independent of the\r
+    application.  Therefore, Subsection 2d requires that any\r
+    application-supplied function or table used by this function must\r
+    be optional: if the application does not supply it, the square\r
+    root function must still compute square roots.)\r
+\r
+These requirements apply to the modified work as a whole.  If\r
+identifiable sections of that work are not derived from the Library,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works.  But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Library, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote\r
+it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Library.\r
+\r
+In addition, mere aggregation of another work not based on the Library\r
+with the Library (or with a work based on the Library) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+  3. You may opt to apply the terms of the ordinary GNU General Public\r
+License instead of this License to a given copy of the Library.  To do\r
+this, you must alter all the notices that refer to this License, so\r
+that they refer to the ordinary GNU General Public License, version 2,\r
+instead of to this License.  (If a newer version than version 2 of the\r
+ordinary GNU General Public License has appeared, then you can specify\r
+that version instead if you wish.)  Do not make any other change in\r
+these notices.\r
+\r
+  Once this change is made in a given copy, it is irreversible for\r
+that copy, so the ordinary GNU General Public License applies to all\r
+subsequent copies and derivative works made from that copy.\r
+\r
+  This option is useful when you wish to copy part of the code of\r
+the Library into a program that is not a library.\r
+\r
+  4. You may copy and distribute the Library (or a portion or\r
+derivative of it, under Section 2) in object code or executable form\r
+under the terms of Sections 1 and 2 above provided that you accompany\r
+it with the complete corresponding machine-readable source code, which\r
+must be distributed under the terms of Sections 1 and 2 above on a\r
+medium customarily used for software interchange.\r
+\r
+  If distribution of object code is made by offering access to copy\r
+from a designated place, then offering equivalent access to copy the\r
+source code from the same place satisfies the requirement to\r
+distribute the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\r
+  5. A program that contains no derivative of any portion of the\r
+Library, but is designed to work with the Library by being compiled or\r
+linked with it, is called a "work that uses the Library".  Such a\r
+work, in isolation, is not a derivative work of the Library, and\r
+therefore falls outside the scope of this License.\r
+\r
+  However, linking a "work that uses the Library" with the Library\r
+creates an executable that is a derivative of the Library (because it\r
+contains portions of the Library), rather than a "work that uses the\r
+library".  The executable is therefore covered by this License.\r
+Section 6 states terms for distribution of such executables.\r
+\r
+  When a "work that uses the Library" uses material from a header file\r
+that is part of the Library, the object code for the work may be a\r
+derivative work of the Library even though the source code is not.\r
+Whether this is true is especially significant if the work can be\r
+linked without the Library, or if the work is itself a library.  The\r
+threshold for this to be true is not precisely defined by law.\r
+\r
+  If such an object file uses only numerical parameters, data\r
+structure layouts and accessors, and small macros and small inline\r
+functions (ten lines or less in length), then the use of the object\r
+file is unrestricted, regardless of whether it is legally a derivative\r
+work.  (Executables containing this object code plus portions of the\r
+Library will still fall under Section 6.)\r
+\r
+  Otherwise, if the work is a derivative of the Library, you may\r
+distribute the object code for the work under the terms of Section 6.\r
+Any executables containing that work also fall under Section 6,\r
+whether or not they are linked directly with the Library itself.\r
+\r
+  6. As an exception to the Sections above, you may also combine or\r
+link a "work that uses the Library" with the Library to produce a\r
+work containing portions of the Library, and distribute that work\r
+under terms of your choice, provided that the terms permit\r
+modification of the work for the customer's own use and reverse\r
+engineering for debugging such modifications.\r
+\r
+  You must give prominent notice with each copy of the work that the\r
+Library is used in it and that the Library and its use are covered by\r
+this License.  You must supply a copy of this License.  If the work\r
+during execution displays copyright notices, you must include the\r
+copyright notice for the Library among them, as well as a reference\r
+directing the user to the copy of this License.  Also, you must do one\r
+of these things:\r
+\r
+    a) Accompany the work with the complete corresponding\r
+    machine-readable source code for the Library including whatever\r
+    changes were used in the work (which must be distributed under\r
+    Sections 1 and 2 above); and, if the work is an executable linked\r
+    with the Library, with the complete machine-readable "work that\r
+    uses the Library", as object code and/or source code, so that the\r
+    user can modify the Library and then relink to produce a modified\r
+    executable containing the modified Library.  (It is understood\r
+    that the user who changes the contents of definitions files in the\r
+    Library will not necessarily be able to recompile the application\r
+    to use the modified definitions.)\r
+\r
+    b) Use a suitable shared library mechanism for linking with the\r
+    Library.  A suitable mechanism is one that (1) uses at run time a\r
+    copy of the library already present on the user's computer system,\r
+    rather than copying library functions into the executable, and (2)\r
+    will operate properly with a modified version of the library, if\r
+    the user installs one, as long as the modified version is\r
+    interface-compatible with the version that the work was made with.\r
+\r
+    c) Accompany the work with a written offer, valid for at\r
+    least three years, to give the same user the materials\r
+    specified in Subsection 6a, above, for a charge no more\r
+    than the cost of performing this distribution.\r
+\r
+    d) If distribution of the work is made by offering access to copy\r
+    from a designated place, offer equivalent access to copy the above\r
+    specified materials from the same place.\r
+\r
+    e) Verify that the user has already received a copy of these\r
+    materials or that you have already sent this user a copy.\r
+\r
+  For an executable, the required form of the "work that uses the\r
+Library" must include any data and utility programs needed for\r
+reproducing the executable from it.  However, as a special exception,\r
+the materials to be distributed need not include anything that is\r
+normally distributed (in either source or binary form) with the major\r
+components (compiler, kernel, and so on) of the operating system on\r
+which the executable runs, unless that component itself accompanies\r
+the executable.\r
+\r
+  It may happen that this requirement contradicts the license\r
+restrictions of other proprietary libraries that do not normally\r
+accompany the operating system.  Such a contradiction means you cannot\r
+use both them and the Library together in an executable that you\r
+distribute.\r
+\r
+  7. You may place library facilities that are a work based on the\r
+Library side-by-side in a single library together with other library\r
+facilities not covered by this License, and distribute such a combined\r
+library, provided that the separate distribution of the work based on\r
+the Library and of the other library facilities is otherwise\r
+permitted, and provided that you do these two things:\r
+\r
+    a) Accompany the combined library with a copy of the same work\r
+    based on the Library, uncombined with any other library\r
+    facilities.  This must be distributed under the terms of the\r
+    Sections above.\r
+\r
+    b) Give prominent notice with the combined library of the fact\r
+    that part of it is a work based on the Library, and explaining\r
+    where to find the accompanying uncombined form of the same work.\r
+\r
+  8. You may not copy, modify, sublicense, link with, or distribute\r
+the Library except as expressly provided under this License.  Any\r
+attempt otherwise to copy, modify, sublicense, link with, or\r
+distribute the Library is void, and will automatically terminate your\r
+rights under this License.  However, parties who have received copies,\r
+or rights, from you under this License will not have their licenses\r
+terminated so long as such parties remain in full compliance.\r
+\r
+  9. You are not required to accept this License, since you have not\r
+signed it.  However, nothing else grants you permission to modify or\r
+distribute the Library or its derivative works.  These actions are\r
+prohibited by law if you do not accept this License.  Therefore, by\r
+modifying or distributing the Library (or any work based on the\r
+Library), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Library or works based on it.\r
+\r
+  10. Each time you redistribute the Library (or any work based on the\r
+Library), the recipient automatically receives a license from the\r
+original licensor to copy, distribute, link with or modify the Library\r
+subject to these terms and conditions.  You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties with\r
+this License.\r
+\r
+  11. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License.  If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Library at all.  For example, if a patent\r
+license would not permit royalty-free redistribution of the Library by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Library.\r
+\r
+If any portion of this section is held invalid or unenforceable under any\r
+particular circumstance, the balance of the section is intended to apply,\r
+and the section as a whole is intended to apply in other circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system which is\r
+implemented by public license practices.  Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\r
+  12. If the distribution and/or use of the Library is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Library under this License may add\r
+an explicit geographical distribution limitation excluding those countries,\r
+so that distribution is permitted only in or among countries not thus\r
+excluded.  In such case, this License incorporates the limitation as if\r
+written in the body of this License.\r
+\r
+  13. The Free Software Foundation may publish revised and/or new\r
+versions of the Lesser General Public License from time to time.\r
+Such new versions will be similar in spirit to the present version,\r
+but may differ in detail to address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number.  If the Library\r
+specifies a version number of this License which applies to it and\r
+"any later version", you have the option of following the terms and\r
+conditions either of that version or of any later version published by\r
+the Free Software Foundation.  If the Library does not specify a\r
+license version number, you may choose any version ever published by\r
+the Free Software Foundation.\r
+\r
+  14. If you wish to incorporate parts of the Library into other free\r
+programs whose distribution conditions are incompatible with these,\r
+write to the author to ask for permission.  For software which is\r
+copyrighted by the Free Software Foundation, write to the Free\r
+Software Foundation; we sometimes make exceptions for this.  Our\r
+decision will be guided by the two goals of preserving the free status\r
+of all derivatives of our free software and of promoting the sharing\r
+and reuse of software generally.\r
+\r
+                           NO WARRANTY\r
+\r
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\r
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\r
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\r
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY\r
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\r
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\r
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r
+\r
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\r
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\r
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\r
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\r
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\r
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\r
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\r
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\r
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\r
+DAMAGES.\r
+\r
+                    END OF TERMS AND CONDITIONS\r
+\r
+           How to Apply These Terms to Your New Libraries\r
+\r
+  If you develop a new library, and you want it to be of the greatest\r
+possible use to the public, we recommend making it free software that\r
+everyone can redistribute and change.  You can do so by permitting\r
+redistribution under these terms (or, alternatively, under the terms of the\r
+ordinary General Public License).\r
+\r
+  To apply these terms, attach the following notices to the library.  It is\r
+safest to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least the\r
+"copyright" line and a pointer to where the full notice is found.\r
+\r
+    <one line to give the library's name and a brief idea of what it does.>\r
+    Copyright (C) <year>  <name of author>\r
+\r
+    This library is free software; you can redistribute it and/or\r
+    modify it under the terms of the GNU Lesser General Public\r
+    License as published by the Free Software Foundation; either\r
+    version 2 of the License, or (at your option) any later version.\r
+\r
+    This library is distributed in the hope that it will be useful,\r
+    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+    Lesser General Public License for more details.\r
+\r
+    You should have received a copy of the GNU Lesser General Public\r
+    License along with this library; if not, write to the Free Software\r
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the library, if\r
+necessary.  Here is a sample; alter the names:\r
+\r
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the\r
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\r
+\r
+  <signature of Ty Coon>, 1 April 1990\r
+  Ty Coon, President of Vice\r
+\r
+That's all there is to it!\r
+\r
diff --git a/LICENSE.MIT b/LICENSE.MIT
new file mode 100644 (file)
index 0000000..7b26146
--- /dev/null
@@ -0,0 +1,8 @@
+The MIT License (MIT)\r
+Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..eff31da
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,101 @@
+CURDIR = `pwd`
+INSTALLDIR = usr/lib
+
+DUMMY_VERSION = 0.0.1
+
+INC_COMMON = -I./include \
+                        -I./probe_thread \
+                        -I/usr/include/system \
+                        -I/usr/include/appfw \
+                        -I/usr/include/ecore-1 \
+                        -I/usr/include/evas-1 \
+                        -I/usr/include/eina-1 \
+                        -I/usr/include/eina-1/eina \
+                        -I/usr/include/elementary-1 \
+                        -I/usr/include/eet-1 \
+                        -I/usr/include/edje-1 \
+                        -I/usr/include/efreet-1 \
+                        -I/usr/include/ethumb-1 \
+                        -I/usr/include/e_dbus-1 \
+                        -I/usr/include/dbus-1.0 \
+                        -I/usr/lib/dbus-1.0/include
+INC_TIZEN = $(INC_COMMON) #-I/usr/include/vconf -I/usr/include/pixman-1
+INC_OSP = $(INC_COMMON) -I/usr/include/osp
+
+COMMON_SRCS =  ./helper/libdaprobe.c \
+                               ./helper/dahelper.c \
+                               ./helper/btsym.c \
+                               ./helper/dacollection.c \
+                               ./helper/dacapture.c \
+                               ./probe_memory/libdamemalloc.c \
+                               ./probe_memory/libdamemmanage.c \
+                               ./custom_chart/da_chart.c \
+                               ./probe_socket/libdasocket.c \
+                               ./probe_event/da_event.c \
+                               ./probe_event/keytouch.c \
+                               ./probe_third/libdaemon.c \
+                               ./probe_thread/libdathread.c \
+                               ./probe_thread/libdasync.c \
+                               ./probe_userfunc/libdauserfunc.c \
+                               ./probe_file/da_io_posix.c \
+                               ./probe_file/da_io_stdc.c
+
+TIZEN_SRCS =$(COMMON_SRCS) \
+                       ./helper/addr-capi.c \
+                       ./probe_tizenapi/tizen_appfw.c \
+                       ./probe_ui/tizen_capture.c
+
+OSP_SRCS =     $(COMMON_SRCS) \
+                       ./helper/addr-tizen.c \
+                       ./probe_memory/libdanew.cpp \
+                       ./probe_badaapi/bada_file.cpp \
+                       ./probe_badaapi/bada_thread.cpp \
+                       ./probe_badaapi/bada_lifecycle.cpp \
+                       ./probe_badaapi/bada_sync.cpp \
+                       ./probe_badaapi/osp_controls.cpp \
+                       ./probe_badaapi/osp_constructor.cpp \
+                       ./probe_event/gesture.cpp \
+                       ./probe_ui/osp_capture.cpp \
+                       ./probe_ui/osp_scenemanager.cpp \
+                       ./probe_ui/osp_frameani.cpp \
+                       ./probe_ui/osp_display.cpp 
+
+DUMMY_SRCS = ./custom_chart/da_chart_dummy.c
+
+TIZEN_TARGET = da_probe_tizen.so
+OSP_TARGET = da_probe_osp.so
+DUMMY_TARGET = libdaprobe.so
+
+FLAGS = -D_GNU_SOURCE -fPIC -shared -Wall -funwind-tables -fomit-frame-pointer -Xlinker --no-undefined
+
+LIBDIR_COMMON = 
+LIBDIR_TIZEN = $(LIBDIR_COMMON) 
+LIBDIR_OSP = $(LIBDIR_COMMON) -L/usr/lib/osp
+
+COMMON_LDFLAGS = -ldl -lpthread -lrt -lecore -levas -lecore_input -leina -lecore_x -lcapi-system-runtime-info -lcapi-appfw-application -lX11 -lXext
+TIZEN_LDFLAGS = $(COMMON_LDFLAGS)
+OSP_LDFLAGS = $(COMMON_LDFLAGS) -lstdc++ -losp-uifw -losp-appfw
+DUMMY_LDFLAGS =
+
+all:   $(TIZEN_TARGET) $(OSP_TARGET) $(DUMMY_TARGET)
+tizen: $(TIZEN_TARGET)
+osp:   $(OSP_TARGET)
+dummy: $(DUMMY_TARGET)
+
+$(TIZEN_TARGET): $(TIZEN_SRCS)
+       $(CC) $(INC_TIZEN) $(FLAGS) $(LIBDIR_TIZEN) -o $@ $(TIZEN_SRCS) $(TIZEN_LDFLAGS)
+
+$(OSP_TARGET): $(OSP_SRCS)
+       $(CC) $(INC_OSP) $(FLAGS) $(LIBDIR_OSP) -o $@ $(OSP_SRCS) $(OSP_LDFLAGS)
+
+$(DUMMY_TARGET): $(DUMMY_SRCS)
+       $(CC) $(INC_OSP) $(FLAGS) -o $@ $(DUMMY_SRCS) $(DUMMY_LDFLAGS)
+
+
+install:
+       [ -d "$(DESTDIR)/$(INSTALLDIR)" ] || mkdir -p $(DESTDIR)/$(INSTALLDIR)
+       install $(OSP_TARGET) $(DUMMY_TARGET) $(DESTDIR)/$(INSTALLDIR)/
+
+clean:
+       rm -f *.so *.o
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..e492808
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,9 @@
+Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Lesser GNU Public License , Version 2.1.
+Please, see the LICENSE.LGPLv2.1 file for Apache License terms and conditions.
+Several source codes may have its original copyright owner and/or
+be licensed under other than Lesser GNU Public License , Version 2.1, say, MIT License.
+Please, see copyright and license comments section in the header of each file,
+and the LICENSE.MIT file for MIT License terms and conditions.
+
diff --git a/custom_chart/da_chart.c b/custom_chart/da_chart.c
new file mode 100755 (executable)
index 0000000..21906cc
--- /dev/null
@@ -0,0 +1,585 @@
+/*\r
+ *  DA probe\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ *\r
+ * Jaewon Lim <jaewon81.lim@samsung.com>\r
+ * Woojin Jung <woojin2.jung@samsung.com>\r
+ * Juyoung Kim <j0.kim@samsung.com>\r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the\r
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+ * License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+#include <pthread.h>\r
+#include <signal.h>                    // for signal\r
+#include <unistd.h>                    // for ualarm, sleep\r
+#include <sys/timerfd.h>       // for timerfd\r
+#include <stdio.h>\r
+#include <errno.h>                     // for errno\r
+#include <string.h>                    // for memset\r
+#include <stdint.h>                    // for uint64_t\r
+\r
+#include "daprobe.h"\r
+#include "dahelper.h"\r
+#include "probeinfo.h"\r
+#define _USE_DA_\r
+#include "da_chart.h"\r
+\r
+#define ERR_THREAD_CREATE_FAIL -2001   // thread creation fail\r
+\r
+#define MAX_TITLE_LENGTH               16\r
+#define MAX_CHART_HANDLE               10              // cannot be exceeded 10\r
+#define MAX_SERIES_PER_CHART   4               // cannot be exceeded 10\r
+// chart handle is  from 1 to 9\r
+// series handle is from 11 to 99\r
+// series handle 32 means that the series is 2nd series in 3rd chart.\r
+// zero value handle means error\r
+\r
+// =====================================================================\r
+// global variable\r
+// =====================================================================\r
+\r
+typedef struct _chart_interval_callback\r
+{\r
+       da_handle chart_handle;\r
+       da_handle series_handle;\r
+       da_user_data_2_chart_data callback;\r
+       void* user_data;\r
+       struct _chart_interval_callback* next;\r
+} chart_interval_callback;\r
+\r
+typedef struct\r
+{\r
+       int                     timerfd;\r
+       pthread_t       thread_handle;\r
+       chart_interval_callback*        callback_list;\r
+       pthread_mutex_t         list_mutex;\r
+} interval_manager;\r
+\r
+typedef struct\r
+{\r
+       int                     chart_handle_index;\r
+       int                     series_handle_index[MAX_CHART_HANDLE];\r
+       int                     interval_for_series[MAX_CHART_HANDLE][MAX_SERIES_PER_CHART];\r
+       interval_manager        interval_10ms;\r
+       interval_manager        interval_100ms;\r
+       interval_manager        interval_1s;\r
+} chart_handle_maintainer;\r
+\r
+chart_handle_maintainer chm;\r
+\r
+__thread pid_t cur_thread = -1;\r
+\r
+\r
+// =====================================================================\r
+// internal macro definition\r
+// =====================================================================\r
+\r
+#define DECLARE_CHART_VARIABLE                                 \\r
+       da_handle __attribute__((unused)) ret = 0;      \\r
+       probeInfo_t probeInfo;                                          \\r
+       log_t log\r
+\r
+#define APPEND_LOG_CHART_RESULT(RESULT)                                                                        \\r
+       log.length += sprintf(log.data + log.length, "`,%d`,0x%p`,0`,2",        \\r
+                       RESULT, CALLER_ADDRESS)\r
+\r
+#define APPEND_LOG_CHART(HANDLE, TYPE, TEXT, COLOR, VALUE)                                     \\r
+       log.length += sprintf(log.data + log.length, "`,`,%d`,%d`,%s`,%d`,%.3f",        \\r
+                       HANDLE, TYPE, TEXT, COLOR, VALUE)\r
+\r
+// =====================================================================\r
+// timer thread routine for callback\r
+// =====================================================================\r
+\r
+void* _chart_timerThread(void* data)\r
+{\r
+       DECLARE_CHART_VARIABLE;\r
+\r
+       uint64_t exp;\r
+       ssize_t readsize;\r
+       chart_interval_callback* cur;\r
+       float value;\r
+       interval_manager* pmanager = (interval_manager*)data;\r
+\r
+       probeBlockStart();\r
+\r
+       while((readsize = read(pmanager->timerfd, &exp, sizeof(uint64_t))) > 0)\r
+       {\r
+               pthread_mutex_lock(&pmanager->list_mutex);\r
+\r
+               cur = pmanager->callback_list;\r
+               while(cur != NULL)\r
+               {\r
+                       value = cur->callback(cur->user_data);\r
+\r
+                       INIT_LOG;\r
+                       setProbePoint(&probeInfo);\r
+                       log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d`,`,`,0x%p`,0`,2`,`,%d`,0`,`,0`,%.3f",\r
+                                       LC_CUSTOM, probeInfo.eventIndex, __func__, probeInfo.currentTime, probeInfo.pID,\r
+                                       probeInfo.tID, CALLER_ADDRESS, cur->series_handle, value);\r
+                       printLog(&log, MSG_LOG);\r
+\r
+                       cur = cur->next;\r
+               }\r
+\r
+               pthread_mutex_unlock(&pmanager->list_mutex);\r
+\r
+               sleep(0);\r
+       }\r
+\r
+       probeBlockEnd();\r
+\r
+       return NULL;\r
+}\r
+\r
+static int start_callback_thread(chart_interval interval)\r
+{\r
+       int* timerfd = NULL;\r
+       pthread_t* thread_handle = NULL;\r
+       interval_manager* pman = NULL;\r
+       struct itimerspec timevalue;\r
+\r
+       if(interval == CHART_INTERVAL_10MSEC)\r
+       {\r
+               timerfd = &(chm.interval_10ms.timerfd);\r
+               thread_handle = &(chm.interval_10ms.thread_handle);\r
+               pman = &(chm.interval_10ms);\r
+               timevalue.it_value.tv_sec = 0;\r
+               timevalue.it_value.tv_nsec = 10000000L;\r
+               timevalue.it_interval.tv_sec = 0;\r
+               timevalue.it_interval.tv_nsec = 10000000L;\r
+       }\r
+       else if(interval == CHART_INTERVAL_100MSEC)\r
+       {\r
+               timerfd = &(chm.interval_100ms.timerfd);\r
+               thread_handle = &(chm.interval_100ms.thread_handle);\r
+               pman = &(chm.interval_100ms);\r
+               timevalue.it_value.tv_sec = 0;\r
+               timevalue.it_value.tv_nsec = 100000000L;\r
+               timevalue.it_interval.tv_sec = 0;\r
+               timevalue.it_interval.tv_nsec = 100000000L;\r
+       }\r
+       else if(interval == CHART_INTERVAL_1SEC)\r
+       {\r
+               timerfd = &(chm.interval_1s.timerfd);\r
+               thread_handle = &(chm.interval_1s.thread_handle);\r
+               pman = &(chm.interval_1s);\r
+               timevalue.it_value.tv_sec = 1;\r
+               timevalue.it_value.tv_nsec = 0;\r
+               timevalue.it_interval.tv_sec = 1;\r
+               timevalue.it_interval.tv_nsec = 0;\r
+       }\r
+       else\r
+       {\r
+               return ERR_WRONG_PARAMETER;\r
+       }\r
+\r
+       if(*timerfd != -1 || *thread_handle != -1)\r
+               return 0;               // already thread exist\r
+\r
+       *timerfd = timerfd_create(CLOCK_REALTIME, 0);\r
+       if(*timerfd == -1)\r
+               return errno;\r
+\r
+       if(timerfd_settime(*timerfd, 0, &timevalue, NULL) == -1)\r
+               return errno;\r
+\r
+       if(pthread_create(thread_handle, NULL, _chart_timerThread, pman) < 0)\r
+               return ERR_THREAD_CREATE_FAIL;\r
+\r
+       return 0;\r
+}\r
+\r
+\r
+// =====================================================================\r
+// internal utility function\r
+// =====================================================================\r
+\r
+static void add_to_callback_list(chart_interval interval, da_handle charthandle, da_handle series_handle,\r
+               da_user_data_2_chart_data callback, void* user_data)\r
+{\r
+       chart_interval_callback* newelem;\r
+       \r
+       newelem = (chart_interval_callback*)malloc(sizeof(chart_interval_callback));\r
+       newelem->chart_handle = charthandle;\r
+       newelem->series_handle = series_handle;\r
+       newelem->callback = callback;\r
+       newelem->user_data = user_data;\r
+\r
+       chm.interval_for_series[charthandle][series_handle % 10] = interval;\r
+       \r
+       switch(interval)\r
+       {\r
+       case CHART_INTERVAL_10MSEC:\r
+               pthread_mutex_lock(&chm.interval_10ms.list_mutex);\r
+               newelem->next = chm.interval_10ms.callback_list;\r
+               chm.interval_10ms.callback_list = newelem;\r
+               pthread_mutex_unlock(&chm.interval_10ms.list_mutex);\r
+               __sync_add_and_fetch(&(gTraceInfo.custom_chart_callback_count), 1);\r
+               break;\r
+       case CHART_INTERVAL_100MSEC:\r
+               pthread_mutex_lock(&chm.interval_100ms.list_mutex);\r
+               newelem->next = chm.interval_100ms.callback_list;\r
+               chm.interval_100ms.callback_list = newelem;\r
+               pthread_mutex_unlock(&chm.interval_100ms.list_mutex);\r
+               __sync_add_and_fetch(&(gTraceInfo.custom_chart_callback_count), 1);\r
+               break;\r
+       case CHART_INTERVAL_1SEC:\r
+               pthread_mutex_lock(&chm.interval_1s.list_mutex);\r
+               newelem->next = chm.interval_1s.callback_list;\r
+               chm.interval_1s.callback_list = newelem;\r
+               pthread_mutex_unlock(&chm.interval_1s.list_mutex);\r
+               __sync_add_and_fetch(&(gTraceInfo.custom_chart_callback_count), 1);\r
+               break;\r
+       default:\r
+               free(newelem);\r
+               break;\r
+       }\r
+}\r
+\r
+static void remove_all_callback_list()\r
+{\r
+       chart_interval_callback* cur;\r
+       \r
+       pthread_mutex_lock(&chm.interval_10ms.list_mutex);\r
+       while(chm.interval_10ms.callback_list != NULL)\r
+       {\r
+               cur = chm.interval_10ms.callback_list;\r
+               chm.interval_10ms.callback_list = cur->next;\r
+               free(cur);\r
+       }\r
+       pthread_mutex_unlock(&chm.interval_10ms.list_mutex);\r
+\r
+       pthread_mutex_lock(&chm.interval_100ms.list_mutex);\r
+       while(chm.interval_100ms.callback_list != NULL)\r
+       {\r
+               cur = chm.interval_100ms.callback_list;\r
+               chm.interval_100ms.callback_list = cur->next;\r
+               free(cur);\r
+       }\r
+       pthread_mutex_unlock(&chm.interval_100ms.list_mutex);\r
+\r
+       pthread_mutex_lock(&chm.interval_1s.list_mutex);\r
+       while(chm.interval_1s.callback_list != NULL)\r
+       {\r
+               cur = chm.interval_1s.callback_list;\r
+               chm.interval_1s.callback_list = cur->next;\r
+               free(cur);\r
+       }\r
+       pthread_mutex_unlock(&chm.interval_1s.list_mutex);\r
+\r
+       memset(&chm.interval_for_series, 0, sizeof(chm.interval_for_series));\r
+       __sync_and_and_fetch(&(gTraceInfo.custom_chart_callback_count), 0);\r
+}\r
+\r
+static void remove_from_callback_list(da_handle charthandle, da_handle series_handle)\r
+{\r
+       chart_interval_callback *prev, *cur;\r
+       chart_interval interval;\r
+\r
+       interval = chm.interval_for_series[charthandle][series_handle % 10];\r
+       chm.interval_for_series[charthandle][series_handle % 10] = 0;\r
+\r
+       switch(interval)\r
+       {\r
+       case CHART_INTERVAL_10MSEC:\r
+               pthread_mutex_lock(&chm.interval_10ms.list_mutex);\r
+\r
+               prev = NULL;\r
+               cur = chm.interval_10ms.callback_list;\r
+               while(cur != NULL)\r
+               {\r
+                       if(cur->chart_handle == charthandle && cur->series_handle == series_handle)\r
+                       {\r
+                               if(prev)\r
+                                       prev->next = cur->next;\r
+                               else\r
+                                       chm.interval_10ms.callback_list = cur->next;\r
+\r
+                               __sync_sub_and_fetch(&(gTraceInfo.custom_chart_callback_count), 1);\r
+                               free(cur);\r
+                               break;\r
+                       }\r
+\r
+                       prev = cur;\r
+                       cur = cur->next;\r
+               }\r
+\r
+               pthread_mutex_unlock(&chm.interval_10ms.list_mutex);\r
+               break;\r
+       case CHART_INTERVAL_100MSEC:\r
+               pthread_mutex_lock(&chm.interval_100ms.list_mutex);\r
+\r
+               prev = NULL;\r
+               cur = chm.interval_100ms.callback_list;\r
+               while(cur != NULL)\r
+               {\r
+                       if(cur->chart_handle == charthandle && cur->series_handle == series_handle)\r
+                       {\r
+                               if(prev)\r
+                                       prev->next = cur->next;\r
+                               else\r
+                                       chm.interval_100ms.callback_list = cur->next;\r
+\r
+                               __sync_sub_and_fetch(&(gTraceInfo.custom_chart_callback_count), 1);\r
+                               free(cur);\r
+                               break;\r
+                       }\r
+\r
+                       prev = cur;\r
+                       cur = cur->next;\r
+               }\r
+\r
+               pthread_mutex_unlock(&chm.interval_100ms.list_mutex);\r
+               break;\r
+       case CHART_INTERVAL_1SEC:\r
+               pthread_mutex_lock(&chm.interval_1s.list_mutex);\r
+\r
+               prev = NULL;\r
+               cur = chm.interval_1s.callback_list;\r
+               while(cur != NULL)\r
+               {\r
+                       if(cur->chart_handle == charthandle && cur->series_handle == series_handle)\r
+                       {\r
+                               if(prev)\r
+                                       prev->next = cur->next;\r
+                               else\r
+                                       chm.interval_1s.callback_list = cur->next;\r
+\r
+                               __sync_sub_and_fetch(&(gTraceInfo.custom_chart_callback_count), 1);\r
+                               free(cur);\r
+                               break;\r
+                       }\r
+\r
+                       prev = cur;\r
+                       cur = cur->next;\r
+               }\r
+\r
+               pthread_mutex_unlock(&chm.interval_1s.list_mutex);\r
+               break;\r
+       default:\r
+               break;\r
+       }\r
+}\r
+\r
+\r
+// =====================================================================\r
+// constructor and destructor functions\r
+// =====================================================================\r
+\r
+void __attribute__((constructor)) _init_lib()\r
+{\r
+       probeBlockStart();\r
+\r
+       memset(&chm, 0, sizeof(chm));\r
+       chm.interval_10ms.timerfd = -1;\r
+       chm.interval_100ms.timerfd = -1;\r
+       chm.interval_1s.timerfd = -1;\r
+       chm.interval_10ms.thread_handle = -1;\r
+       chm.interval_100ms.thread_handle = -1;\r
+       chm.interval_1s.thread_handle = -1;\r
+       pthread_mutex_init(&chm.interval_10ms.list_mutex, NULL);\r
+       pthread_mutex_init(&chm.interval_100ms.list_mutex, NULL);\r
+       pthread_mutex_init(&chm.interval_1s.list_mutex, NULL);\r
+\r
+       probeBlockEnd();\r
+}\r
+\r
+void __attribute__((destructor)) _fini_lib()\r
+{\r
+       probeBlockStart();\r
+\r
+       remove_all_callback_list();\r
+       if(chm.interval_10ms.timerfd != -1)\r
+               close(chm.interval_10ms.timerfd);\r
+       if(chm.interval_100ms.timerfd != -1)\r
+               close(chm.interval_100ms.timerfd);\r
+       if(chm.interval_1s.timerfd != -1)\r
+               close(chm.interval_1s.timerfd);\r
+\r
+       if(chm.interval_10ms.thread_handle != -1)\r
+       {\r
+               pthread_join(chm.interval_10ms.thread_handle, NULL);\r
+       }\r
+       if(chm.interval_100ms.thread_handle != -1)\r
+       {\r
+               pthread_join(chm.interval_100ms.thread_handle, NULL);\r
+       }\r
+       if(chm.interval_1s.thread_handle != -1)\r
+       {\r
+               pthread_join(chm.interval_1s.thread_handle, NULL);\r
+       }\r
+\r
+       probeBlockEnd();\r
+}\r
+\r
+\r
+// =====================================================================\r
+// api definition\r
+// =====================================================================\r
+\r
+void da_mark(chart_color color, char* mark_text)\r
+{\r
+       DECLARE_CHART_VARIABLE;\r
+       \r
+       probeBlockStart();\r
+       \r
+       INIT_LOG;\r
+       setProbePoint(&probeInfo);\r
+       APPEND_LOG_BASIC(LC_CUSTOM);\r
+       APPEND_LOG_INPUT("%s", "");\r
+       APPEND_LOG_CHART_RESULT(0);\r
+       APPEND_LOG_CHART(0, 0, mark_text, color, 0.0f);\r
+       printLog(&log, MSG_LOG);\r
+       \r
+       probeBlockEnd();\r
+}\r
+\r
+da_handle da_create_chart(char* chart_name)\r
+{\r
+       DECLARE_CHART_VARIABLE;\r
+\r
+       // check if there is available chart handle slot\r
+       if(chm.chart_handle_index + 1 >= MAX_CHART_HANDLE)\r
+               return ERR_MAX_CHART_NUMBER;\r
+               \r
+       // check if chart_name is null\r
+       if(chart_name == NULL)\r
+               return ERR_WRONG_PARAMETER;\r
+               \r
+       probeBlockStart();\r
+       ret = ++(chm.chart_handle_index);\r
+\r
+       INIT_LOG;\r
+       setProbePoint(&probeInfo);\r
+       APPEND_LOG_BASIC(LC_CUSTOM);\r
+       APPEND_LOG_INPUT("%s", "");\r
+       APPEND_LOG_CHART_RESULT(ret);\r
+       APPEND_LOG_CHART(0, 0, chart_name, 0, 0.0f);\r
+       printLog(&log, MSG_LOG);\r
+       \r
+       probeBlockEnd();\r
+       \r
+       return ret;\r
+}\r
+\r
+da_handle da_create_series(da_handle charthandle, char* seriesname,\r
+               series_type type, chart_color color)\r
+{\r
+       DECLARE_CHART_VARIABLE;\r
+       \r
+       // check if charthandle is valid handle or not\r
+       if(charthandle <= 0 || charthandle > chm.chart_handle_index)\r
+               return ERR_WRONG_HANDLE;\r
+               \r
+       // chech if extra parameter is valid\r
+       if(seriesname == NULL)\r
+               return ERR_WRONG_PARAMETER;\r
+\r
+       // check if there is available series spot\r
+       if(chm.series_handle_index[(int)charthandle] + 1 >= MAX_SERIES_PER_CHART)\r
+               return ERR_MAX_CHART_NUMBER;\r
+       \r
+       probeBlockStart();\r
+       ret = ++(chm.series_handle_index[charthandle]);\r
+       ret += (10 * charthandle);\r
+       \r
+       INIT_LOG;\r
+       setProbePoint(&probeInfo);\r
+       APPEND_LOG_BASIC(LC_CUSTOM);\r
+       APPEND_LOG_INPUT("%s", "");\r
+       APPEND_LOG_CHART_RESULT(ret);\r
+       APPEND_LOG_CHART(charthandle, type, seriesname, color, 0.0f);\r
+       printLog(&log, MSG_LOG);\r
+\r
+       probeBlockEnd();\r
+       \r
+       return ret;\r
+}\r
+               \r
+da_handle da_create_default_series(da_handle charthandle, char* seriesname)\r
+{\r
+       return da_create_series(charthandle, seriesname,\r
+                       CHART_TYPE_AUTO, CHART_COLOR_AUTO);\r
+}\r
+\r
+int da_set_callback(da_handle series_handle, da_user_data_2_chart_data callback,\r
+               void* data_addr, chart_interval interval)\r
+{\r
+       int cindex, sindex;\r
+       cindex = (int)(series_handle / 10);\r
+       sindex = series_handle % 10;\r
+       \r
+       // check series handle\r
+       if(cindex <= 0 || cindex > chm.chart_handle_index)\r
+               return ERR_WRONG_HANDLE;\r
+       \r
+       if(sindex > chm.series_handle_index[(int)cindex])\r
+               return ERR_WRONG_HANDLE;\r
+       \r
+       // check rest parameters\r
+       if(interval == CHART_NO_CYCLE && callback != NULL)\r
+               return ERR_WRONG_PARAMETER;\r
+\r
+       probeBlockStart();\r
+\r
+       // remove previously registered callback\r
+       remove_from_callback_list(cindex, series_handle);\r
+\r
+       // register new callback\r
+       if(callback != NULL)\r
+       {\r
+               add_to_callback_list(interval, cindex, series_handle, callback, data_addr);\r
+               start_callback_thread(interval);\r
+       }\r
+       probeBlockEnd();\r
+\r
+       return 0;\r
+}\r
+\r
+void da_log(da_handle series_handle, float uservalue)\r
+{\r
+       DECLARE_CHART_VARIABLE;\r
+       \r
+       // chech if series handle is valid\r
+       int cindex, sindex;\r
+       cindex = (int)(series_handle / 10);\r
+       sindex = series_handle % 10;\r
+       \r
+       if(cindex <= 0 || cindex > chm.chart_handle_index)\r
+               return;\r
+       \r
+       if(sindex > chm.series_handle_index[(int)cindex])\r
+               return;\r
+       \r
+       probeBlockStart();\r
+       \r
+       INIT_LOG;\r
+       setProbePoint(&probeInfo);\r
+       APPEND_LOG_BASIC(LC_CUSTOM);\r
+       APPEND_LOG_INPUT("%s", "");\r
+       APPEND_LOG_CHART_RESULT(0);\r
+       APPEND_LOG_CHART(series_handle, 0, "", 0, uservalue);\r
+       printLog(&log, MSG_LOG);\r
+       \r
+       probeBlockEnd();\r
+}\r
diff --git a/custom_chart/da_chart.h b/custom_chart/da_chart.h
new file mode 100755 (executable)
index 0000000..8f0e9a7
--- /dev/null
@@ -0,0 +1,110 @@
+/*\r
+ *  DA probe\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ *\r
+ * Jaewon Lim <jaewon81.lim@samsung.com>\r
+ * Woojin Jung <woojin2.jung@samsung.com>\r
+ * Juyoung Kim <j0.kim@samsung.com>\r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the\r
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+ * License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+#ifndef __DA_CHART_H__\r
+#define __DA_CHART_H__\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+// Error code  \r
+#define ERR_MAX_CHART_NUMBER   -1001   // no more chart or series can be added\r
+#define ERR_WRONG_HANDLE               -1002   // chart or series handle is wrong handle\r
+#define ERR_WRONG_PARAMETER            -1003   // wrong parameter\r
+\r
+typedef enum\r
+{\r
+       CHART_TYPE_AUTO = 0,\r
+       CHART_TYPE_LINE = 1,\r
+       CHART_TYPE_BAR = 2,\r
+       CHART_TYPE_AREA = 3,\r
+       CHART_TYPE_STEP = 4\r
+} series_type;\r
+\r
+typedef enum\r
+{\r
+       CHART_COLOR_AUTO = 0,\r
+       CHART_COLOR_BLUE = 1,\r
+       CHART_COLOR_GREEN = 2,\r
+       CHART_COLOR_RED = 3,\r
+       CHART_COLOR_BROWN = 4,\r
+       CHART_COLOR_PURPLE = 5,\r
+       CHART_COLOR_NAVY = 6,\r
+       CHART_COLOR_CHOCOLATE = 7,\r
+       CHART_COLOR_INDIGO = 8,\r
+       CHART_COLOR_MAGENTA = 9,\r
+       CHART_COLOR_TEAL = 10\r
+} chart_color;\r
+\r
+typedef enum\r
+{\r
+       CHART_NO_CYCLE = 0,\r
+       CHART_INTERVAL_10MSEC = 1,\r
+       CHART_INTERVAL_100MSEC = 2,\r
+       CHART_INTERVAL_1SEC = 3\r
+} chart_interval;\r
+\r
+typedef int da_handle;\r
+typedef float (* da_user_data_2_chart_data) (void* data_addr);\r
+\r
+\r
+// api definition\r
+#ifdef _USE_DA_\r
+\r
+extern da_handle da_create_chart (char* chart_name);\r
+extern da_handle da_create_series (da_handle charthandle, char* seriesname,\r
+               series_type type, chart_color color);\r
+extern da_handle da_create_default_series (da_handle charthandle, char* seriesname);\r
+extern int da_set_callback (da_handle series_handle,   da_user_data_2_chart_data callback,\r
+               void* data_addr, chart_interval interval);\r
+extern void da_log (da_handle series_handle, float uservalue);\r
+\r
+\r
+extern void da_mark (chart_color color, char* mark_text);\r
+\r
+#else // _USE_DA_ (do not use da custom chart)\r
+\r
+#define da_create_chart(a)                                             0\r
+#define da_create_series(a, b, c, d)                   0\r
+#define da_create_default_series(a, b)                 0\r
+#define da_set_callback(a, b, c, d)                            0\r
+#define da_log(a, b)\r
+\r
+\r
+#define da_mark(color, text)\r
+\r
+#endif // _USE_DA_\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif // __DA_CHART_H__\r
diff --git a/custom_chart/da_chart_dummy.c b/custom_chart/da_chart_dummy.c
new file mode 100755 (executable)
index 0000000..79796d0
--- /dev/null
@@ -0,0 +1,65 @@
+/*\r
+ *  DA probe\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ *\r
+ * Jaewon Lim <jaewon81.lim@samsung.com>\r
+ * Woojin Jung <woojin2.jung@samsung.com>\r
+ * Juyoung Kim <j0.kim@samsung.com>\r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the\r
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+ * License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+#define _USE_DA_\r
+#include "da_chart.h"\r
+\r
+// =====================================================================\r
+// api definition\r
+// =====================================================================\r
+\r
+void da_mark(chart_color color, char* mark_text)\r
+{\r
+}\r
+\r
+da_handle da_create_chart(char* chart_name)\r
+{\r
+       return 0;\r
+}\r
+\r
+da_handle da_create_series(da_handle charthandle, char* seriesname,\r
+               series_type type, chart_color color)\r
+{\r
+       return 0;\r
+}\r
+               \r
+da_handle da_create_default_series(da_handle charthandle, char* seriesname)\r
+{\r
+       return 0;\r
+}\r
+\r
+int da_set_callback(da_handle series_handle, da_user_data_2_chart_data callback, void* data_addr, chart_interval interval)\r
+{\r
+       return 0;\r
+}\r
+\r
+void da_log(da_handle series_handle, float uservalue)\r
+{\r
+}\r
diff --git a/helper/addr-capi.c b/helper/addr-capi.c
new file mode 100644 (file)
index 0000000..2cadd3c
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <dlfcn.h>
+#include "daprobe.h"
+#include "dahelper.h"
+
+int get_map_address(void* sym, void** start, void** end);
+
+int getExecutableMappingAddress()
+{
+       int ret = 0;
+       void* main_symbol;
+
+       probeBlockStart();
+       main_symbol = dlsym(RTLD_NEXT, "main");
+       if(main_symbol != NULL)
+       {
+               ret = get_map_address(main_symbol, &(gTraceInfo.exec_map.map_start),
+                                               &(gTraceInfo.exec_map.map_end));
+       }
+       else
+       {
+               perror("failed to get address of main");
+               ret = 0;
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
diff --git a/helper/addr-tizen.c b/helper/addr-tizen.c
new file mode 100644 (file)
index 0000000..af05618
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <dlfcn.h>
+#include "daprobe.h"
+#include "dahelper.h"
+
+int get_map_address(void* sym, void** start, void** end);
+
+int getExecutableMappingAddress()
+{
+       int ret = 0;
+       void* main_symbol;
+
+       probeBlockStart();
+       main_symbol = dlsym(RTLD_NEXT, "OspMain");
+       if(main_symbol != NULL)
+       {
+               ret = get_map_address(main_symbol, &(gTraceInfo.exec_map.map_start),
+                                               &(gTraceInfo.exec_map.map_end));
+       }
+       else
+       {
+               perror("failed to get address of main");
+               ret = 0;
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
diff --git a/helper/btsym.c b/helper/btsym.c
new file mode 100755 (executable)
index 0000000..9128f78
--- /dev/null
@@ -0,0 +1,482 @@
+/* Return list with names for address in backtrace.
+   Copyright (C) 1998,1999,2000,2001,2003,2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+/*
+2011-12-15 Jaewon Lim <jaewon81.lim@samsung.com> add hashing for symbols
+
+2011-12-08 Jaewon Lim <jaewon81.lim@samsung.com> get symbol data from binary's symtab when dladdr cannot resolve symbol
+*/
+
+#include <assert.h>            // for assert
+#include <stdio.h>             // for printf, sprintf
+#include <stdlib.h>            // for malloc
+#include <string.h>            // for strlen
+#include <stddef.h>            // for ptrdiff_t
+#include <errno.h>             // for program_invocation_name
+
+#include <sys/types.h> // for open, fstat
+#include <sys/stat.h>  // for open, fstat
+#include <fcntl.h>             // for open
+#include <unistd.h>            // for fstat
+#include <sys/mman.h>  // for mmap, munmap
+
+#include "private_link.h"              // for link_map, ElfW
+#include "dahelper.h"
+#include "dacollection.h"
+
+#if __ELF_NATIVE_CLASS == 32
+# define WORD_WIDTH 8
+#else
+/* We assyme 64bits.  */
+# define WORD_WIDTH 16
+#endif
+
+#define FILEPATH_MAX 1024
+
+/* We use this macro to refer to ELF types independent of the native wordsize.
+   'ElfW(TYPE)' is used in place of 'Elf32_TYPE' or 'Elf64_TYPE'.  */
+#define ELFW(type)  _ElfW (ELF, __ELF_NATIVE_CLASS, type)
+
+/* Result of the lookup functions and how to retrieve the base address.  */
+typedef struct link_map *lookup_t;
+#define LOOKUP_VALUE(map) map
+#define LOOKUP_VALUE_ADDRESS(map) ((map) ? (map)->l_addr : 0)
+
+/* On some architectures a pointer to a function is not just a pointer
+   to the actual code of the function but rather an architecture
+   specific descriptor. */
+#ifndef ELF_FUNCTION_PTR_IS_SPECIAL
+# define DL_SYMBOL_ADDRESS(map, ref) \
+       (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value)
+# define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))
+# define DL_DT_INIT_ADDRESS(map, start) (start)
+# define DL_DT_FINI_ADDRESS(map, start) (start)
+#endif
+
+/* On some architectures dladdr can't use st_size of all symbols this way.  */
+#define DL_ADDR_SYM_MATCH(L, SYM, ADDR) \
+       (((ADDR) >= (L)->l_addr + (SYM)->st_value)              \
+               && ((((SYM)->st_shndx == SHN_UNDEF || (SYM)->st_size == 0)       \
+                       && ((ADDR) == (L)->l_addr + (SYM)->st_value))         \
+                       || ((ADDR) < (L)->l_addr + (SYM)->st_value + (SYM)->st_size)))
+
+// start of implementation by Jaewon Lim
+struct _symdata
+{
+       ElfW(Shdr)      symhdr;
+       ElfW(Shdr)      strhdr;
+       ElfW(Sym)*      symtab;
+       char*           strtab;
+};
+
+typedef struct _symdata symdata_t;
+
+// get symbol data from file binary
+static symdata_t* _get_symboldata(char* filepath)
+{
+       int fd;
+       struct stat st;
+       char *contents;
+       symdata_t* pdata;
+
+       // first find in glist
+       pdata = (symdata_t*)find_glist(filepath);
+       if(pdata != NULL)
+       {
+               return pdata;
+       }
+
+       fd = open(filepath, O_RDONLY);
+       if(fd == -1)
+       {
+               return pdata;
+       }
+
+       if(fstat(fd, &st) == -1)
+       {
+               close(fd);
+               return pdata;
+       }
+
+       contents = (char*)mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+       if(likely(contents != NULL))
+       {
+               ElfW(Ehdr) * elf_hdr = (ElfW(Ehdr) *)(contents);
+               ElfW(Shdr) * sec_hdr = (ElfW(Shdr) *)(contents + elf_hdr->e_shoff);
+               int i, symtab_idx = -1;
+
+               for (i = 0; i < elf_hdr->e_shnum; ++i)
+               {
+                       if(unlikely(sec_hdr[i].sh_type == SHT_SYMTAB))
+                       {
+                               symtab_idx = i;
+                               break;
+                       }
+               }
+
+               if(symtab_idx != -1)    //there is symbol table
+               {
+                       int strtab_idx = sec_hdr[symtab_idx].sh_link;
+                       if(likely((strtab_idx != 0) && (sec_hdr[strtab_idx].sh_type == SHT_STRTAB)))    // associated string table is valid
+                       {
+                               pdata = (symdata_t*)malloc(sizeof(symdata_t) + 
+                                               sec_hdr[symtab_idx].sh_size +
+                                               sec_hdr[strtab_idx].sh_size);
+
+                               if(likely(pdata != NULL))
+                               {
+                                       memcpy(&(pdata->symhdr), &(sec_hdr[symtab_idx]), sizeof(ElfW(Shdr)));
+                                       memcpy(&(pdata->strhdr), &(sec_hdr[strtab_idx]), sizeof(ElfW(Shdr)));
+                                       pdata->symtab = (ElfW(Sym) *)(pdata + 1);
+                                       pdata->strtab = ((char*)pdata) + sizeof(symdata_t) + sec_hdr[symtab_idx].sh_size;
+                                       memcpy((void*)(pdata->symtab), (void*)(contents + sec_hdr[symtab_idx].sh_offset), sec_hdr[symtab_idx].sh_size);
+                                       memcpy((void*)(pdata->strtab), (void*)(contents + sec_hdr[strtab_idx].sh_offset), sec_hdr[strtab_idx].sh_size);
+
+                                       if(add_to_glist(filepath, (void*)pdata) == 0)   // fail to add
+                                       {
+                                               free(pdata);
+                                               pdata = NULL;
+                                       }
+                               }
+                       }
+               }
+
+               munmap((void*)contents, st.st_size);
+       }
+
+       close(fd);
+
+       return pdata;
+}
+
+int get_map_address(void* symbol, void** map_start, void** map_end)
+{
+       Dl_info info;
+       int status, ret = 0;
+       struct link_map* map = NULL;
+
+       status = dladdr1(symbol, &info, (void**)&map, RTLD_DL_LINKMAP);
+       if(status && map != NULL)
+       {
+               *map_start = (void*)(map->l_map_start);
+               *map_end = (void*)(map->l_map_end);
+               ret = 1;
+       }
+       else
+               ret = 0;
+
+       return ret;
+}
+
+// end of implementation by Jaewon Lim
+
+char** cached_backtrace_symbols (void* const* array, int size)
+{
+       Dl_info info[MAX_STACK_DEPTH];
+       int status[MAX_STACK_DEPTH];
+       char* chararr[MAX_STACK_DEPTH];
+       int cnt;
+       size_t total = 0;
+       char **result;
+       char* foundsym;
+
+       memset(chararr, 0, MAX_STACK_DEPTH * sizeof(char*));
+
+       /* Fill in the information we can get from `dladdr'.  */
+       for (cnt = 0; cnt < size; ++cnt)
+       {
+               struct link_map* map;
+               
+               if(find_symbol_hash(array[cnt], &foundsym) <= 0)        // not found or error
+               {
+                       status[cnt] = dladdr1 (array[cnt], &info[cnt], (void**)&map, RTLD_DL_LINKMAP);
+                       if (status[cnt] && info[cnt].dli_fname && info[cnt].dli_fname[0] != '\0')
+                       {
+                               /* We have some info, compute the length of the string which will be
+                               "<file-name>(<sym-name>+offset) [address].  */
+                               total += (strlen (info[cnt].dli_fname ?: "")
+                                               + strlen (info[cnt].dli_sname ?: "")
+                                               + 3 + WORD_WIDTH + 3 + WORD_WIDTH + 5);
+       
+                               /* The load bias is more useful to the user than the load
+                               address.  The use of these addresses is to calculate an
+                               address in the ELF file, so its prelinked bias is not
+                               something we want to subtract out.  */
+                               info[cnt].dli_fbase = (void *) map->l_addr;
+                       }
+                       else
+                               total += 5 + WORD_WIDTH;
+               }
+               else            // there is a entry for key
+               {
+                       status[cnt] = 0;
+                       chararr[cnt] = foundsym;
+                       if(chararr[cnt] != NULL)
+                               total += (strlen(chararr[cnt]) + 1);
+                       else
+                       {
+                               // this never happened
+                               total += 100;
+                       }
+               }
+       }
+
+       /* Allocate memory for the result.  */
+       result = (char **) malloc (size * sizeof (char *) + total);
+       if (result != NULL)
+       {
+               char *last = (char *) (result + size);
+
+               for (cnt = 0; cnt < size; ++cnt)
+               {
+                       result[cnt] = last;
+                       
+                       if(chararr[cnt] != NULL)                // there is a cache
+                       {
+                               last += (1 + sprintf(last, "%s", chararr[cnt]));
+                       }
+                       else            // there is no cache
+                       {
+                               int tstrlen;
+                               if (status[cnt] && info[cnt].dli_fname != NULL && info[cnt].dli_fname[0] != '\0')
+                               {
+                                       // We found no symbol name to use, so describe it as relative to the file.
+                                       if (info[cnt].dli_sname == NULL)
+                                               info[cnt].dli_saddr = info[cnt].dli_fbase;
+       
+                                       if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
+                                       {
+                                               tstrlen = sprintf (last, "%s(%s) [%p]", info[cnt].dli_fname ?: "", info[cnt].dli_sname ?: "", array[cnt]);
+                                       }
+                                       else
+                                       {
+                                               char sign;
+                                               ptrdiff_t offset;
+                                               if (array[cnt] >= (void *) info[cnt].dli_saddr)
+                                               {
+                                                       sign = '+';
+                                                       offset = array[cnt] - info[cnt].dli_saddr;
+                                               }
+                                               else
+                                               {
+                                                       sign = '-';
+                                                       offset = info[cnt].dli_saddr - array[cnt];
+                                               }
+       
+                                               tstrlen = sprintf (last, "%s(%s%c%#tx) [%p]",
+                                                               info[cnt].dli_fname ?: "",
+                                                               info[cnt].dli_sname ?: "",
+                                                               sign, offset, array[cnt]);
+                                       }
+                               }
+                               else
+                               {
+                                       tstrlen = sprintf (last, "[%p]", array[cnt]);
+                               }
+                               tstrlen++;
+                               
+                               add_symbol_hash(array[cnt], last, tstrlen);
+                               
+                               last += tstrlen;
+                       }                       
+               }
+
+               assert (last <= (char *) result + size * sizeof (char *) + total);
+       }
+       else            // fail to malloc
+       {
+               // do nothing
+       }
+
+       return result;
+}
+
+char** da_backtrace_symbols (void* const* array, int size)
+{
+       Dl_info info[MAX_STACK_DEPTH];
+       int status[MAX_STACK_DEPTH];
+       char* chararr[MAX_STACK_DEPTH];
+       int cnt;
+       size_t total = 0;
+       char **result;
+       char* foundsym;
+
+       memset(chararr, 0, MAX_STACK_DEPTH * sizeof(char*));
+
+       /* Fill in the information we can get from `dladdr'.  */
+       for (cnt = 0; cnt < size; ++cnt)
+       {
+               struct link_map* map;
+               
+               if(find_symbol_hash(array[cnt], &foundsym) <= 0)        // not found or error
+               {
+                       status[cnt] = dladdr1 (array[cnt], &info[cnt], (void**)&map, RTLD_DL_LINKMAP);
+                       if(info[cnt].dli_sname == NULL)
+                       {
+                               char filepath[FILEPATH_MAX];    // for file path
+       
+                               /* If this is the main program the information is incomplete.  */
+                               if (map->l_name[0] == '\0' && map->l_type == lt_executable)
+                               {
+                                       strcpy(filepath, program_invocation_name);
+                               }
+                               else
+                               {
+                                       int len;
+                                       if(map->l_origin)
+                                       {
+                                               strcpy(filepath, map->l_origin);
+                                               len = strlen(filepath);
+                                               if(len > 0 && filepath[len-1] != '/')
+                                               {
+                                                       filepath[len] = '/';
+                                                       filepath[len+1] = '\0';
+                                               }
+                                       }
+                                       else
+                                               filepath[0] = '\0';
+                                       strcat(filepath, map->l_name);
+                               }
+                       
+                               symdata_t* pdata = _get_symboldata(filepath);
+                               if(pdata != NULL)
+                               {
+                                       ElfW(Sym) * sym_ent = pdata->symtab;
+                                       char* strtab = pdata->strtab;
+                                       int i, num_syms = pdata->symhdr.sh_size / pdata->symhdr.sh_entsize;
+               
+                                       for(i = 0; i < num_syms; ++i)
+                                       {
+                                               if (ELFW(ST_TYPE) (sym_ent[i].st_info) != STT_TLS
+                                                               && (sym_ent[i].st_shndx != SHN_UNDEF || sym_ent[i].st_value != 0)
+                                                               && DL_ADDR_SYM_MATCH (map, &(sym_ent[i]), DL_LOOKUP_ADDRESS (array[cnt]))
+                                                               && sym_ent[i].st_name < pdata->strhdr.sh_size)
+                                               {
+                                                       // We found a symbol close by.  Fill in its name and exact address.
+                                                       info[cnt].dli_sname = strtab + ((ElfW(Sym) *)(sym_ent + i))->st_name;
+                                                       info[cnt].dli_saddr = DL_SYMBOL_ADDRESS (map, ((ElfW(Sym) *)(sym_ent + i)));
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+
+                       if (status[cnt] && info[cnt].dli_fname && info[cnt].dli_fname[0] != '\0')
+                       {
+                               /* We have some info, compute the length of the string which will be
+                               "<file-name>(<sym-name>+offset) [address].  */
+                               total += (strlen (info[cnt].dli_fname ?: "")
+                                               + strlen (info[cnt].dli_sname ?: "")
+                                               + 3 + WORD_WIDTH + 3 + WORD_WIDTH + 5);
+       
+                               /* The load bias is more useful to the user than the load
+                               address.  The use of these addresses is to calculate an
+                               address in the ELF file, so its prelinked bias is not
+                               something we want to subtract out.  */
+//                             info[cnt].dli_fbase = (void *) map->l_addr;
+                       }
+                       else
+                               total += 5 + WORD_WIDTH;
+               }
+               else            // there is a entry for key
+               {
+//                     printf("there is get k(%d)\n", k);
+                       chararr[cnt] = foundsym;
+                       if(chararr[cnt] != NULL)
+                               total += (strlen(chararr[cnt]) + 1);
+                       else
+                       {
+                               assert(false);
+                               total += 100;
+                       }
+               }
+       }
+
+       /* Allocate memory for the result.  */
+       result = (char **) malloc (size * sizeof (char *) + total);
+       if (result != NULL)
+       {
+               char *last = (char *) (result + size);
+
+               for (cnt = 0; cnt < size; ++cnt)
+               {
+                       result[cnt] = last;
+                       
+                       if(chararr[cnt] != NULL)                // there is a cache
+                       {
+                               last += (1 + sprintf(last, "%s", chararr[cnt]));
+                       }
+                       else            // there is no cache
+                       {
+                               int tstrlen;
+                               if (status[cnt] && info[cnt].dli_fname != NULL && info[cnt].dli_fname[0] != '\0')
+                               {
+                                       // We found no symbol name to use, so describe it as relative to the file.
+                                       if (info[cnt].dli_sname == NULL)
+                                               info[cnt].dli_saddr = info[cnt].dli_fbase;
+       
+                                       if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
+                                       {
+                                               tstrlen = sprintf (last, "%s(%s) [%p]", info[cnt].dli_fname ?: "", info[cnt].dli_sname ?: "", array[cnt]);
+                                       }
+                                       else
+                                       {
+                                               char sign;
+                                               ptrdiff_t offset;
+                                               if (array[cnt] >= (void *) info[cnt].dli_saddr)
+                                               {
+                                                       sign = '+';
+                                                       offset = array[cnt] - info[cnt].dli_saddr;
+                                               }
+                                               else
+                                               {
+                                                       sign = '-';
+                                                       offset = info[cnt].dli_saddr - array[cnt];
+                                               }
+       
+                                               tstrlen = sprintf (last, "%s(%s%c%#tx) [%p]",
+                                                               info[cnt].dli_fname ?: "",
+                                                               info[cnt].dli_sname ?: "",
+                                                               sign, offset, array[cnt]);
+                                       }
+                               }
+                               else
+                               {
+                                       tstrlen = sprintf (last, "[%p]", array[cnt]);
+                               }
+                               tstrlen++;
+                               
+                               add_symbol_hash(array[cnt], last, tstrlen);
+                               
+                               last += tstrlen;
+                       }                       
+               }
+
+               assert (last <= (char *) result + size * sizeof (char *) + total);
+       }
+       else            // fail to malloc
+       {
+               // do nothing
+       }
+
+       return result;
+}
+
diff --git a/helper/dacapture.c b/helper/dacapture.c
new file mode 100755 (executable)
index 0000000..5f61992
--- /dev/null
@@ -0,0 +1,426 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <stdlib.h>            // for system
+#include <sys/types.h> // for stat
+#include <sys/stat.h>  // fot stat
+#include <unistd.h>            // fot stat
+#include <sys/shm.h>   // for shmget, shmat
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/XShm.h>
+
+#include <Ecore.h>
+#include <Evas.h>
+#include <Evas_Engine_Buffer.h>
+
+#include "daprobe.h"
+#include "dahelper.h"
+
+#define SCREENSHOT_DIRECTORY   "/tmp/da"
+
+#define MAX_HEIGHT     720
+#define CAPTURE_TIMEOUT                2.0
+
+typedef struct _screenshot_data
+{
+       XImage*                 ximage;
+       Display*                dpy;
+       XShmSegmentInfo x_shm_info;
+} screenshot_data;
+
+/*
+int convert_image(     void* srcbuf, void* dstbuf,
+                                       pixman_format_code_t src_format,
+                                       pixman_format_code_t dst_format,
+                                       int src_width, int src_height,
+                                       int dst_width, int dst_height,
+                                       int     rotate)
+{
+       pixman_image_t *   src_img;
+       pixman_image_t *   dst_img;
+       pixman_transform_t transform;
+
+       int                src_stride, dst_stride;
+       int                src_bpp;
+       int                dst_bpp;
+       pixman_op_t        op;
+       int                rotate_step;
+       int                ret = False;
+
+       return_val_if_fail (srcbuf != NULL, False);
+       return_val_if_fail (dstbuf != NULL, False);
+       return_val_if_fail (rotate <= 360 && rotate >= -360, False);
+
+       op = PIXMAN_OP_SRC;
+
+       src_bpp = PIXMAN_FORMAT_BPP (src_format) / 8;
+       return_val_if_fail (src_bpp > 0, False);
+
+       dst_bpp = PIXMAN_FORMAT_BPP (dst_format) / 8;
+       return_val_if_fail (dst_bpp > 0, False);
+
+       rotate_step = (rotate + 360) / 90 % 4;
+
+       src_stride = src_width * src_bpp;
+       dst_stride = dst_width * dst_bpp;
+
+       src_img = pixman_image_create_bits (src_format, src_width, src_height, srcbuf, src_stride);
+       dst_img = pixman_image_create_bits (dst_format, dst_width, dst_height, dstbuf, dst_stride);
+
+       goto_if_fail (src_img != NULL, CANT_CONVERT);
+       goto_if_fail (dst_img != NULL, CANT_CONVERT);
+
+       pixman_transform_init_identity (&transform);
+
+       if (rotate_step > 0)
+       {
+               int c, s, tx = 0, ty = 0;
+               switch (rotate_step)
+               {
+               case 1:
+                       // 270 degrees
+                       c = 0;
+                       s = -pixman_fixed_1;
+                       ty = pixman_int_to_fixed (dst_width);
+                       break;
+               case 2:
+                       // 180 degrees
+                       c = -pixman_fixed_1;
+                       s = 0;
+                       tx = pixman_int_to_fixed (dst_width);
+                       ty = pixman_int_to_fixed (dst_height);
+                       break;
+               case 3:
+                       // 90 degrees
+                       c = 0;
+                       s = pixman_fixed_1;
+                       tx = pixman_int_to_fixed (dst_height);
+                       break;
+               default:
+                       // 0 degrees
+                       c = 0;
+                       s = 0;
+                       break;
+               }
+               pixman_transform_rotate (&transform, NULL, c, s);
+               pixman_transform_translate (&transform, NULL, tx, ty);
+       }
+
+       pixman_image_set_transform (src_img, &transform);
+
+       pixman_image_composite (op, src_img, NULL, dst_img,
+                               0, 0, 0, 0, 0, 0, dst_width, dst_height);
+
+       ret = True;
+
+CANT_CONVERT:
+       if (src_img)
+               pixman_image_unref (src_img);
+       if (dst_img)
+               pixman_image_unref (dst_img);
+
+       return ret;
+}
+*/
+
+static char* captureScreenShotX(int* pwidth, int* pheight, screenshot_data* sdata)
+{
+       Window                  root;
+//     Atom                    atom_rotation;
+
+       sdata->dpy = XOpenDisplay(NULL);
+       if(unlikely(sdata->dpy == NULL))
+       {
+               PRINTMSG("XOpenDisplay failed!\n");
+               return NULL;
+       }
+
+       *pwidth = DisplayWidth(sdata->dpy, DefaultScreen(sdata->dpy));
+       *pheight = DisplayHeight(sdata->dpy, DefaultScreen(sdata->dpy));
+
+       root = RootWindow(sdata->dpy, DefaultScreen(sdata->dpy));
+
+       sdata->ximage = XShmCreateImage(sdata->dpy, DefaultVisualOfScreen (DefaultScreenOfDisplay (sdata->dpy)), 24,
+                                       ZPixmap, NULL, &sdata->x_shm_info, (unsigned int)*pwidth, (unsigned int)*pheight);
+
+       if(sdata->ximage != NULL)
+       {
+               sdata->x_shm_info.shmid = shmget(IPC_PRIVATE, sdata->ximage->bytes_per_line * sdata->ximage->height, IPC_CREAT | 0777);
+               sdata->x_shm_info.shmaddr = sdata->ximage->data = shmat(sdata->x_shm_info.shmid, 0, 0);
+               sdata->x_shm_info.readOnly = False;
+
+               if(XShmAttach(sdata->dpy, &sdata->x_shm_info))
+               {
+                       if(XShmGetImage(sdata->dpy, root, sdata->ximage, 0, 0, AllPlanes))
+                       {
+                               XSync (sdata->dpy, False);
+                               return sdata->ximage->data;
+                       }
+                       else
+                       {
+                               PRINTMSG("XShmGetImage failed !\n");
+                       }
+
+                       XShmDetach (sdata->dpy, &sdata->x_shm_info);
+               }
+               else
+               {
+                       PRINTMSG("XShmAttach failed !\n");
+               }
+
+               shmdt (sdata->x_shm_info.shmaddr);
+               shmctl (sdata->x_shm_info.shmid, IPC_RMID, NULL);
+               XDestroyImage(sdata->ximage);
+               sdata->ximage = NULL;
+       }
+       else
+       {
+               PRINTMSG("XShmCreateImage failed!\n");
+       }
+
+       return NULL;
+}
+
+static void releaseScreenShotX(screenshot_data* sdata)
+{
+       if(sdata->ximage)
+       {
+               XShmDetach (sdata->dpy, &sdata->x_shm_info);
+               shmdt (sdata->x_shm_info.shmaddr);
+               shmctl (sdata->x_shm_info.shmid, IPC_RMID, NULL);
+               XDestroyImage(sdata->ximage);
+       }
+       else { }
+
+       if(sdata->dpy)
+       {
+               XCloseDisplay(sdata->dpy);
+       }
+}
+
+static Evas* create_canvas(int width, int height)
+{
+       Evas* canvas;
+       Evas_Engine_Info_Buffer* einfo;
+       int method;
+       void* pixels;
+
+       method = evas_render_method_lookup("buffer");
+       if(unlikely(method <= 0))
+       {
+               PRINTMSG("ERROR: evas was not compiled with 'buffer' engine!\n");
+               return NULL;
+       }
+
+       canvas = evas_new();
+       if(unlikely(canvas == NULL))
+       {
+               PRINTMSG("ERROR: could not instantiate new evas canvas.\n");
+               return NULL;
+       }
+
+       evas_output_method_set(canvas, method);
+       evas_output_size_set(canvas, width, height);
+       evas_output_viewport_set(canvas, 0, 0, width, height);
+
+       einfo = (Evas_Engine_Info_Buffer*)evas_engine_info_get(canvas);
+       if(unlikely(einfo == NULL))
+       {
+               PRINTMSG("ERROR: could not get evas engine info!\n");
+               evas_free(canvas);
+               return NULL;
+       }
+
+       // ARGB32 is sizeof(int), that is 4 bytes, per pixel
+       pixels = malloc(width * height * sizeof(int));
+       if(unlikely(pixels == NULL))
+       {
+               PRINTMSG("ERROR: could not allocate canvas pixels!\n");
+               evas_free(canvas);
+               return NULL;
+       }
+
+       einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+       einfo->info.dest_buffer = pixels;
+       einfo->info.dest_buffer_row_bytes = width * sizeof(int);
+       einfo->info.use_color_key = 0;
+       einfo->info.alpha_threshold = 0;
+       einfo->info.func.new_update_region = NULL;
+       einfo->info.func.free_update_region = NULL;
+       evas_engine_info_set(canvas, (Evas_Engine_Info*)einfo);
+
+       return canvas;
+}
+
+static void destroy_canvas(Evas* canvas)
+{
+       Evas_Engine_Info_Buffer* einfo;
+
+       einfo = (Evas_Engine_Info_Buffer*)evas_engine_info_get(canvas);
+       if(unlikely(einfo == NULL))
+       {
+               PRINTMSG("ERROR: could not get evas engine info!\n");
+       }
+       else
+       {
+               free(einfo->info.dest_buffer);
+       }
+       evas_free(canvas);
+}
+
+int captureScreen()
+{
+       char dstpath[32];
+       char* scrimage;
+       int width, height;
+       Evas* ev = NULL;
+       Evas_Object* img;
+       screenshot_data sdata;
+       DECLARE_COMMON_VARIABLE;
+       int ret = 0;
+
+       probeBlockStart();
+
+       setProbePoint(&probeInfo);
+       scrimage = captureScreenShotX(&width, &height, &sdata);
+       if(scrimage != NULL)
+       {
+               ev = create_canvas(width, height);
+               if(likely(ev != NULL))
+               {
+                       sprintf(dstpath, SCREENSHOT_DIRECTORY "/%d.png", probeInfo.eventIndex);
+
+                       // make image buffer
+                       if((img = evas_object_image_add(ev)) != NULL)
+                       {
+                               //image buffer set
+                               evas_object_image_data_set(img, NULL);
+                               evas_object_image_size_set(img, width, height);
+                               evas_object_image_data_set(img, scrimage);
+
+                               // resize image
+                               if(height > MAX_HEIGHT)
+                               {
+                                       width = width * MAX_HEIGHT / height;
+                                       height = MAX_HEIGHT;
+                                       evas_object_resize(img, width, height);
+                                       evas_object_image_fill_set(img, 0, 0, width, height);
+                               }
+                               evas_object_image_data_update_add(img, 0, 0, width, height);
+
+                               //save file
+                               if(evas_object_image_save(img, dstpath, NULL, "compress=5") != 0)
+                               {
+                                       INIT_LOG;
+                                       APPEND_LOG_BASIC_NAME(LC_SNAPSHOT, "captureScreen");
+                                       APPEND_LOG_COMMON_NONE(0);
+                                       log.length += sprintf(log.data + log.length, "`,%s`,%d", dstpath, getOrientation());
+                                       printLog(&log, MSG_LOG);
+                               }
+                               else
+                               {
+                                       PRINTMSG("captureScreen : evas_object_image_save failed\n");
+                                       ret = -1;
+                               }
+                       }
+                       else
+                       {
+                               PRINTMSG("captureScreen : evas_object_image_add failed\n");
+                               ret = -1;
+                       }
+               }
+               else
+               {
+                       PRINTMSG("captureScreen : create canvas failed\n");
+                       ret = -1;
+               }
+       }
+       else
+       {
+               PRINTMSG("captureScreen : captureScreenShotX failed\n");
+               ret = -1;
+       }
+
+       // release resources
+       releaseScreenShotX(&sdata);
+       if(ev)
+               destroy_canvas(ev);
+
+       probeBlockEnd();
+
+       return ret;
+}
+
+int initialize_screencapture()
+{
+       // remove all previous screenshot in dir
+       remove_indir(SCREENSHOT_DIRECTORY);
+
+       // make screenshot directory
+       mkdir(SCREENSHOT_DIRECTORY, 0777);
+
+       return 0;
+}
+
+int finalize_screencapture()
+{
+       return 0;
+}
+
+// =======================================================================
+// screen shot manipulation functions
+// =======================================================================
+
+static Eina_Bool _captureTimer(void* data)
+{
+       probeBlockStart();
+//     PRINTMSG("_captureTimer");
+       SCREENSHOT_DONE();
+       probeBlockEnd();
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+int activateCaptureTimer()
+{
+       ecore_timer_add(CAPTURE_TIMEOUT, _captureTimer, NULL);
+       return 0;
+}
+
+void _cb_render_post(void* data, Evas* e, void* eventinfo)
+{
+       probeBlockStart();
+//     PRINTMSG("_cb_render_post");
+       SCREENSHOT_DONE();
+       probeBlockEnd();
+}
+
diff --git a/helper/dacollection.c b/helper/dacollection.c
new file mode 100755 (executable)
index 0000000..9ab3ac0
--- /dev/null
@@ -0,0 +1,697 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <assert.h>            // for assert
+#include <stdlib.h>            // for malloc, free
+#include <string.h>            // for strlen, strcpy
+#include <pthread.h>   // for pthread_mutex_t
+
+#include "dahelper.h"
+#include "daerror.h"
+#include "dacollection.h"
+
+// hash table variable
+__hashInfo _hashinfo =
+{
+       NULL,                                           // khash_t(symbol)*     symHash
+       PTHREAD_MUTEX_INITIALIZER,      // pthread_mutex_t symHashMutex
+       NULL,                                           // khash_t(allocmap)*   memHash
+       PTHREAD_MUTEX_INITIALIZER,      // pthread_mutex_t memHashMutex
+       NULL,                                           // khash_t(object)*     objHash
+       PTHREAD_MUTEX_INITIALIZER,      // pthread_mutex_t objHashMutex
+       NULL,                                           // khash_t(detector)*   dttHash
+       PTHREAD_MUTEX_INITIALIZER       // pthread_mutex_t dttHashMutex
+};
+
+// glist typedef and variable
+struct _element
+{
+       int             keylen;
+       char*   keystr;
+       void*   dataptr;
+       struct _element*        next;
+       struct _element*        prev;
+};
+
+typedef struct _element element_t;
+
+element_t* gsymbol_list = NULL;
+pthread_mutex_t glist_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+// *********************************************************************************************
+// hash table related implemenation
+// *********************************************************************************************
+
+int initialize_hash_table()
+{
+       SYMBOLHASH_LOCK;
+       SYMBOLHASH = kh_init(symbol);
+       SYMBOLHASH_UNLOCK;
+
+       MEMORYHASH_LOCK;
+       MEMORYHASH = kh_init(allocmap);
+       MEMORYHASH_UNLOCK;
+
+       OBJECTHASH_LOCK;
+       OBJECTHASH = kh_init(object);
+       OBJECTHASH_UNLOCK;
+
+       DETECTORHASH_LOCK;
+       DETECTORHASH = kh_init(detector);
+       DETECTORHASH_UNLOCK;
+
+       return 0;
+}
+
+int finalize_hash_table()
+{
+       if(SYMBOLHASH)
+       {
+               khiter_t k;
+               char* val;
+
+               SYMBOLHASH_LOCK;
+               for(k = kh_begin(SYMBOLHASH); k != kh_end(SYMBOLHASH); k++)
+               {
+                       if(kh_exist(SYMBOLHASH, k))
+                       {
+                               val = kh_value(SYMBOLHASH, k);
+                               free(val);
+                       }
+               }
+               kh_destroy(symbol, SYMBOLHASH);
+               SYMBOLHASH = NULL;
+               SYMBOLHASH_UNLOCK;
+       }
+
+       if(MEMORYHASH)
+       {
+               MEMORYHASH_LOCK;
+               kh_destroy(allocmap, MEMORYHASH);
+               MEMORYHASH = NULL;
+               MEMORYHASH_UNLOCK;
+       }
+
+       if(OBJECTHASH)
+       {
+               khiter_t k;
+               _objectinfo* val;
+
+               OBJECTHASH_LOCK;
+               for(k = kh_begin(OBJECTHASH); k != kh_end(OBJECTHASH); k++)
+               {
+                       if(kh_exist(OBJECTHASH, k))
+                       {
+                               val = kh_value(OBJECTHASH, k);
+                               if(likely(val->type != 0)) free(val->type);
+                               if(likely(val->name != 0)) free(val->name);
+                               free(val);
+                       }
+               }
+               kh_destroy(object, OBJECTHASH);
+               OBJECTHASH = NULL;
+               OBJECTHASH_UNLOCK;
+       }
+
+       if(DETECTORHASH)
+       {
+               DETECTORHASH_LOCK;
+               kh_destroy(detector, DETECTORHASH);
+               DETECTORHASH = NULL;
+               DETECTORHASH_UNLOCK;
+       }
+
+       return 0;
+}
+
+/***********************************************************
+ * symbol hash related functions
+ ***********************************************************/
+// return 0 if there is no entry in hash
+// return 1 if there is entry in hash
+// return negative value if error occurred
+int find_symbol_hash(void* ptr, char** psymbol)
+{
+       khiter_t k;
+       int ret = 0;
+
+       if(unlikely(SYMBOLHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       if(unlikely(psymbol == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+
+       SYMBOLHASH_LOCK;
+       k = kh_get(symbol, SYMBOLHASH, (uint32_t)ptr);
+       if(k == kh_end(SYMBOLHASH))             // there is no entry for key
+       {
+               ret = 0;
+       }
+       else
+       {
+               *psymbol = kh_value(SYMBOLHASH, k);
+               ret = 1;
+       }
+       SYMBOLHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+       return ret;
+}
+
+// return 0 if succeed
+// return 1 if there is already exist in hash
+// return negative value if other error occurred
+int add_symbol_hash(void* ptr, const char* str, int strlen)
+{
+       khiter_t k;
+       int rethash, ret = 0;
+
+       if(unlikely(SYMBOLHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       if(unlikely(str == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+
+       SYMBOLHASH_LOCK;
+       k = kh_put(symbol, SYMBOLHASH, (uint32_t)ptr, &rethash);
+       if(likely(rethash != 0))        // succeed to add in hash table
+       {
+               char* tlast = (char*)malloc(strlen);
+               if(likely(tlast != NULL))
+               {
+                       memcpy(tlast, str, strlen);
+                       kh_value(SYMBOLHASH, k) = tlast;
+               }
+               else
+               {
+                       kh_del(symbol, SYMBOLHASH, k);
+                       ret = ERR_OUTOFMEMORY;
+               }
+       }
+       else
+       {
+               // TODO : error handling
+               ret = 1;
+       }
+       SYMBOLHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+       return ret;
+}
+
+/***********************************************************
+ * memory hash related functions
+ ***********************************************************/
+// return 0 if succeed
+// return 1 if key is already exist in hash table
+// return negative value if other error occurred
+int add_memory_hash(void* ptr, size_t size)
+{
+       khiter_t k;
+       int rethash, ret = 0;
+
+       if(unlikely(MEMORYHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+       MEMORYHASH_LOCK;
+       k = kh_put(allocmap, MEMORYHASH, (uint32_t)ptr, &rethash);
+       if(likely(rethash != 0))        // succeed to add in hash table
+       {
+               kh_value(MEMORYHASH, k) = size;
+               update_heap_memory_size(true, size);
+       }
+       else
+       {
+               // TODO : key is already exist in hash
+               ret = 1;
+       }
+       MEMORYHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+       return ret;
+}
+
+// return 0 if succeed
+// return 1 if key is not in hash table
+// return negative if other error occurred
+int del_memory_hash(void* ptr)
+{
+       khiter_t k;
+       int ret = 0;
+       uint32_t size;
+
+       if(unlikely(MEMORYHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+       MEMORYHASH_LOCK;
+       k = kh_get(allocmap, MEMORYHASH, (uint32_t)ptr);
+       if(likely(k != kh_end(MEMORYHASH)))
+       {                               // there is entry in hash table
+               size = kh_value(MEMORYHASH, k);
+               update_heap_memory_size(false, size);
+               kh_del(allocmap, MEMORYHASH, k);
+       }
+       else
+       {
+               ret = 1;        // there is not entry in hash table
+       }
+       MEMORYHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+
+       return ret;
+}
+
+/***********************************************************
+ * object hash related functions
+ ***********************************************************/
+// return 0 if there is no entry in hash
+// return 1 if there is entry in hash
+// return negative value if error occurred
+int find_object_hash(void* ptr, char** type, char** classname)
+{
+       khiter_t k;
+       int ret = 0;
+
+       if(unlikely(OBJECTHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       if(unlikely(type == NULL))
+               return ERR_WRONGPARAMETER;
+
+       if(unlikely(classname == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+
+       OBJECTHASH_LOCK;
+       k = kh_get(object, OBJECTHASH, (uint32_t)ptr);
+       if(unlikely(k == kh_end(OBJECTHASH)))           // there is no entry for key
+       {
+               ret = 0;
+       }
+       else
+       {
+               *classname = kh_value(OBJECTHASH, k)->name;
+               *type = kh_value(OBJECTHASH, k)->type;
+               ret = 1;
+       }
+       OBJECTHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+       return ret;
+}
+
+// return 0 if succeed
+// return 1 if there is no entry in hash
+// return negative value if other error occurred
+int add_object_hash_class(void* ptr, const char* classname)
+{
+       int str_len;
+       khiter_t k;
+       int rethash, ret = 0;
+
+       if(unlikely(OBJECTHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       if(unlikely(classname == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+
+       str_len = strlen(classname) + 1;
+
+       OBJECTHASH_LOCK;
+       k = kh_put(object, OBJECTHASH, (uint32_t)ptr, &rethash);
+       if(likely(rethash == 0))        // entry is already in hash table
+       {
+               if(likely(kh_value(OBJECTHASH, k) != NULL))
+               {
+                       if(kh_value(OBJECTHASH, k)->name == NULL)
+                       {
+                               char* tlast = (char*)malloc(str_len);
+                               if(likely(tlast != NULL))
+                               {
+                                       memcpy(tlast, classname, str_len);
+                                       kh_value(OBJECTHASH, k)->name = tlast;
+                               }
+                               else
+                               {
+                                       kh_value(OBJECTHASH, k)->name = NULL;
+                                       ret = ERR_OUTOFMEMORY;  // out of memory
+                               }
+                       }
+                       else
+                               ret = ERR_ALREADYEXIST;
+               }
+               else    // not possible
+                       ret = ERR_NOTEXIST;     // there is entry but there is no value
+       }
+       else    // error
+               ret = 1;        // there is no entry
+
+       OBJECTHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+       return ret;
+}
+
+// return 0 if succeed
+// return 1 if there is already exist in hash
+// return negative value if other error occurred
+int add_object_hash_type(void* ptr, const char* type)
+{
+       int str_len;
+       khiter_t k;
+       int rethash, ret = 0;
+
+       if(unlikely(OBJECTHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       if(unlikely(type == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+
+       str_len = strlen(type) + 1;
+
+       OBJECTHASH_LOCK;
+       k = kh_put(object, OBJECTHASH, (uint32_t)ptr, &rethash);
+       if(likely(rethash != 0))        // succeed to add in hash table
+       {
+               char* tlast;
+               _objectinfo* newentry;
+
+               newentry = (_objectinfo*)calloc(1, sizeof(_objectinfo));
+               if(likely(newentry != NULL))
+               {
+                       kh_value(OBJECTHASH, k) = newentry;
+
+                       tlast = (char*)malloc(str_len);
+                       if(likely(tlast != NULL))
+                       {
+                               memcpy(tlast, type, str_len);
+                               kh_value(OBJECTHASH, k)->type = tlast;
+                       }
+                       else
+                       {
+                               kh_value(OBJECTHASH, k)->type = NULL;
+                               ret = ERR_OUTOFMEMORY;
+                       }
+               }
+               else
+               {
+                       kh_del(object, OBJECTHASH, k);
+                       ret = ERR_OUTOFMEMORY;
+               }
+       }
+       else
+               ret = 1;
+
+       OBJECTHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+       return ret;
+}
+
+// return 0 if succeed
+// return 1 if key is not in hash table
+// return negative value if other error occurred
+int del_object_hash(void* ptr)
+{
+       khiter_t k;
+       _objectinfo* val;
+       int ret = 0;
+
+       if(unlikely(OBJECTHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+       OBJECTHASH_LOCK;
+       k = kh_get(object, OBJECTHASH, (uint32_t)ptr);
+       if(likely(k != kh_end(OBJECTHASH)))             // there is entry in hash table
+       {
+               val = kh_value(OBJECTHASH, k);
+               kh_del(object, OBJECTHASH, k);
+               if(likely(val->type != NULL)) free(val->type);
+               if(likely(val->name != NULL)) free(val->name);
+               free(val);
+       }
+       else
+       {
+               ret = 1;
+       }
+       OBJECTHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+
+       return ret;
+}
+
+/***********************************************************
+ * detector hash related functions
+ ***********************************************************/
+// return 0 if succeed
+// return 1 if there is already exist in hash
+// return negative value if other error occurred
+int add_detector_hash(void* ptr, void* listener)
+{
+       khiter_t k;
+       int rethash, ret = 0;
+
+       if(unlikely(DETECTORHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       if(unlikely(listener == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+
+       DETECTORHASH_LOCK;
+       k = kh_put(detector, DETECTORHASH, (uint32_t)ptr, &rethash);
+       if(likely(rethash != 0))        // succeed to add in hash table
+       {
+               kh_value(DETECTORHASH, k) = listener;
+       }
+       else
+       {
+               // TODO : error handling
+               ret = 1;
+       }
+       DETECTORHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+       return ret;
+}
+
+// return 0 if succeed
+// return 1 if key is not in hash table
+// return negative value if other error occurred
+int del_detector_hash(void* ptr)
+{
+       khiter_t k;
+       int ret = 0;
+
+       if(unlikely(DETECTORHASH == 0))
+               return ERR_NOTINITIALIZED;
+
+       if(unlikely(ptr == NULL))
+               return ERR_WRONGPARAMETER;
+
+       TRACE_STATE_SET(TS_HASHFUNC);
+       DETECTORHASH_LOCK;
+       k = kh_get(detector, DETECTORHASH, (uint32_t)ptr);
+       if(likely(k != kh_end(DETECTORHASH)))           // there is entry in hash table
+       {
+               kh_del(detector, DETECTORHASH, k);
+       }
+       else
+       {
+               ret = 1;
+       }
+       DETECTORHASH_UNLOCK;
+       TRACE_STATE_UNSET(TS_HASHFUNC);
+
+       return ret;
+}
+
+
+// *********************************************************************************************
+// glist implemenation
+// *********************************************************************************************
+
+// all function to call this function have to use mutex_lock
+static element_t* find_element(char* key)
+{
+       element_t* res;
+       int keylen;
+
+       if(unlikely(key == NULL))
+               return NULL;
+       
+       keylen = strlen(key);
+
+//     pthread_mutex_lock(&glist_mutex);       // this is commented because of static function
+       res = gsymbol_list;
+       while(res != NULL)
+       {
+               if(keylen == res->keylen && (strcmp(key, res->keystr) == 0))
+                       break;
+               res = res->next;
+       }
+//     pthread_mutex_unlock(&glist_mutex);     // this is commented because of static function
+
+       return res;
+}
+
+int add_to_glist(char* key, void* data)
+{
+       element_t* elm;
+       int ret = 0;
+
+       if(unlikely(key == NULL || data == NULL))
+               return 0;
+
+       pthread_mutex_lock(&glist_mutex);
+       elm = find_element(key);
+       if(elm == NULL)
+       {
+               elm = (element_t*)malloc(sizeof(element_t));
+               if(likely(elm != NULL))
+               {
+                       elm->keylen = strlen(key);
+                       elm->keystr = (char*)malloc(elm->keylen + 1);
+                       if(likely(elm->keystr != NULL))
+                       {
+                               strcpy(elm->keystr, key);
+                               elm->dataptr = data;
+                               elm->next = gsymbol_list;
+                               elm->prev = NULL;
+                               if(gsymbol_list)
+                                       gsymbol_list->prev = elm;
+                               gsymbol_list = elm;
+                               ret = 1;
+                       }
+                       else
+                       {
+                               free(elm);
+                       }
+               }
+       }
+       pthread_mutex_unlock(&glist_mutex);
+
+       return ret;
+}
+
+int remove_from_glist(char* key)
+{
+       element_t* elm;
+       int ret = 0;
+       
+       pthread_mutex_lock(&glist_mutex);
+       elm = find_element(key);
+       if(elm != NULL)
+       {
+               if(elm->prev)
+                       elm->prev->next = elm->next;
+               if(elm->next)
+                       elm->next->prev = elm->prev;
+               if(gsymbol_list == elm)
+                       gsymbol_list = gsymbol_list->next;
+       }
+       pthread_mutex_unlock(&glist_mutex);
+
+       if(elm != NULL)
+       {
+               free(elm->dataptr);
+               free(elm->keystr);
+               free(elm);
+               ret = 1;
+       }
+
+       return ret;
+}
+
+int remove_all_glist()
+{
+       element_t* elm;
+       
+       pthread_mutex_lock(&glist_mutex);
+       while(gsymbol_list != NULL)
+       {
+               elm = gsymbol_list;
+               gsymbol_list = elm->next;
+               free(elm->dataptr);
+               free(elm->keystr);
+               free(elm);
+       }
+       pthread_mutex_unlock(&glist_mutex);
+
+       return 1;
+}
+
+void* find_glist(char* key)
+{
+       element_t* elm;
+
+       pthread_mutex_lock(&glist_mutex);
+       elm = find_element(key);
+       pthread_mutex_unlock(&glist_mutex);
+
+       if(elm)
+               return elm->dataptr;
+       else
+               return NULL;
+}
+
diff --git a/helper/dahelper.c b/helper/dahelper.c
new file mode 100755 (executable)
index 0000000..f9a9484
--- /dev/null
@@ -0,0 +1,190 @@
+/*\r
+ *  DA probe\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ *\r
+ * Jaewon Lim <jaewon81.lim@samsung.com>\r
+ * Woojin Jung <woojin2.jung@samsung.com>\r
+ * Juyoung Kim <j0.kim@samsung.com>\r
+ *\r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the\r
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+ * License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+\r
+#include <wchar.h>                     // for wcslen\r
+#include <unistd.h>                    // for unlink\r
+#include <sys/types.h>\r
+#include <dirent.h>                    // for opendir, readdir\r
+#include <sys/shm.h>           // for shared memory operation\r
+\r
+#include "dahelper.h"\r
+\r
+#define SHAREDMEMKEY                   ((key_t)463825)\r
+\r
+typedef struct\r
+{\r
+       long long allocsize;\r
+       long launch_flag;\r
+} __daSharedInfo;\r
+\r
+typedef struct\r
+{\r
+       int memid;                              // shared mem id\r
+       __daSharedInfo* pvalue;         // total alloced heap size\r
+} __sharedMemInfo;\r
+\r
+static __sharedMemInfo sharedmem =\r
+{\r
+       -1,                     // memid\r
+       (void*)-1       // pvalue\r
+};\r
+\r
+long long total_alloc_size = 0;\r
+\r
+/* trace info global variable */\r
+__traceInfo gTraceInfo =\r
+{\r
+       {\r
+               1,                                                      // int eventIndex\r
+               PTHREAD_MUTEX_INITIALIZER       // pthread_mutex_t eventMutex\r
+       },              // __indexInfo\r
+       {\r
+               -1,                                                     // int daemonSock\r
+               PTHREAD_MUTEX_INITIALIZER       // ptrhread_mutex_t sockMutex\r
+       },              // __socketInfo\r
+       {\r
+               {0, },                                          // char appName[128]\r
+               0                                                       // unsigned int startTime\r
+       },              // __appInfo\r
+       {\r
+               0,                                                      // int state\r
+               PTHREAD_MUTEX_INITIALIZER       // ptrhread_mutex_t ssMutex\r
+       },              // __screenshotInfo\r
+       {\r
+               NULL,                                           // map_start\r
+               NULL                                            // map_end\r
+       },              // __mapInfo\r
+       -1,                                                             // int stateTouch\r
+       0,                                                              // int init_complete\r
+       0,                                                              // int custom_chart_callback_count\r
+       NULL                                                    // long* pprobeflag\r
+};\r
+\r
+__thread unsigned long gSTrace = 0;\r
+\r
+// **************************************************************************************\r
+// shared memory management function\r
+// **************************************************************************************\r
+\r
+// return 0 for normal case\r
+// return -1 for error case\r
+int __atSharedMemory()\r
+{\r
+       sharedmem.memid = shmget(SHAREDMEMKEY, sizeof(__daSharedInfo), 0);\r
+       if(sharedmem.memid == -1)\r
+       {\r
+               return -1;\r
+       }\r
+       else\r
+       {\r
+               sharedmem.pvalue = (__daSharedInfo*)shmat(sharedmem.memid, NULL, 0);\r
+               if(sharedmem.pvalue == (void*)-1)\r
+               {\r
+                       return -1;\r
+               }\r
+               else\r
+               {\r
+                       sharedmem.pvalue->allocsize = total_alloc_size;\r
+                       gTraceInfo.pprobeflag = &(sharedmem.pvalue->launch_flag);\r
+                       return 0;\r
+               }\r
+       }\r
+}\r
+\r
+int __dtSharedMemory()\r
+{\r
+       int ret = 0;\r
+       if(sharedmem.pvalue != (void*)-1)\r
+       {\r
+               ret = shmdt(sharedmem.pvalue);\r
+               if(ret == 0)\r
+                       sharedmem.pvalue = (void*)-1;\r
+       }\r
+       gTraceInfo.pprobeflag = NULL;\r
+       return ret;\r
+}\r
+\r
+// update heap memory size into shared memory\r
+// return 0 if size is updated into shared memory\r
+// return 1 if size is updated into global variable\r
+int update_heap_memory_size(bool isAdd, size_t size)\r
+{\r
+       if(likely(sharedmem.pvalue != (void*)-1))\r
+       {\r
+               if(isAdd) sharedmem.pvalue->allocsize += (long)size;\r
+               else sharedmem.pvalue->allocsize -= (long)size;\r
+               return 0;\r
+       }\r
+       else\r
+       {\r
+               if(isAdd) total_alloc_size += (long)size;\r
+               else total_alloc_size -= (long)size;\r
+               return 1;\r
+       }\r
+}\r
+\r
+void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc)\r
+{\r
+       int nLen=(int)wcslen(pwstrSrc);\r
+       wcstombs(pstrDest, pwstrSrc, nLen+1);\r
+}\r
+\r
+// return 0 if succeed\r
+// return -1 if error occured\r
+int remove_indir(const char *dirname)\r
+{\r
+       DIR *dir;\r
+       struct dirent *entry;\r
+       char path[MAX_PATH_LENGTH];\r
+\r
+       dir = opendir(dirname);\r
+       if(dir == NULL)\r
+       {\r
+               return -1;\r
+       }\r
+\r
+       while((entry = readdir(dir)) != NULL)\r
+       {\r
+               if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, ".."))\r
+               {\r
+                       snprintf(path, (size_t) MAX_PATH_LENGTH, "%s/%s", dirname, entry->d_name);\r
+                       if (entry->d_type != DT_DIR)    // file\r
+                       {\r
+                               unlink(path);\r
+                       }\r
+                       else { }        // directory\r
+               }\r
+       }\r
+       closedir(dir);\r
+\r
+       return 0;\r
+}\r
+\r
+\r
diff --git a/helper/libdaprobe.c b/helper/libdaprobe.c
new file mode 100755 (executable)
index 0000000..08c9813
--- /dev/null
@@ -0,0 +1,694 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>                     // for printf
+#include <stdlib.h>                    // for getenv
+#include <string.h>                    // for strstr
+#include <stdbool.h>           // for bool
+#include <stdint.h>                    // fot uint32_t,uint64_t
+#include <stdarg.h>                    // for va_list, va_arg(__appendTypeLog)
+#include <execinfo.h>          // for backtrace, backtrace_symbols
+#include <unistd.h>                    // for write, alarm function, syscall
+#include <pthread.h>           // for pthread_mutex_lock
+
+#include <sys/syscall.h>       // for syscall
+#include <sys/time.h>          // for gettimeofday
+#include <sys/socket.h>                // for socket, connect
+#include <sys/un.h>                    // for sockaddr_un
+
+#include "probeinfo.h"
+#include "dautil.h"
+#include "dahelper.h"
+#include "dacollection.h"
+
+#define APP_INSTALL_PATH               "/opt/apps"
+#define UDS_NAME                               "/tmp/da.socket"
+
+__thread int                   gProbeDepth = 0;
+__thread unsigned int  gProbeBlockCount = 0;
+__thread pid_t                 gTid = -1;
+
+int getExecutableMappingAddress();
+
+/******************************************************************************
+ * internal functions
+   (this means that these functions do not need to set enter/exit flag)
+ ******************************************************************************/
+// create sokcet to daemon and connect
+static int createSocket(void)
+{
+       int clientLen, ret = 0;
+       struct sockaddr_un clientAddr;
+       char buf[16];
+
+       if((gTraceInfo.socket.daemonSock = socket(AF_UNIX, SOCK_STREAM,0)) != -1)
+       {
+               bzero(&clientAddr, sizeof(clientAddr));
+               clientAddr.sun_family = AF_UNIX;
+               sprintf(clientAddr.sun_path, "%s", UDS_NAME);
+
+               clientLen = sizeof(clientAddr);
+               if(connect(gTraceInfo.socket.daemonSock, (struct sockaddr *)&clientAddr, clientLen) >= 0)
+               {
+                       PRINTMSG("createSocket connect() success\n");
+                       sprintf(buf, "%d", getpid());
+                       printLogStr(buf, MSG_PID);
+                       sprintf(buf, "%u", gTraceInfo.app.startTime);
+                       printLogStr(buf, MSG_TIME);
+               }
+               else
+               {
+                       close(gTraceInfo.socket.daemonSock);
+                       gTraceInfo.socket.daemonSock = -1;
+                       ret = -1;
+               }
+       }
+       else
+       {
+               ret = -1;
+       }
+
+       return ret;
+}
+
+
+// parse backtrace string and find out the caller of probed api function
+// return 0 if caller is user binary, otherwise return 1
+static int determineCaller(char* tracestring)
+{
+       char *apppath, *substr;
+
+       // determine whether saveptr (caller binary name) is user binary or not
+//     apppath = getenv("APP_PATH");
+       apppath = NULL;
+
+       if(apppath == NULL)
+               substr = strstr(tracestring, APP_INSTALL_PATH);
+       else
+               substr = strstr(tracestring, apppath);
+
+       if(substr == NULL)      // not user binary
+               return 1;
+       else                            // user binary
+               return 0;
+}
+
+// return current thread id
+static pid_t _gettid()
+{
+       if(gTid == -1)
+               gTid = syscall(__NR_gettid);    // syscall is very expensive
+       return gTid;
+}
+
+/*****************************************************************************
+ * initialize / finalize function
+ *****************************************************************************/
+
+void __attribute__((constructor)) _init_probe()
+{
+       struct timeval cTime;
+
+       TRACE_STATE_SET(TS_INIT);
+
+       initialize_hash_table();
+
+       initialize_screencapture();
+
+       initialize_event();
+
+       getExecutableMappingAddress();
+
+       // get app start time
+       gettimeofday(&cTime, NULL);
+       gTraceInfo.app.startTime = ((cTime.tv_sec * 10000 + (cTime.tv_usec/100)));
+
+       // create socket for communication with da_daemon
+#ifndef PRINT_STDOUT
+       if(createSocket() >= 0)
+#endif
+       if(__atSharedMemory() < 0)
+       {
+               printLogStr("cannot at shared memory in helper", MSG_ERROR);
+       }
+
+       PRINTMSG("dynamic analyzer probe helper so loading...\n");
+
+       gTraceInfo.init_complete = 1;
+       TRACE_STATE_UNSET(TS_INIT);
+}
+
+void __attribute__((destructor)) _fini_probe()
+{
+       TRACE_STATE_SET(TS_FINIT);
+
+       gTraceInfo.init_complete = -1;
+       PRINTMSG("dynamic analyzer probe helper so unloading...\n");
+
+       __dtSharedMemory();
+
+       remove_all_glist();
+
+       // close socket
+#ifndef PRINT_STDOUT
+       if(gTraceInfo.socket.daemonSock != -1)
+       {
+               printLogStr(NULL, MSG_TERMINATE);
+               close(gTraceInfo.socket.daemonSock);
+               gTraceInfo.socket.daemonSock = -1;
+       }
+#endif
+
+       finalize_event();
+
+       finalize_screencapture();
+
+       finalize_hash_table();
+
+       TRACE_STATE_UNSET(TS_FINIT);
+}
+
+
+/**************************************************************************
+ * Helper APIs
+ **************************************************************************/
+
+/************************************************************************
+ * manipulate and print log functions
+ ************************************************************************/
+bool printLog(log_t* log, int msgType)
+{
+       if(unlikely(gTraceInfo.socket.daemonSock == -1))
+               return false;
+
+       if(unlikely(log == NULL))
+               return false;
+
+       TRACE_STATE_SET(TS_PRINT_LOG);
+
+#ifndef PRINT_STDOUT
+       log->type = msgType;
+
+       pthread_mutex_lock(&(gTraceInfo.socket.sockMutex));
+       send(gTraceInfo.socket.daemonSock, log, sizeof(log->type) + sizeof(log->length) + log->length, 0);
+       pthread_mutex_unlock(&(gTraceInfo.socket.sockMutex));
+
+#else
+       if(log != NULL && log->length > 0 && msgType == MSG_MSG)
+               printf("%s\n", log->data);
+#endif
+       TRACE_STATE_UNSET(TS_PRINT_LOG);
+
+       return true;
+}
+
+bool printLogStr(const char* str, int msgType)
+{
+#ifndef PRINT_STDOUT
+       log_t log;
+#endif
+
+       if(unlikely(gTraceInfo.socket.daemonSock == -1))
+               return false;
+
+       TRACE_STATE_SET(TS_PRINT_LOG);
+
+#ifndef PRINT_STDOUT
+       log.type = msgType;
+
+       if(str)
+       {
+               sprintf(log.data, "%s", str);
+               log.length = strlen(str);
+       }
+       else
+       {
+               log.length = 0;
+       }
+
+       pthread_mutex_lock(&(gTraceInfo.socket.sockMutex));
+       send(gTraceInfo.socket.daemonSock, &log, sizeof(log.type) + sizeof(log.length) + log.length, 0);
+       pthread_mutex_unlock(&(gTraceInfo.socket.sockMutex));
+
+#else
+       if(str != NULL && msgType == MSG_MSG)
+               printf("%s\n", str);
+#endif
+       TRACE_STATE_UNSET(TS_PRINT_LOG);
+
+       return true;
+}
+
+// return 0 for successful case
+// return non-zero for error
+// if token is NULL then use DEFAULT TOKEN "`,"
+// if token is not NULL then insert DEFAULT TOKEN before append input
+int __appendTypeLog(log_t* log, int nInput, char* token, ...)
+{
+       static char* default_token = DEFAULT_TOKEN;
+       va_list p_arg;
+       int i, type;
+       char* seperator = default_token;
+
+       if(nInput <= 0 || log == NULL)
+               return -1;
+
+       TRACE_STATE_SET(TS_APPEND_TYPE_LOG);
+
+       va_start(p_arg, token);
+
+       if(token != NULL)
+               seperator = token;
+
+       for(i = 0; i < nInput; i++)
+       {
+               type = va_arg(p_arg, int);
+
+               if(likely(log->length > 0))     // append token or default token
+               {
+                       if(unlikely(i == 0))
+                               log->length += sprintf(log->data + log->length, "%s", default_token);
+                       else
+                               log->length += sprintf(log->data + log->length, "%s", seperator);
+               }
+
+               switch(type)
+               {
+               case VT_INT:
+                       log->length += sprintf(log->data + log->length, "%d", va_arg(p_arg, int));
+                       break;
+               case VT_UINT:
+                       log->length += sprintf(log->data + log->length, "%u", va_arg(p_arg, unsigned int));
+                       break;
+               case VT_LONG:
+                       log->length += sprintf(log->data + log->length, "%ld", va_arg(p_arg, long));
+                       break;
+               case VT_ULONG:
+                       log->length += sprintf(log->data + log->length, "%lu", va_arg(p_arg, unsigned long));
+                       break;
+               case VT_STR:
+                       log->length += sprintf(log->data + log->length, "%s", va_arg(p_arg, char*));
+                       break;
+               case VT_CHAR:   // 'char' is promoted to 'int' when passed through '...'
+                       log->length += sprintf(log->data + log->length, "%c", va_arg(p_arg, int));
+                       break;
+               case VT_PTR:
+                       log->length += sprintf(log->data + log->length, "%p", va_arg(p_arg, void*));
+                       break;
+               case VT_NULL:
+                       va_arg(p_arg, unsigned int);
+                       break;
+               case VT_OFF_T:
+                       log->length += sprintf(log->data + log->length, "%ld", va_arg(p_arg, off_t));
+                       break;
+               case VT_SIZE_T:
+                       log->length += sprintf(log->data + log->length, "%u", va_arg(p_arg, size_t));
+                       break;
+               case VT_SSIZE_T:
+                       log->length += sprintf(log->data + log->length, "%d", va_arg(p_arg, ssize_t));
+                       break;
+               case VT_SOCKLEN_T:
+                       log->length += sprintf(log->data + log->length, "%u", va_arg(p_arg, socklen_t));
+                       break;
+               case VT_UINT16_T:       // 'uint16_t' is promoted to 'int' when passed through '...'
+                       log->length += sprintf(log->data + log->length, "%u", va_arg(p_arg, int));
+                       break;
+               case VT_UINT32_T:
+                       log->length += sprintf(log->data + log->length, "%u", va_arg(p_arg, uint32_t));
+                       break;
+               case VT_UINT64_T:
+                       log->length += sprintf(log->data + log->length, "%llu", va_arg(p_arg, uint64_t));
+                       break;
+               case VT_MODE_T:
+                       log->length += sprintf(log->data + log->length, "%u", va_arg(p_arg, mode_t));
+                       break;
+/*             case VT_DEV_T:
+                       log->length += sprintf(log->data + log->length, "%lu", va_arg(p_arg, dev_t));
+                       break;
+               case VT_NFDS_T:
+                       log->length += sprintf(log->data + log->length, "%lu", va_arg(p_arg, nfds_t));
+                       break;*/
+               default:
+                       va_end(p_arg);
+                       TRACE_STATE_UNSET(TS_APPEND_TYPE_LOG);
+                       return -1;
+               }
+       }
+
+       va_end(p_arg);
+
+       TRACE_STATE_UNSET(TS_APPEND_TYPE_LOG);
+       return 0;
+}
+
+// get backtrace string
+// return stack depth if succeed, otherwise return 0
+// parameter 'log' cannot be null
+int getBacktraceString(log_t* log, int bufsize)
+{
+       void* array[MAX_STACK_DEPTH];
+       char** strings = NULL;
+       size_t i, size;
+       int initsize;
+       int stringlen;
+
+       if(log == NULL)
+               return 0;
+
+       TRACE_STATE_SET(TS_BACKTRACE);
+
+       initsize = log->length;
+       log->data[log->length] = '\0';  // is this necessary ?
+       size = backtrace(array, MAX_STACK_DEPTH);
+       if(likely(size > TRIM_STACK_DEPTH))
+       {
+               strings = BACKTRACE_SYMBOLS(array + TRIM_STACK_DEPTH, size - TRIM_STACK_DEPTH);
+
+               if(likely(strings != NULL))
+               {
+                       for(i = TRIM_STACK_DEPTH; i < size; i++)
+                       {
+                               stringlen = strlen(strings[i - TRIM_STACK_DEPTH]) + 14;
+                               if(log->length + stringlen >= bufsize + initsize)
+                                       break;
+
+                               log->length += sprintf(log->data + log->length, "%010u`,%s`,", (unsigned int)(array[i]), strings[i - TRIM_STACK_DEPTH]);
+                       }
+                       log->data[log->length-2] = '\0';
+                       log->length -= 2;
+                       free(strings);
+               }
+               else    // failed to get backtrace symbols
+               {
+                       // just print trace address
+                       for(i = TRIM_STACK_DEPTH; i < size; i++)
+                       {
+                               stringlen = 23;
+                               if(log->length + stringlen >= bufsize + initsize)
+                                       break;
+
+                               log->length += sprintf(log->data + log->length, "%010u`,(unknown)`,", (unsigned int)(array[i]));
+                       }
+                       log->data[log->length-2] = '\0';
+                       log->length -= 2;
+               }
+
+               TRACE_STATE_UNSET(TS_BACKTRACE);
+               return (int)(size - TRIM_STACK_DEPTH);
+       }
+       else
+       {
+               TRACE_STATE_UNSET(TS_BACKTRACE);
+               return 0;
+       }
+}
+
+/*
+int printSamplingLog()
+{
+       log_t log;
+
+       TRACE_STATE_SET(TS_PRINT_SAMPLE_LOG);
+       log.length = sprintf(log.data, "%d`,%lu`,%d`,%Ld",
+                       LC_ALLOCMEM, getCurrentTime(), getpid(), total_alloc_size);
+
+       printLog(&log, MSG_LOG);
+       TRACE_STATE_UNSET(TS_PRINT_SAMPLE_LOG);
+       return 0;
+}
+*/
+
+/*************************************************************************
+ * probe block control functions
+ *************************************************************************/
+int preBlockBegin(void* caller, bool bFiltering)
+{
+       bool user = false;
+       void* tarray[1];
+       char** strings;
+
+       if(gSTrace != 0 || gProbeDepth != 0)
+               return 0;
+
+       if(gTraceInfo.init_complete <= 0)
+               return 0;
+
+       TRACE_STATE_SET(TS_ENTER_PROBE_BLOCK);
+
+       if(gTraceInfo.exec_map.map_start != NULL)
+       {
+               // address comparison
+               if(caller >= gTraceInfo.exec_map.map_start &&
+                               caller <= gTraceInfo.exec_map.map_end)
+               {
+                       user = true;
+               }
+               else
+               {
+                       // nothing to do
+               }
+       }
+       else
+       {
+               // backtrace for filtering
+               tarray[0] = caller;
+               strings = BACKTRACE_SYMBOLS(tarray, 1);
+               if(strings != NULL)
+               {
+                       if((determineCaller(strings[0]) == 0))
+                               user = true;
+                       free(strings);
+               }
+               else
+               {
+                       // nothing to do
+               }
+       }
+
+       if((!user) && bFiltering)
+       {
+               TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
+               return 0;
+       }
+       else
+       {
+               // nothing to do
+       }
+
+       gProbeDepth++;
+
+       if(user)
+               return 2;       // user call
+       else
+               return 1;       // internal call
+}
+
+int postBlockBegin(int preresult)
+{
+       if(preresult)
+       {
+               TRACE_STATE_SET(TS_ENTER_PROBE_BLOCK);
+       }
+
+       return preresult;
+}
+
+void preBlockEnd()
+{
+       TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
+}
+
+void postBlockEnd()
+{
+       gProbeDepth--;
+       TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
+}
+
+// for block that have to be run
+void probeBlockStart()
+{
+       gProbeBlockCount++;
+       if(gProbeBlockCount == 1)
+               TRACE_STATE_SET(TS_PROBE);
+}
+
+void probeBlockEnd()
+{
+       if(gProbeBlockCount == 1)
+               TRACE_STATE_UNSET(TS_PROBE);
+       gProbeBlockCount--;
+}
+
+/*************************************************************************
+ * helper info getter functions
+ *************************************************************************/
+// return current time in 1/10000 sec unit
+unsigned long getCurrentTime()
+{
+       struct timeval cTime;
+
+       gettimeofday(&cTime, NULL);
+
+       return (unsigned long)((cTime.tv_sec * 10000 + (cTime.tv_usec/100)));
+}
+
+unsigned int getCurrentEventIndex()
+{
+       return gTraceInfo.index.eventIndex;
+}
+
+unsigned int getCallDepth()
+{
+       return gProbeDepth;
+}
+
+unsigned long getTraceState()
+{
+       return gSTrace;
+}
+
+bool isEnableSnapshot()
+{
+       if(gTraceInfo.pprobeflag != NULL)
+               return (bool)(*gTraceInfo.pprobeflag & ENABLE_SNAPSHOT);
+       else
+               return false;
+}
+
+bool isEnableInternalMalloc()
+{
+       if(gTraceInfo.pprobeflag != NULL)
+               return (bool)(*gTraceInfo.pprobeflag & ENABLE_INTERNAL_MALLOC);
+       else
+               return false;
+}
+
+
+/******************************************************************
+ * screen capture and event related functions
+ ******************************************************************/
+
+/*
+// TRACE_STATE_SET is not necessary because this function is called in probe block only
+int registeScreenChange(int renderID)
+{
+       if(gTraceInfo.snapshot.isTouchDown == 0)
+       {
+               return 0;
+       }
+
+       if(gTraceInfo.snapshot.snapshotAPICallStartTime == 0){
+               gTraceInfo.snapshot.snapshotAPICallStartTime = getCurrentTime();
+               gTraceInfo.snapshot.snapshotAPICallCount = 1;
+       }
+       else
+               gTraceInfo.snapshot.snapshotAPICallCount++;
+
+       gTraceInfo.snapshot.renderID = renderID;
+
+       return 1;
+}
+
+void detectTouchEvent(int touchID)
+{
+       gTraceInfo.stateTouch = touchID;
+
+       TRACE_STATE_SET(TS_DETECT_TOUCH);
+       if(isEnableSnapshot())
+       {
+               if(touchID == EVENT_TYPE_UP)
+               {
+                       if(gTraceInfo.snapshot.isTouchDown == 1)
+                       {
+                               gTraceInfo.snapshot.snapshotAPICallStartTime = getCurrentTime();
+                               captureProbe();
+                       }
+                       gTraceInfo.snapshot.isTouchDown = 1;
+               }
+       }
+       TRACE_STATE_UNSET(TS_DETECT_TOUCH);
+}
+
+int getTouchState()
+{
+       return gTraceInfo.stateTouch;
+}
+
+// TRACE_STATE_SET is not necessary because this function is called in probe block only
+int isPossibleCapture()
+{
+       if(gTraceInfo.snapshot.isTouchDown == 0)
+       {
+               return 0;
+       }
+       else
+               gTraceInfo.snapshot.snapshotAPICallCount--;
+
+       if(((getCurrentTime() - gTraceInfo.snapshot.snapshotAPICallStartTime) < SNAPSHOT_WAIT_TIME_MAX) && (gTraceInfo.snapshot.snapshotAPICallCount > 0))
+       {
+               return 0;
+       }
+
+       gTraceInfo.snapshot.isTouchDown = 0;
+       gTraceInfo.snapshot.snapshotAPICallStartTime = 0;
+       gTraceInfo.snapshot.snapshotAPICallCount = 0;
+       gTraceInfo.snapshot.renderID = -1;
+
+       return 1;
+}
+*/
+
+/************************************************************************
+ * probe functions
+ ************************************************************************/
+bool setProbePoint(probeInfo_t* iProbe)
+{
+       if(unlikely(iProbe == NULL))
+       {
+               return false;
+       }
+
+       TRACE_STATE_SET(TS_SET_PROBE_POINT);
+
+       // atomic operaion(gcc builtin) is more expensive then pthread_mutex
+       pthread_mutex_lock(&(gTraceInfo.index.eventMutex));     
+       iProbe->eventIndex = gTraceInfo.index.eventIndex++;
+       pthread_mutex_unlock(&(gTraceInfo.index.eventMutex));
+
+       iProbe->currentTime = getCurrentTime();
+       iProbe->pID = getpid();
+       iProbe->tID = _gettid();
+       iProbe->callDepth = gProbeDepth;
+
+       TRACE_STATE_UNSET(TS_SET_PROBE_POINT);
+       return true;
+}
+
diff --git a/helper/private_link.h b/helper/private_link.h
new file mode 100644 (file)
index 0000000..443d911
--- /dev/null
@@ -0,0 +1,374 @@
+/* Data structure for communication from the run-time dynamic linker for
+   loaded ELF shared objects.
+   Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef        _PRIVATE_LINK_H
+#define        _PRIVATE_LINK_H 1
+
+#ifdef _LINK_H
+# error this should be impossible
+#endif
+
+/* Get most of the contents from the public header, but we define a
+   different `struct link_map' type for private use.  The la_objopen
+   prototype uses the type, so we have to declare it separately.  */
+#define link_map       link_map_public
+#define la_objopen     la_objopen_wrongproto
+#include <link.h>
+#undef link_map
+#undef la_objopen
+
+struct link_map;
+extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid, uintptr_t *__cookie);
+
+#include <stddef.h>            // for ptrdiff_t
+//#include <tls.h>
+//#include <bits/libc-lock.h>
+
+/* Number of extra dynamic section entries for this architecture.
+   By default there are none.  */
+#define DT_THISPROCNUM  0
+
+// The type of the return value of fixup/profile_fixup.
+#define DL_FIXUP_VALUE_TYPE ElfW(Addr)
+// Construct a value of type DL_FIXUP_VALUE_TYPE from a code address and a link map.
+#define DL_FIXUP_MAKE_VALUE(map, addr) (addr)
+// Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.
+#define DL_FIXUP_VALUE_CODE_ADDR(value) (value)
+#define DL_FIXUP_VALUE_ADDR(value) (value)
+#define DL_FIXUP_ADDR_VALUE(addr) (addr)
+
+struct link_map_machine
+{
+       // empty by default
+};
+
+/* Some internal data structures of the dynamic linker used in the
+   linker map.  We only provide forward declarations.  */
+
+/* For the version handling we need an array with only names and their
+   hash values.  */
+struct r_found_version
+{
+       const char *name;
+       ElfW(Word) hash;
+       int hidden;
+       const char *filename;
+};
+
+/* We want to cache information about the searches for shared objects.  */
+
+enum r_dir_status { unknown, nonexisting, existing };
+
+struct r_search_path_elem
+{
+       /* This link is only used in the `all_dirs' member of `r_search_path'.  */
+       struct r_search_path_elem *next;
+
+       /* Strings saying where the definition came from.  */
+       const char *what;
+       const char *where;
+
+       /* Basename for this search path element.  The string must end with     a slash character.  */
+       const char *dirname;
+       size_t dirnamelen;
+
+       enum r_dir_status status[0];
+};
+
+/* A data structure for a simple single linked list of strings.  */
+struct libname_list
+{
+       const char *name;       /* Name requested (before search).  */
+       struct libname_list *next;  /* Link to next name for this object.  */
+       int dont_free;      /* Flag whether this element should be freed
+                                               if the object is not entirely unloaded.  */
+};
+
+/* Forward declaration.  */
+struct link_map;
+
+/* Structure to describe a single list of scope elements.  The lookup
+   functions get passed an array of pointers to such structures.  */
+struct r_scope_elem
+{
+       /* Array of maps for the scope.  */
+       struct link_map **r_list;
+       /* Number of entries in the scope.  */
+       unsigned int r_nlist;
+};
+
+
+/* Structure to record search path and allocation mechanism.  */
+struct r_search_path_struct
+{
+       struct r_search_path_elem **dirs;
+       int malloced;
+};
+
+
+/* Structure describing a loaded shared object.  The `l_next' and `l_prev'
+   members form a chain of all the shared objects loaded at startup.
+
+   These data structures exist in space used by the run-time dynamic linker;
+   modifying them may have disastrous results.
+
+   This data structure might change in future, if necessary.  User-level
+   programs must avoid defining objects of this type.  */
+
+struct link_map
+  {
+    /* These first few members are part of the protocol with the debugger.
+       This is the same format used in SVR4.  */
+
+    ElfW(Addr) l_addr;         /* Base address shared object is loaded at.  */
+    char *l_name;              /* Absolute file name object was found in.  */
+    ElfW(Dyn) *l_ld;           /* Dynamic section of the shared object.  */
+    struct link_map *l_next, *l_prev; /* Chain of loaded objects.  */
+
+    /* All following members are internal to the dynamic linker.
+       They may change without notice.  */
+
+    /* This is an element which is only ever different from a pointer to
+       the very same copy of this type for ld.so when it is used in more
+       than one namespace.  */
+    struct link_map *l_real;
+
+    /* Number of the namespace this link map belongs to.  */
+    Lmid_t l_ns;
+
+    struct libname_list *l_libname;
+    /* Indexed pointers to dynamic section.
+       [0,DT_NUM) are indexed by the processor-independent tags.
+       [DT_NUM,DT_NUM+DT_THISPROCNUM) are indexed by the tag minus DT_LOPROC.
+       [DT_NUM+DT_THISPROCNUM,DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM) are
+       indexed by DT_VERSIONTAGIDX(tagvalue).
+       [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM,
+       DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM) are indexed by
+       DT_EXTRATAGIDX(tagvalue).
+       [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM,
+       DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM) are
+       indexed by DT_VALTAGIDX(tagvalue) and
+       [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM,
+       DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM+DT_ADDRNUM)
+       are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>.  */
+
+    ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
+                     + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
+    const ElfW(Phdr) *l_phdr;  /* Pointer to program header table in core.  */
+    ElfW(Addr) l_entry;                /* Entry point location.  */
+    ElfW(Half) l_phnum;                /* Number of program header entries.  */
+    ElfW(Half) l_ldnum;                /* Number of dynamic segment entries.  */
+
+    /* Array of DT_NEEDED dependencies and their dependencies, in
+       dependency order for symbol lookup (with and without
+       duplicates).  There is no entry before the dependencies have
+       been loaded.  */
+    struct r_scope_elem l_searchlist;
+
+    /* We need a special searchlist to process objects marked with
+       DT_SYMBOLIC.  */
+    struct r_scope_elem l_symbolic_searchlist;
+
+    /* Dependent object that first caused this object to be loaded.  */
+    struct link_map *l_loader;
+
+    /* Array with version names.  */
+    struct r_found_version *l_versions;
+    unsigned int l_nversions;
+
+    /* Symbol hash table.  */
+    Elf_Symndx l_nbuckets;
+    Elf32_Word l_gnu_bitmask_idxbits;
+    Elf32_Word l_gnu_shift;
+    const ElfW(Addr) *l_gnu_bitmask;
+    union
+    {
+      const Elf32_Word *l_gnu_buckets;
+      const Elf_Symndx *l_chain;
+    };
+    union
+    {
+      const Elf32_Word *l_gnu_chain_zero;
+      const Elf_Symndx *l_buckets;
+    };
+
+    unsigned int l_direct_opencount; /* Reference count for dlopen/dlclose.  */
+    enum                       /* Where this object came from.  */
+      {
+       lt_executable,          /* The main executable program.  */
+       lt_library,             /* Library needed by main executable.  */
+       lt_loaded               /* Extra run-time loaded shared object.  */
+      } l_type:2;
+    unsigned int l_relocated:1;        /* Nonzero if object's relocations done.  */
+    unsigned int l_init_called:1; /* Nonzero if DT_INIT function called.  */
+    unsigned int l_global:1;   /* Nonzero if object in _dl_global_scope.  */
+    unsigned int l_reserved:2; /* Reserved for internal use.  */
+    unsigned int l_phdr_allocated:1; /* Nonzero if the data structure pointed
+                                       to by `l_phdr' is allocated.  */
+    unsigned int l_soname_added:1; /* Nonzero if the SONAME is for sure in
+                                     the l_libname list.  */
+    unsigned int l_faked:1;    /* Nonzero if this is a faked descriptor
+                                  without associated file.  */
+    unsigned int l_need_tls_init:1; /* Nonzero if GL(dl_init_static_tls)
+                                      should be called on this link map
+                                      when relocation finishes.  */
+    unsigned int l_used:1;     /* Nonzero if the DSO is used.  */
+    unsigned int l_auditing:1; /* Nonzero if the DSO is used in auditing.  */
+    unsigned int l_audit_any_plt:1; /* Nonzero if at least one audit module
+                                      is interested in the PLT interception.*/
+    unsigned int l_removed:1;  /* Nozero if the object cannot be used anymore
+                                  since it is removed.  */
+    unsigned int l_contiguous:1; /* Nonzero if inter-segment holes are
+                                   mprotected or if no holes are present at
+                                   all.  */
+
+    /* Collected information about own RPATH directories.  */
+    struct r_search_path_struct l_rpath_dirs;
+
+    /* Collected results of relocation while profiling.  */
+    struct reloc_result
+    {
+      DL_FIXUP_VALUE_TYPE addr;
+      struct link_map *bound;
+      unsigned int boundndx;
+      uint32_t enterexit;
+      unsigned int flags;
+    } *l_reloc_result;
+
+    /* Pointer to the version information if available.  */
+    ElfW(Versym) *l_versyms;
+
+    /* String specifying the path where this object was found.  */
+    const char *l_origin;
+
+    /* Start and finish of memory map for this object.  l_map_start
+       need not be the same as l_addr.  */
+    ElfW(Addr) l_map_start, l_map_end;
+    /* End of the executable part of the mapping.  */
+    ElfW(Addr) l_text_end;
+
+    /* Default array for 'l_scope'.  */
+    struct r_scope_elem *l_scope_mem[4];
+    /* Size of array allocated for 'l_scope'.  */
+    size_t l_scope_max;
+    /* This is an array defining the lookup scope for this link map.
+       There are initially at most three different scope lists.  */
+    struct r_scope_elem **l_scope;
+
+    /* A similar array, this time only with the local scope.  This is
+       used occasionally.  */
+    struct r_scope_elem *l_local_scope[2];
+
+    /* This information is kept to check for sure whether a shared
+       object is the same as one already loaded.  */
+    dev_t l_dev;
+    ino64_t l_ino;
+
+    /* Collected information about own RUNPATH directories.  */
+    struct r_search_path_struct l_runpath_dirs;
+
+    /* List of object in order of the init and fini calls.  */
+    struct link_map **l_initfini;
+
+    /* List of the dependencies introduced through symbol binding.  */
+    unsigned int l_reldepsmax;
+    struct link_map_reldeps
+      {
+       unsigned int act;
+       struct link_map *list[];
+      } *l_reldeps;
+
+    /* Various flag words.  */
+    ElfW(Word) l_feature_1;
+    ElfW(Word) l_flags_1;
+    ElfW(Word) l_flags;
+
+    /* Temporarily used in `dl_close'.  */
+    int l_idx;
+
+    struct link_map_machine l_mach;
+
+    struct
+    {
+      const ElfW(Sym) *sym;
+      int type_class;
+      struct link_map *value;
+      const ElfW(Sym) *ret;
+    } l_lookup_cache;
+
+    /* Thread-local storage related info.  */
+
+    /* Start of the initialization image.  */
+    void *l_tls_initimage;
+    /* Size of the initialization image.  */
+    size_t l_tls_initimage_size;
+    /* Size of the TLS block.  */
+    size_t l_tls_blocksize;
+    /* Alignment requirement of the TLS block.  */
+    size_t l_tls_align;
+    /* Offset of first byte module alignment.  */
+    size_t l_tls_firstbyte_offset;
+#ifndef NO_TLS_OFFSET
+# define NO_TLS_OFFSET 0
+#endif
+#ifndef FORCED_DYNAMIC_TLS_OFFSET
+# if NO_TLS_OFFSET == 0
+#  define FORCED_DYNAMIC_TLS_OFFSET 1
+# elif NO_TLS_OFFSET == -1
+#  define FORCED_DYNAMIC_TLS_OFFSET -2
+# else
+#  error "FORCED_DYNAMIC_TLS_OFFSET is not defined"
+# endif
+#endif
+    /* For objects present at startup time: offset in the static TLS block.  */
+    ptrdiff_t l_tls_offset;
+    /* Index of the module in the dtv array.  */
+    size_t l_tls_modid;
+
+    /* Information used to change permission after the relocations are
+       done.  */
+    ElfW(Addr) l_relro_addr;
+    size_t l_relro_size;
+
+    unsigned long long int l_serial;
+
+    /* Audit information.  This array apparent must be the last in the
+       structure.  Never add something after it.  */
+    struct auditstate
+    {
+      uintptr_t cookie;
+      unsigned int bindflags;
+    } l_audit[0];
+  };
+
+
+#if __ELF_NATIVE_CLASS == 32
+# define symbind symbind32
+#elif __ELF_NATIVE_CLASS == 64
+# define symbind symbind64
+#else
+# error "__ELF_NATIVE_CLASS must be defined"
+#endif
+
+extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
+                                              size_t size, void *data),
+                             void *data);
+
+#endif /* include/link.h */
diff --git a/include/dacollection.h b/include/dacollection.h
new file mode 100755 (executable)
index 0000000..580c18b
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef __COLLECTIONS_H__
+#define __COLLECTIONS_H__
+
+#include <pthread.h>                   // for pthread_mutex_t
+
+#include "khash.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#define SYMBOLHASH                     _hashinfo.symHash
+#define SYMBOLHASH_LOCK                pthread_mutex_lock(&(_hashinfo.symHashMutex))
+#define SYMBOLHASH_UNLOCK      pthread_mutex_unlock(&(_hashinfo.symHashMutex))
+
+#define MEMORYHASH                     _hashinfo.memHash
+#define MEMORYHASH_LOCK                pthread_mutex_lock(&(_hashinfo.memHashMutex))
+#define MEMORYHASH_UNLOCK      pthread_mutex_unlock(&(_hashinfo.memHashMutex))
+
+#define OBJECTHASH                     _hashinfo.objHash
+#define OBJECTHASH_LOCK                pthread_mutex_lock(&(_hashinfo.objHashMutex))
+#define OBJECTHASH_UNLOCK      pthread_mutex_unlock(&(_hashinfo.objHashMutex))
+
+#define DETECTORHASH           _hashinfo.dttHash
+#define DETECTORHASH_LOCK      pthread_mutex_lock(&(_hashinfo.dttHashMutex))
+#define DETECTORHASH_UNLOCK    pthread_mutex_unlock(&(_hashinfo.dttHashMutex))
+
+typedef struct
+{
+       char* type;
+       char* name;
+} _objectinfo;
+
+// khash table function definition
+KHASH_MAP_INIT_INT(symbol, char*)
+
+KHASH_MAP_INIT_INT(allocmap, size_t)
+
+KHASH_MAP_INIT_INT(object, _objectinfo*)
+
+KHASH_MAP_INIT_INT(detector, void*)
+
+typedef struct
+{
+       khash_t(symbol)*        symHash;
+       pthread_mutex_t         symHashMutex;
+       khash_t(allocmap)*      memHash;
+       pthread_mutex_t         memHashMutex;
+       khash_t(object)*        objHash;
+       pthread_mutex_t         objHashMutex;
+       khash_t(detector)*      dttHash;
+       pthread_mutex_t         dttHashMutex;
+} __hashInfo;
+
+extern __hashInfo _hashinfo;
+
+// APIs for symdata linked list
+int add_to_glist(char* key, void* data);
+int remove_from_glist(char* key);
+int remove_all_glist();
+void* find_glist(char* key);
+
+// APIs for hash table
+int initialize_hash_table();
+int finalize_hash_table();
+
+int find_symbol_hash(void* ptr, char** psymbol);
+int add_symbol_hash(void* ptr, const char* str, int strlen);
+int add_memory_hash(void* ptr, size_t size);
+int del_memory_hash(void* ptr);
+
+int find_object_hash(void* ptr, char** type,  char** classname);
+int add_object_hash_class(void* ptr, const char* classname);
+int add_object_hash_type(void* ptr, const char* type);
+int del_object_hash(void* ptr);
+
+int add_detector_hash(void* ptr, void* listener);
+int del_detector_hash(void* ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __COLLECTIONS_H_ */
diff --git a/include/daerror.h b/include/daerror.h
new file mode 100755 (executable)
index 0000000..9eade26
--- /dev/null
@@ -0,0 +1,54 @@
+/*  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef DAERROR_H_
+#define DAERROR_H_
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#define ERR_SUCCESS                            0
+#define ERR_OUTOFMEMORY                        -11
+#define ERR_WRONGPARAMETER             -12
+#define ERR_NOTINITIALIZED             -13
+#define ERR_NOTEXIST                   -21
+#define ERR_ALREADYEXIST               -22
+#define ERR_OTHER                              -30
+#define ERR_DLOPEN                             -101
+#define ERR_DLSYM                              -102
+#define ERR_USER                               -10000
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* DAERROR_H_ */
diff --git a/include/dahelper.h b/include/dahelper.h
new file mode 100755 (executable)
index 0000000..6a4445d
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef _DAHELPER_H_
+#define _DAHELPER_H_
+
+#include <stdbool.h>
+#include <pthread.h>                   // for pthread_mutex_t
+
+#include <Evas.h>
+
+#include "daprobe.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#define MAX_PATH_LENGTH                256
+#define MAX_STACK_DEPTH                128
+#define TRIM_STACK_DEPTH       2
+
+/*
+#define WIN_RENDER_POST 0
+#define CONTROLBAR_RENDER_POST 1
+#define NAVIFRAME_RENDER_POST 2
+#define PAGER_RENDER_POST 3
+#define RENDER_POST_COUNT 4
+
+#define SNAPSHOT_WAIT_TIME_MAX 10000
+*/
+
+#define TS_NONE                                                0x0000
+#define TS_PROBE                                       0x0001
+#define TS_INIT                                                0x0002
+#define TS_FINIT                                       0x0004
+#define TS_ENTER_PROBE_BLOCK           0x0008
+#define TS_SET_PROBE_POINT                     0x0010
+#define TS_PRINT_LOG                           0x0020
+#define TS_PRINT_SAMPLE_LOG                    0x0040
+#define TS_APPEND_TYPE_LOG                     0x0080
+#define TS_BACKTRACE                           0x0100
+#define TS_HASHFUNC                                    0x0200
+#define TS_PROFIL_THREAD                       0x0400
+#define TS_PROFIL_COUNT                                0x0800
+#define TS_DETECT_TOUCH                                0x1000
+#define TS_REGIST_SCREEN_CHANGE                0x2000
+#define TS_POSSIBLE_CAPTURE                    0x4000
+#define TRACE_STATE_SET(value)         ((gSTrace) |= (value))
+#define TRACE_STATE_UNSET(value)       ((gSTrace) &= (~value))
+
+#define ENABLE_INTERNAL_MALLOC         0x0001
+#define ENABLE_SNAPSHOT                                0x0002
+
+#define SCREENSHOT_LOCK()                                                                              \
+       do {                                                                                                            \
+               int old;                                                                                                \
+               pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
+               old = gTraceInfo.screenshot.state;                                              \
+               gTraceInfo.screenshot.state = -1;                                               \
+               pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
+               if(old > 0) {                                                                                   \
+                       if(isEnableSnapshot())                                                          \
+                               captureScreen();                                                                \
+               }                                                                                                               \
+       } while(0)
+
+#define SCREENSHOT_UNLOCK()                                                                            \
+       do {                                                                                                            \
+               pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
+               gTraceInfo.screenshot.state = 1;                                                \
+               pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
+       } while(0)
+
+#define SCREENSHOT_SET()                                                                               \
+       do {                                                                                                            \
+               int old;                                                                                                \
+               pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
+               old = gTraceInfo.screenshot.state;                                              \
+               if(gTraceInfo.screenshot.state >= 0)                                    \
+                       gTraceInfo.screenshot.state = 1;                                        \
+               pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
+               if(old == 2) {                                                                                  \
+                       if(isEnableSnapshot())                                                          \
+                               captureScreen();                                                                \
+               }                                                                                                               \
+       } while(0)
+
+#define SCREENSHOT_UNSET()                                                                             \
+       do {                                                                                                            \
+               pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
+               if(gTraceInfo.screenshot.state >= 0)                                    \
+                       gTraceInfo.screenshot.state = 0;                                        \
+               pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
+       } while(0)
+
+#define SCREENSHOT_DONE()                                                                              \
+       do {                                                                                                            \
+               int old;                                                                                                \
+               pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
+               old = gTraceInfo.screenshot.state;                                              \
+               if(gTraceInfo.screenshot.state == 1) {                                  \
+                       gTraceInfo.screenshot.state = 2;                                        \
+               } else if(gTraceInfo.screenshot.state == 2) {                   \
+                       gTraceInfo.screenshot.state = 0;                                        \
+               } else {                                                                                                \
+               }                                                                                                               \
+               pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
+               if(old == 1) {                                                                                  \
+                       activateCaptureTimer();                                                         \
+               } else if(old == 2) {                                                                   \
+                       if(isEnableSnapshot())                                                          \
+                               captureScreen();                                                                \
+               }                                                                                                               \
+       } while(0)
+
+// type definition for global variable
+typedef struct
+{
+       int eventIndex;
+       pthread_mutex_t eventMutex;
+} __indexInfo;
+
+typedef struct
+{
+       int daemonSock;
+       pthread_mutex_t sockMutex;
+} __socketInfo;
+
+typedef struct
+{
+       char appName[128];
+       unsigned int startTime;
+} __appInfo;
+
+typedef struct
+{
+       int state;
+       pthread_mutex_t ssMutex;
+} __screenshotInfo;
+
+typedef struct
+{
+       void* map_start;
+       void* map_end;
+} __mapInfo;
+
+typedef struct
+{
+       __indexInfo                     index;
+       __socketInfo            socket;
+       __appInfo                       app;
+       __screenshotInfo        screenshot;
+       __mapInfo                       exec_map;
+       int                                     stateTouch;
+       int                                     init_complete;
+       int                                     custom_chart_callback_count;
+       long*                           pprobeflag;
+} __traceInfo;
+
+extern __thread unsigned long  gSTrace;
+extern __traceInfo gTraceInfo;
+
+int __atSharedMemory();
+int __dtSharedMemory();
+
+char** da_backtrace_symbols (void* const* array, int size);
+char** cached_backtrace_symbols (void* const* array, int size);
+int update_heap_memory_size(bool isAdd, size_t size);
+
+//wchar_t* -> char*
+void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
+
+// screen capture functions
+int initialize_screencapture();
+int finalize_screencapture();
+int captureScreen();
+int activateCaptureTimer();
+void _cb_render_post(void* data, Evas* e, void* eventinfo);
+
+// event related functions
+int initialize_event();
+int finalize_event();
+int getOrientation();
+void orientationEnabled();
+void on_orientation_changed(int angle, bool capi);
+
+int remove_indir(const char* dirname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _DAHELPER_H_
diff --git a/include/daprobe.h b/include/daprobe.h
new file mode 100644 (file)
index 0000000..b0c863e
--- /dev/null
@@ -0,0 +1,349 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DAPROBE_H__
+#define __DAPROBE_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <dlfcn.h>
+#include "probeinfo.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#ifndef likely
+#define likely(x)       __builtin_expect((x),1)
+#define unlikely(x)     __builtin_expect((x),0)
+#endif
+
+#define NUM_OF_MONITOR         3
+#define DA_LOG_MAX                     4096
+
+#define DEFAULT_TOKEN  "`,"
+
+#define CALLER_ADDRESS \
+       ((void*) __builtin_extract_return_addr(__builtin_return_address(0)))
+
+#define BACKTRACE_SYMBOLS cached_backtrace_symbols
+
+typedef enum
+{
+       MT_MEMORY,
+       MT_FILE,
+       MT_SOCKET,
+} MonitorType;
+
+enum BlockLocation
+{
+       BL_PRE,
+       BL_POST,
+};
+
+typedef struct
+{
+       int type;
+       int length;
+       char data[DA_LOG_MAX];
+} log_t;
+
+typedef struct
+{
+       int                             eventIndex;
+       int                             pID;
+       int                             tID;
+       unsigned long   currentTime;
+       unsigned int    callDepth;
+} probeInfo_t;
+
+/***************************************************************************
+ * helper apis
+ ***************************************************************************/
+
+int preBlockBegin(void* caller, bool bFiltering);
+void preBlockEnd();
+
+int postBlockBegin(int preresult);
+void postBlockEnd();
+
+void probeBlockStart();
+void probeBlockEnd();
+
+unsigned int getCurrentEventIndex();
+unsigned int getCallDepth();
+unsigned long getTraceState();
+unsigned long getCurrentTime();
+bool isEnableSnapshot();
+bool isEnableInternalMalloc();
+bool setProbePoint(probeInfo_t * iProbe);
+
+bool printLogStr(const char* str, int msgType);
+bool printLog(log_t* log, int msgType);
+int __appendTypeLog(log_t* log, int nInput, char* token, ...);
+int getBacktraceString(log_t* log, int bufsize);
+
+//char* captureScreenShotX(int* width, int* height);
+//void releaseScreenShotX();
+
+//int printSamplingLog(void);
+
+//bool captureScreen(unsigned int logNum);
+//void captureProbe();
+//int registeScreenChange(int renderID);
+//void detectTouchEvent(int touchID);
+//int getTouchState();
+//int isPossibleCapture();
+
+
+/***************************************************************************
+ * helper macros
+ ***************************************************************************/
+
+// ========================= print log =====================================
+#define PRINTMSG(msg)  printLogStr(msg, MSG_MSG)
+
+// =========================== declare variables ===========================
+// local variable is faster than heap allocated variable
+// array variable initialization with declare is expensive than memset
+#define DECLARE_COMMON_VARIABLE                        \
+               probeInfo_t     probeInfo;                      \
+               log_t           log
+
+// declare variable for standard api (not tizen related api)
+#define DECLARE_VARIABLE_STANDARD              \
+               DECLARE_COMMON_VARIABLE;                \
+               int blockresult;                                \
+               bool bfiltering = true;                 \
+               int olderrno, newerrno;                 \
+               int __attribute__((unused)) ret
+
+// ========================== initialize variable ==========================
+
+#define INIT_LOG                       \
+               log.type = 0;           \
+               log.length = 0;         \
+               log.data[0] = '\0'
+
+// ========================== get function pointer =========================
+
+#define GET_REAL_FUNCP(FUNCNAME, SONAME, FUNCTIONPOINTER)                      \
+               do {                                                                                                            \
+                       if(!FUNCTIONPOINTER) {                                                                  \
+                               probeBlockStart();                                                                      \
+                               void* lib_handle = dlopen(#SONAME, RTLD_LAZY);          \
+                               if(lib_handle == NULL) {                                                        \
+                                       perror("dlopen failed : " #SONAME );                    \
+                                       exit(0);                                                                                \
+                               }                                                                                                       \
+                               FUNCTIONPOINTER = dlsym(lib_handle, #FUNCNAME);         \
+                               if(FUNCTIONPOINTER == NULL || dlerror() != NULL) {      \
+                                       perror("dlsym failed : " #FUNCNAME);                    \
+                                       exit(0);                                                                                \
+                               }                                                                                                       \
+                               probeBlockEnd();                                                                        \
+                       }                                                                                                               \
+               } while(0)
+
+#define GET_REAL_FUNC(FUNCNAME, SONAME)                \
+               GET_REAL_FUNCP(FUNCNAME, SONAME, FUNCNAME##p)
+
+#define GET_REAL_FUNCP_RTLD_NEXT(FUNCNAME, FUNCTIONPOINTER)                    \
+               do {                                                                                                            \
+                       if(!FUNCTIONPOINTER) {                                                                  \
+                               probeBlockStart();                                                                      \
+                               FUNCTIONPOINTER = dlsym(RTLD_NEXT, #FUNCNAME);          \
+                               if(FUNCTIONPOINTER == NULL || dlerror() != NULL) {      \
+                                       perror("dlsym failed");                                                 \
+                                       exit(0);                                                                                \
+                               }                                                                                                       \
+                               probeBlockEnd();                                                                        \
+                       }                                                                                                               \
+               } while(0)
+
+#define GET_REAL_FUNC_RTLD_NEXT(FUNCNAME)      \
+               GET_REAL_FUNCP_RTLD_NEXT(FUNCNAME, FUNCNAME##p)
+
+#define GET_REAL_FUNCP_RTLD_NEXT_CPP(FUNCNAME, FUNCTIONPOINTER)                \
+               do {                                                                                                            \
+                       if(!FUNCTIONPOINTER) {                                                                  \
+                               probeBlockStart();                                                                      \
+                               void* funcp = dlsym(RTLD_NEXT, #FUNCNAME);                      \
+                               if(funcp == NULL || dlerror() != NULL) {                        \
+                                       perror("dlsym failed : " #FUNCNAME);                    \
+                                       exit(0);                                                                                \
+                               }                                                                                                       \
+                               memcpy(&FUNCTIONPOINTER, &funcp, sizeof(void*));        \
+                               probeBlockEnd();                                                                        \
+                       }                                                                                                               \
+               } while(0)
+
+#define GET_REAL_FUNC_RTLD_NEXT_CPP(FUNCNAME)  \
+               GET_REAL_FUNCP_RTLD_NEXT_CPP(FUNCNAME, FUNCNAME##p)
+
+// ======================== basic probe block define =======================
+#define PRE_BLOCK_BEGIN \
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+
+#define PRE_BLOCK_END \
+               preBlockEnd(); }
+
+#define POST_BLOCK_BEGIN \
+       if(postBlockBegin(blockresult)) {
+
+#define POST_BLOCK_END \
+               postBlockEnd(); }
+
+// ======================= pre block macro ================================
+
+#define PRE_PROBEBLOCK_BEGIN()                                                         \
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {    \
+               setProbePoint(&probeInfo)
+
+#define PRE_PROBEBLOCK_END()   \
+               preBlockEnd();                  \
+       }                                                       \
+       olderrno = errno;                       \
+       errno = 0
+
+#define PRE_PROBEBLOCK() \
+               PRE_PROBEBLOCK_BEGIN(); \
+               PRE_PROBEBLOCK_END()
+
+// ========================== make log macro ================================
+#define APPEND_LOG_BASIC(LCTYPE)                                                               \
+       log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",       \
+                       LCTYPE, probeInfo.eventIndex, __func__,                         \
+                       probeInfo.currentTime, probeInfo.pID, probeInfo.tID)
+
+#define APPEND_LOG_BASIC_NAME(LCTYPE, APINAME)                                 \
+       log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",       \
+               LCTYPE, probeInfo.eventIndex, APINAME,                                  \
+               probeInfo.currentTime, probeInfo.pID, probeInfo.tID)
+
+#define APPEND_LOG_COMMON_NONE(CALLER)                                                         \
+       log.length += sprintf(log.data + log.length, "`,`,`,`,`,`,%u",  \
+               (unsigned int)CALLER)
+
+#define APPEND_LOG_INPUT(INPUTFORMAT, ...)                                                             \
+       log.length += sprintf(log.data + log.length,                                            \
+                       DEFAULT_TOKEN INPUTFORMAT, __VA_ARGS__)
+
+#define APPEND_LOG_RESULT(RETTYPE, RETVALUE)                                                   \
+       __appendTypeLog(&log, 4, NULL, RETTYPE, RETVALUE, VT_INT, 0,            \
+                       VT_INT, newerrno, VT_INT, blockresult)
+
+#define APPEND_LOG_CALLER()                                                                                            \
+       log.length += sprintf(log.data + log.length,                                            \
+                       "`,%u",(unsigned int) CALLER_ADDRESS)
+
+#if defined(USING_BACKTRACE) || defined(PRINT_BACKTRACE_CALLSTACK)
+#define APPEND_LOG_CALLSTACK()                                                                                 \
+       log.length += sprintf(log.data + log.length,                                            \
+                       "`,\ncallstack_start`,");                                                                       \
+       getBacktraceString(&log, DA_LOG_MAX - log.length - 17);                         \
+       log.length += sprintf(log.data + log.length, "`,callstack_end")
+#else
+#define APPEND_LOG_CALLSTACK() APPEND_LOG_NULL_CALLSTACK()
+#endif
+
+#define APPEND_LOG_NULL_CALLSTACK()                                                                            \
+       log.length += sprintf(log.data + log.length,                                            \
+                       "`,\ncallstack_start`,`,callstack_end")
+
+
+// =========================== post block macro ===========================
+
+#define POST_PROBEBLOCK_BEGIN(LCTYPE, RETTYPE, RETVALUE, INPUTFORMAT, ...)     \
+       newerrno = errno;                                                                                                               \
+       if(postBlockBegin(blockresult)) {                                                                               \
+               INIT_LOG;                                                                                                                       \
+               APPEND_LOG_BASIC(LCTYPE);                                                                                       \
+               APPEND_LOG_INPUT(INPUTFORMAT, __VA_ARGS__);                                                     \
+               APPEND_LOG_RESULT(RETTYPE, RETVALUE);                                                           \
+               APPEND_LOG_CALLER()
+
+#define POST_PROBEBLOCK_CALLSTACK()                    \
+       do {                                                                    \
+               if(newerrno != 0) {                                     \
+                       APPEND_LOG_CALLSTACK();                 \
+               } else {                                                        \
+                       APPEND_LOG_NULL_CALLSTACK();    \
+               }                                                                       \
+       } while(0)
+
+
+#define POST_PROBEBLOCK_END()                                          \
+               printLog(&log, MSG_LOG);                                        \
+               postBlockEnd();                                                         \
+       }                                                                                               \
+       errno = (newerrno != 0) ? newerrno : olderrno
+
+// ===================== unconditional probe block ========================
+
+#define PRE_UNCONDITIONAL_BLOCK_BEGIN()        \
+       do {                                                            \
+               probeBlockStart();                              \
+               setProbePoint(&probeInfo)
+
+#define PRE_UNCONDITIONAL_BLOCK_END()  \
+               probeBlockEnd();                                \
+       } while(0)
+
+#define POST_UNCONDITIONAL_BLOCK_BEGIN(LCTYPE) \
+       do {                                                                            \
+               probeBlockStart();                                              \
+               INIT_LOG;                                                               \
+               APPEND_LOG_BASIC(LCTYPE)
+               
+#define POST_UNCONDITIONAL_BLOCK_END()                 \
+               printLog(&log, MSG_LOG);                                \
+               probeBlockEnd();                                                \
+       } while(0)
+
+// ========================= simplify macro ================================
+
+#define BEFORE_ORIGINAL(FUNCNAME, LIBNAME)     \
+       DECLARE_VARIABLE_STANDARD;                              \
+       GET_REAL_FUNC(FUNCNAME, LIBNAME);               \
+       PRE_PROBEBLOCK()
+
+#define BEFORE_ORIGINAL_NOFILTER(FUNCNAME, LIBNAME)    \
+       DECLARE_VARIABLE_STANDARD;                                              \
+       GET_REAL_FUNC(FUNCNAME, LIBNAME);                               \
+       bfiltering = false;                                                             \
+       PRE_PROBEBLOCK()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/dautil.h b/include/dautil.h
new file mode 100644 (file)
index 0000000..6751a83
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DAUTIL_H__
+#define __DAUTIL_H__
+//#define DA_DEBUG_LOG
+#ifdef DA_DEBUG_LOG
+#define HEAR() printf("DA: %s:%s:%d: we are here\n", __FILE__, __func__, __LINE__)
+#else
+#define HEAR() ;
+#endif
+#endif
diff --git a/include/khash.h b/include/khash.h
new file mode 100755 (executable)
index 0000000..3495bdb
--- /dev/null
@@ -0,0 +1,325 @@
+/* The MIT License\r
+\r
+   Copyright (c) 2008, by Attractive Chaos <attractivechaos@aol.co.uk>\r
+\r
+   Permission is hereby granted, free of charge, to any person obtaining\r
+   a copy of this software and associated documentation files (the\r
+   "Software"), to deal in the Software without restriction, including\r
+   without limitation the rights to use, copy, modify, merge, publish,\r
+   distribute, sublicense, and/or sell copies of the Software, and to\r
+   permit persons to whom the Software is furnished to do so, subject to\r
+   the following conditions:\r
+\r
+   The above copyright notice and this permission notice shall be\r
+   included in all copies or substantial portions of the Software.\r
+\r
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+   SOFTWARE.\r
+*/\r
+\r
+/*\r
+  An example:\r
+\r
+#include "khash.h"\r
+KHASH_MAP_INIT_INT(32, char)\r
+int main() {\r
+    int ret, is_missing;\r
+    khiter_t k;\r
+    khash_t(32) *h = kh_init(32);\r
+    k = kh_put(32, h, 5, &ret);\r
+    if (!ret) kh_del(32, h, k);\r
+    kh_value(h, k) = 10;\r
+    k = kh_get(32, h, 10);\r
+    is_missing = (k == kh_end(h));\r
+    k = kh_get(32, h, 5);\r
+    kh_del(32, h, k);\r
+    for (k = kh_begin(h); k != kh_end(h); ++k)\r
+        if (kh_exist(h, k)) kh_value(h, k) = 1;\r
+    kh_destroy(32, h);\r
+    return 0;\r
+}\r
+*/\r
+\r
+/*\r
+  2008-09-19 (0.2.3):\r
+\r
+    * Corrected the example\r
+    * Improved interfaces\r
+\r
+  2008-09-11 (0.2.2):\r
+\r
+    * Improved speed a little in kh_put()\r
+\r
+  2008-09-10 (0.2.1):\r
+\r
+    * Added kh_clear()\r
+    * Fixed a compiling error\r
+\r
+  2008-09-02 (0.2.0):\r
+\r
+    * Changed to token concatenation which increases flexibility.\r
+\r
+  2008-08-31 (0.1.2):\r
+\r
+    * Fixed a bug in kh_get(), which has not been tested previously.\r
+\r
+  2008-08-31 (0.1.1):\r
+\r
+    * Added destructor\r
+*/\r
+\r
+\r
+#ifndef __AC_KHASH_H\r
+#define __AC_KHASH_H\r
+\r
+#define AC_VERSION_KHASH_H "0.2.2"\r
+\r
+#include <stdio.h>\r
+#include <stdint.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
+typedef uint32_t khint_t;\r
+typedef khint_t khiter_t;\r
+\r
+#define __ac_HASH_PRIME_SIZE 32\r
+static const uint32_t __ac_prime_list[__ac_HASH_PRIME_SIZE] =\r
+{\r
+  0ul,          3ul,          11ul,         23ul,         53ul,\r
+  97ul,         193ul,        389ul,        769ul,        1543ul,\r
+  3079ul,       6151ul,       12289ul,      24593ul,      49157ul,\r
+  98317ul,      196613ul,     393241ul,     786433ul,     1572869ul,\r
+  3145739ul,    6291469ul,    12582917ul,   25165843ul,   50331653ul,\r
+  100663319ul,  201326611ul,  402653189ul,  805306457ul,  1610612741ul,\r
+  3221225473ul, 4294967291ul\r
+};\r
+\r
+#define __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2)\r
+#define __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1)\r
+#define __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3)\r
+#define __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1)))\r
+#define __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1)))\r
+#define __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1)))\r
+#define __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1))\r
+\r
+static const double __ac_HASH_UPPER = 0.77;\r
+\r
+#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \\r
+    typedef struct {                                                    \\r
+        khint_t n_buckets, size, n_occupied, upper_bound;               \\r
+        uint32_t *flags;                                                \\r
+        khkey_t *keys;                                                  \\r
+        khval_t *vals;                                                  \\r
+    } kh_##name##_t;                                                    \\r
+    static inline kh_##name##_t *kh_init_##name() {                     \\r
+        return (kh_##name##_t*)calloc(1, sizeof(kh_##name##_t));        \\r
+    }                                                                   \\r
+    static inline void kh_destroy_##name(kh_##name##_t *h)              \\r
+    {                                                                   \\r
+        if (h) {                                                        \\r
+            free(h->keys); free(h->flags);                              \\r
+            free(h->vals);                                              \\r
+            free(h);                                                    \\r
+        }                                                               \\r
+    }                                                                   \\r
+    static inline void kh_clear_##name(kh_##name##_t *h)                \\r
+    {                                                                   \\r
+        if (h && h->flags) { \\r
+            memset(h->flags, 0xaa, ((h->n_buckets>>4) + 1) * sizeof(uint32_t)); \\r
+            h->size = h->n_occupied = 0;                                \\r
+        }                                                               \\r
+    }                                                                   \\r
+    static inline khint_t kh_get_##name(kh_##name##_t *h, khkey_t key)  \\r
+    {                                                                   \\r
+        if (h->n_buckets) {                                             \\r
+            khint_t inc, k, i, last;                                    \\r
+            k = __hash_func(key); i = k % h->n_buckets;                 \\r
+            inc = 1 + k % (h->n_buckets - 1); last = i;                 \\r
+            while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \\r
+                if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \\r
+                else i += inc;                                          \\r
+                if (i == last) return h->n_buckets;                     \\r
+            }                                                           \\r
+            return __ac_iseither(h->flags, i)? h->n_buckets : i;            \\r
+        } else return 0;                                                \\r
+    }                                                                   \\r
+    static inline void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \\r
+    {                                                                   \\r
+        uint32_t *new_flags = 0;                                        \\r
+        khint_t j = 1;                                                  \\r
+        {                                                               \\r
+            khint_t t = __ac_HASH_PRIME_SIZE - 1;                       \\r
+            while (__ac_prime_list[t] > new_n_buckets) {                \\r
+                --t;                                                    \\r
+            }                                                           \\r
+            new_n_buckets = __ac_prime_list[t+1];                       \\r
+            if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; \\r
+            else {                                                      \\r
+                new_flags = (uint32_t*)malloc(((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \\r
+                memset(new_flags, 0xaa, ((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \\r
+                if (h->n_buckets < new_n_buckets) {                     \\r
+                    h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \\r
+                    if (kh_is_map)                                      \\r
+                        h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \\r
+                }                                                       \\r
+            }                                                           \\r
+        }                                                               \\r
+        if (j) {                                                        \\r
+            for (j = 0; j != h->n_buckets; ++j) {                       \\r
+                if (__ac_iseither(h->flags, j) == 0) {                  \\r
+                    khkey_t key = h->keys[j];                           \\r
+                    khval_t val;                                        \\r
+                    if (kh_is_map) val = h->vals[j];                    \\r
+                    __ac_set_isdel_true(h->flags, j);                   \\r
+                    while (1) {                                         \\r
+                        khint_t inc, k, i;                              \\r
+                        k = __hash_func(key);                           \\r
+                        i = k % new_n_buckets;                          \\r
+                        inc = 1 + k % (new_n_buckets - 1);              \\r
+                        while (!__ac_isempty(new_flags, i)) {           \\r
+                            if (i + inc >= new_n_buckets) i = i + inc - new_n_buckets; \\r
+                            else i += inc;                              \\r
+                        }                                               \\r
+                        __ac_set_isempty_false(new_flags, i);           \\r
+                        if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { \\r
+                            { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \\r
+                            if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \\r
+                            __ac_set_isdel_true(h->flags, i);           \\r
+                        } else {                                        \\r
+                            h->keys[i] = key;                           \\r
+                            if (kh_is_map) h->vals[i] = val;            \\r
+                            break;                                      \\r
+                        }                                               \\r
+                    }                                                   \\r
+                }                                                       \\r
+            }                                                           \\r
+            if (h->n_buckets > new_n_buckets) {                         \\r
+                h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \\r
+                if (kh_is_map)                                          \\r
+                    h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \\r
+            }                                                           \\r
+            free(h->flags);                                             \\r
+            h->flags = new_flags;                                       \\r
+            h->n_buckets = new_n_buckets;                               \\r
+            h->n_occupied = h->size;                                    \\r
+            h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \\r
+        }                                                               \\r
+    }                                                                   \\r
+    static inline khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \\r
+    {                                                                   \\r
+        khint_t x;                                                      \\r
+        if (h->n_occupied >= h->upper_bound) {                          \\r
+            if (h->n_buckets > (h->size<<1)) kh_resize_##name(h, h->n_buckets - 1); \\r
+            else kh_resize_##name(h, h->n_buckets + 1);                 \\r
+        }                                                               \\r
+        {                                                               \\r
+            khint_t inc, k, i, site, last;                              \\r
+            x = site = h->n_buckets; k = __hash_func(key); i = k % h->n_buckets; \\r
+            if (__ac_isempty(h->flags, i)) x = i;                       \\r
+            else {                                                      \\r
+                inc = 1 + k % (h->n_buckets - 1); last = i;             \\r
+                while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \\r
+                    if (__ac_isdel(h->flags, i)) site = i;              \\r
+                    if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \\r
+                    else i += inc;                                      \\r
+                    if (i == last) { x = site; break; }                 \\r
+                }                                                       \\r
+                if (x == h->n_buckets) {                                \\r
+                    if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \\r
+                    else x = i;                                         \\r
+                }                                                       \\r
+            }                                                           \\r
+        }                                                               \\r
+        if (__ac_isempty(h->flags, x)) {                                \\r
+            h->keys[x] = key;                                           \\r
+            __ac_set_isboth_false(h->flags, x);                         \\r
+            ++h->size; ++h->n_occupied;                                 \\r
+            *ret = 1;                                                   \\r
+        } else if (__ac_isdel(h->flags, x)) {                           \\r
+            h->keys[x] = key;                                           \\r
+            __ac_set_isboth_false(h->flags, x);                         \\r
+            ++h->size;                                                  \\r
+            *ret = 2;                                                   \\r
+        } else *ret = 0;                                                \\r
+        return x;                                                       \\r
+    }                                                                   \\r
+    static inline void kh_del_##name(kh_##name##_t *h, khint_t x)       \\r
+    {                                                                   \\r
+        if (x != h->n_buckets && !__ac_iseither(h->flags, x)) {         \\r
+            __ac_set_isdel_true(h->flags, x);                           \\r
+            --h->size;                                                  \\r
+        }                                                               \\r
+    }\r
+\r
+/* --- BEGIN OF HASH FUNCTIONS --- */\r
+\r
+#define kh_int_hash_func(key) (uint32_t)(key)\r
+#define kh_int_hash_equal(a, b) (a == b)\r
+#define kh_int64_hash_func(key) (uint32_t)((key)>>33^(key)^(key)<<11)\r
+#define kh_int64_hash_equal(a, b) (a == b)\r
+static inline khint_t __ac_X31_hash_string(const char *s)\r
+{\r
+    khint_t h = *s;\r
+    if (h)\r
+       {\r
+               for (++s ; *s; ++s)\r
+               {\r
+                       h = (h << 5) - h + *s;\r
+               }\r
+       }\r
+    return h;\r
+}\r
+#define kh_str_hash_func(key) __ac_X31_hash_string(key)\r
+#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0)\r
+\r
+/* --- END OF HASH FUNCTIONS --- */\r
+\r
+/* Other necessary macros... */\r
+\r
+#define khash_t(name) kh_##name##_t\r
+\r
+#define kh_init(name) kh_init_##name()\r
+#define kh_destroy(name, h) kh_destroy_##name(h)\r
+#define kh_clear(name, h) kh_clear_##name(h)\r
+#define kh_resize(name, h, s) kh_resize_##name(h, s)\r
+#define kh_put(name, h, k, r) kh_put_##name(h, k, r)\r
+#define kh_get(name, h, k) kh_get_##name(h, k)\r
+#define kh_del(name, h, k) kh_del_##name(h, k)\r
+\r
+#define kh_exist(h, x) (!__ac_iseither((h)->flags, (x)))\r
+#define kh_key(h, x) ((h)->keys[x])\r
+#define kh_val(h, x) ((h)->vals[x])\r
+#define kh_value(h, x) ((h)->vals[x])\r
+#define kh_begin(h) (khint_t)(0)\r
+#define kh_end(h) ((h)->n_buckets)\r
+#define kh_size(h) ((h)->size)\r
+#define kh_n_buckets(h) ((h)->n_buckets)\r
+\r
+/* More conenient interfaces */\r
+\r
+#define KHASH_SET_INIT_INT(name)                                        \\r
+    KHASH_INIT(name, uint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal)\r
+\r
+#define KHASH_MAP_INIT_INT(name, khval_t)                               \\r
+    KHASH_INIT(name, uint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal)\r
+\r
+#define KHASH_SET_INIT_INT64(name)                                      \\r
+    KHASH_INIT(name, uint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal)\r
+\r
+#define KHASH_MAP_INIT_INT64(name, khval_t)                             \\r
+    KHASH_INIT(name, uint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal)\r
+\r
+typedef const char *kh_cstr_t;\r
+#define KHASH_SET_INIT_STR(name)                                        \\r
+    KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal)\r
+\r
+#define KHASH_MAP_INIT_STR(name, khval_t)                               \\r
+    KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)\r
+\r
+#endif /* __AC_KHASH_H */\r
diff --git a/include/osp_probe.h b/include/osp_probe.h
new file mode 100755 (executable)
index 0000000..fd80368
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __BADA_PROBE_H__
+#define __BADA_PROBE_H__
+
+#include <string.h>
+#include <dlfcn.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GET_REAL_FUNC_OSP(FUNCNAME, LIBNAME, FUNCTIONPOINTER)  \
+       do {                                                                                                            \
+               if(!FUNCTIONPOINTER) {                                                                  \
+                       probeBlockStart();                                                                      \
+                       void* lib_handle = dlopen(#LIBNAME, RTLD_LAZY);         \
+                       if(lib_handle == NULL) {                                                        \
+                               perror("dlopen failed : " #LIBNAME );                   \
+                               exit(0);                                                                                \
+                       }                                                                                                       \
+                       void* funcp = dlsym(lib_handle, #FUNCNAME);                     \
+                       if(funcp == NULL || dlerror() != NULL) {                        \
+                               perror("dlsym failed : " #FUNCNAME);                    \
+                               exit(0);                                                                                \
+                       }                                                                                                       \
+                       memcpy(&FUNCTIONPOINTER, &funcp, sizeof(void*));        \
+                       probeBlockEnd();                                                                        \
+               }                                                                                                               \
+       } while(0)
+
+#define PRE_PROBEBLOCK_OSP(FILTERING)                                                                          \
+       do {                                                                                                                                    \
+               if((blockresult = preBlockBegin(CALLER_ADDRESS, FILTERING)) != 0) {     \
+                       setProbePoint(&probeInfo);                                                                              \
+                       preBlockEnd();                                                                                                  \
+               }                                                                                                                                       \
+       } while(0)
+
+extern int SceneManagerUsed;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/probeinfo.h b/include/probeinfo.h
new file mode 100755 (executable)
index 0000000..572115c
--- /dev/null
@@ -0,0 +1,158 @@
+/*\r
+ *  DA probe\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ *\r
+ * Jaewon Lim <jaewon81.lim@samsung.com>\r
+ * Woojin Jung <woojin2.jung@samsung.com>\r
+ * Juyoung Kim <j0.kim@samsung.com>\r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the\r
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+ * License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+#ifndef __PROBEINFO_H__\r
+#define __PROBEINFO_H__\r
+\r
+#ifdef __cplusplus\r
+extern "C"{\r
+#endif\r
+\r
+#define                VT_INT                  1\r
+#define                VT_UINT                 2\r
+#define                VT_LONG                 3\r
+#define                VT_ULONG                4\r
+#define                VT_STR                  5\r
+#define                VT_CHAR                 6\r
+#define                VT_PTR                  7\r
+#define                VT_NULL                 8\r
+#define                VT_OFF_T                9\r
+#define                VT_SIZE_T               10\r
+#define                VT_SSIZE_T              11\r
+#define                VT_SOCKLEN_T    12\r
+#define                VT_UINT16_T             13\r
+#define                VT_UINT32_T             14\r
+#define                VT_UINT64_T             15\r
+#define                VT_MODE_T               16\r
+#define                VT_DEV_T                17\r
+\r
+#define                LC_MEMORY               1\r
+#define                LC_UICREATE             2\r
+#define                LC_UIEVENT              3\r
+#define                LC_USERFUNC             4\r
+#define                LC_RESOURCE             5\r
+#define                LC_LIFECYCLE    6\r
+#define                LC_SNAPSHOT             7\r
+#define                LC_SCENE                8\r
+#define                LC_DEVICE               9\r
+#define                LC_ALLOCMEM             10\r
+#define                LC_SAMPLE               11\r
+#define                LC_THREAD               12\r
+#define                LC_CUSTOM               13\r
+#define                LC_SYNC                 14\r
+\r
+#define                FD_FILE         0\r
+#define                FD_SOCKET       1\r
+\r
+#define                FD_API_OPEN                             0\r
+#define                FD_API_CLOSE                    1\r
+#define                FD_API_READ                             2\r
+#define                FD_API_WRITE                    3\r
+#define                FD_API_DIRECTORY                4\r
+#define                FD_API_PERMISSION               5\r
+#define                FD_API_OTHER                    6\r
+#define                FD_API_SEND                             7\r
+#define                FD_API_RECEIVE                  8\r
+#define                FD_API_OPTION                   9\r
+#define                FD_API_MANAGE                   10\r
+#define                FD_API_INTERNAL_START   11\r
+#define                FD_API_INTERNAL_CLOSE   12\r
+#define                FD_API_WAIT                             13\r
+#define                FD_API_INTERNAL_WAIT    14\r
+\r
+#define                MEMORY_API_ALLOC        0\r
+#define                MEMORY_API_FREE         1\r
+#define                MEMORY_API_MANAGE       2\r
+\r
+//#define              SNAPSHOT_API_WIN                        0\r
+//#define              SNAPSHOT_API_CONTROLBAR         1\r
+//#define              SNAPSHOT_API_NAVIFRAME          2\r
+//#define              SNAPSHOT_API_PAGER                      3\r
+\r
+#define        EVENT_TYPE_DOWN         0\r
+#define        EVENT_TYPE_UP           1\r
+#define        EVENT_TYPE_MOVE         2\r
+\r
+#define                USERFUNC_ENTER          0\r
+#define                USERFUNC_EXIT           1\r
+\r
+#define                THREAD_PTHREAD                                  0\r
+#define                THREAD_OSPTHREAD_WORKER                 1\r
+#define                THREAD_OSPTHREAD_EVENTDRIVEN    2\r
+\r
+#define                THREAD_API_NEW                                  0\r
+#define                THREAD_API_START                                1\r
+#define                THREAD_API_STOP                                 2\r
+#define                THREAD_API_EXIT                                 3\r
+#define                THREAD_API_WAIT_START                   4\r
+#define                THREAD_API_WAIT_END                             5\r
+#define                THREAD_API_INTERNAL_START               6\r
+#define                THREAD_API_INTERNAL_STOP                7\r
+#define                THREAD_API_OTHER                                8\r
+\r
+#define        SYNC_OSP_MUTEX                                  0\r
+#define                SYNC_OSP_MONITOR                                1\r
+#define                SYNC_OSP_SEMAPHORE                              2\r
+#define                SYNC_PTHREAD_MUTEX                              3\r
+#define                SYNC_PTHREAD_COND_VARIABLE              4\r
+#define                SYNC_PTHREAD_RWLOCK                             5\r
+#define                SYNC_PTHREAD_SPINLOCK                   6\r
+#define                SYNC_PTHREAD_BARRIER                    7\r
+\r
+#define                SYNC_API_NEW                                    0\r
+#define                SYNC_API_ACQUIRE_WAIT_START             1\r
+#define                SYNC_API_ACQUIRE_WAIT_END               2\r
+#define                SYNC_API_RELEASE                                3\r
+#define                SYNC_API_TRY_ACQUIRE                    4\r
+#define                SYNC_API_COND_WAIT_START                5\r
+#define                SYNC_API_COND_WAIT_END                  6\r
+#define                SYNC_API_NOTIFY                                 7\r
+#define                SYNC_API_NOTIFY_ALL                             8\r
+#define                SYNC_API_OTHER                                  9\r
+\r
+enum MessageType\r
+{\r
+       MSG_DEVICE = 1,\r
+       MSG_TIME,\r
+       MSG_SAMPLE,\r
+       MSG_LOG = 5,\r
+       MSG_IMAGE = 6,\r
+       MSG_TERMINATE = 7,\r
+       MSG_PID = 8,\r
+       MSG_MSG = 9,\r
+       MSG_APPNAME = 10,\r
+       MSG_ERROR = 11\r
+};\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif\r
diff --git a/packaging/dynamic-analysis-probe.spec b/packaging/dynamic-analysis-probe.spec
new file mode 100644 (file)
index 0000000..3b3b694
--- /dev/null
@@ -0,0 +1,40 @@
+Name:       dynamic-analysis-probe
+Summary:    dynamic analyzer probe library
+Version:    2.1.0
+Release:    1
+Group:      System/Libraries
+License:       GNU Lesser General Public License, Version 2.1
+Source:    %{name}_%{version}.tar.gz
+BuildRequires:  osp-appfw-devel
+BuildRequires:  osp-uifw-devel
+BuildRequires:  ecore-input-evas
+BuildRequires:  elementary-devel
+BuildRequires:  capi-appfw-application-devel
+BuildRequires:  capi-system-runtime-info-devel
+BuildRequires:  libXext-devel
+#BuildRequires:  libX11-devel
+#BuildRequires:  evas-devel
+
+
+%description
+Dynamic analysis probe is for dynamic analyzer.
+This library will be installed in target.
+
+%prep
+%setup -q -n %{name}_%{version}
+
+%build
+make
+
+%install
+rm -rf ${RPM_BUILD_ROOT}
+%make_install
+
+%files
+%defattr(-,root,root,-)
+%{_prefix}/lib/da_probe_osp.so
+%{_prefix}/lib/libdaprobe.so
+
+
+%changelog
+
diff --git a/probe_badaapi/bada_file.cpp b/probe_badaapi/bada_file.cpp
new file mode 100755 (executable)
index 0000000..4d2a60b
--- /dev/null
@@ -0,0 +1,1532 @@
+/*
+ *  DA probe
+ *
+ * Copyright (File::*c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <FBase.h>
+//#include <FIo.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dahelper.h"
+
+using namespace Tizen::Base;
+
+enum FileSeekPosition {
+       FILESEEKPOSITION_BEGIN, /**<The beginning of the file */
+       FILESEEKPOSITION_CURRENT, /**<The current position of the file */
+       FILESEEKPOSITION_END
+/**<The end of the file */
+};
+
+namespace Tizen {
+namespace Io {
+
+class FileAttributes {
+public:
+       virtual bool Equals(const Object& object) const;
+       FileAttributes(const FileAttributes &fileAttributes);
+       FileAttributes(void);
+       DateTime GetDateTime(void) const;
+       long long GetFileSize(void) const;
+       virtual int GetHashCode(void) const;
+       DateTime GetLastModifiedTime(void) const;
+       bool IsDirectory(void) const;
+       bool IsHidden(void) const;
+       bool IsReadOnly(void) const;
+       FileAttributes & operator=(const FileAttributes &fileAttributes);
+       virtual ~FileAttributes(void);
+};
+
+class File {
+public:
+
+/* deprecated apis
+ *   
+       result Construct(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode, bool secureMode,
+                       bool createParentDirectories);
+       result Construct(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode, bool secureMode,
+                       const Tizen::Base::ByteBuffer& key, bool createParentDirectories);
+       
+       result Construct(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode,
+                       const Tizen::Base::ByteBuffer& secretKey);
+*/     
+       result Construct(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode, bool createParentDirectories);
+       result Construct(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode);
+       
+       result Construct(const Tizen::Base::String& filePath,
+                       const char *pOpenMode);
+       result Construct(const Tizen::Base::String& filePath,
+                       const char *pOpenMode, const Tizen::Base::ByteBuffer &seretKey);
+
+       
+       /*
+        File(void);
+        */
+       result Flush(void);
+
+       Tizen::Base::String GetName(void) const;
+       result Read(Tizen::Base::String& buffer);
+       result Read(Tizen::Base::ByteBuffer& buffer);
+       int Read(void *buffer, int length);
+       result Seek(FileSeekPosition position, long offset);
+
+       int Tell(void) const;
+
+       result Truncate(int length);
+
+       result Write(const void *buffer, int length);
+
+       result Write(const Tizen::Base::ByteBuffer& buffer);
+       result Write(const Tizen::Base::String& buffer);
+       virtual ~File(void);
+       /*
+        // static methods
+        static result ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
+        const Tizen::Base::String &secureFilePath);
+        static result ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
+        const Tizen::Base::String &secureFilePath,
+        const Tizen::Base::ByteBuffer& key);
+        static result Copy(const Tizen::Base::String& srcFilePath,
+        const Tizen::Base::String& destFilePath, bool failIfExist);
+        static result GetAttributes(const Tizen::Base::String& filePath,
+        FileAttributes& attribute);
+        static const Tizen::Base::String GetFileExtension(
+        const Tizen::Base::String& filePath);
+
+        static const Tizen::Base::String GetFileName(const Tizen::Base::String& filePath);
+
+        const Tizen::Base::String& filePath);
+        static bool IsEncrypted(const Tizen::Base::String &filePath);
+        static bool IsFileExist(const Tizen::Base::String& filePath);
+        static result Move(const Tizen::Base::String& oldFilePath,
+        const Tizen::Base::String& newFilePath);
+        static result Remove(const Tizen::Base::String& filePath);
+        //     static Tizen::Base::Collection::IList *GetPathsToAppsN(void);
+        */
+};
+
+//File::File(void) {
+//static (File::*Filep)();
+//}
+
+result File::Construct(const Tizen::Base::String& filePath,
+               const Tizen::Base::String& openMode, bool createParentDirectories) {
+       typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode, bool createParentDirectories);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!Constructp) {
+               probeBlockStart();
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                               "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_b");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Constructp)(filePath, openMode, createParentDirectories);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s",temp);
+                WcharToChar(temp,openMode.GetPointer());
+                log.length += sprintf(log.data + log.length,", %s",temp);
+                log.length += sprintf(log.data + log.length,", %s`,%ld",(createParentDirectories == 0 ? "false" : "true"),ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,filePath.GetPointer());
+//              WcharToChar(temp,this->GetName().GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
+                //callstack
+
+//              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+/* deprecated apis
+result File::Construct(const Tizen::Base::String& filePath,
+               const Tizen::Base::String& openMode, bool secureMode,
+               bool createParentDirectories) {
+       typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode, bool secureMode,
+                       bool createParentDirectories);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!Constructp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                               "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_bb");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Constructp)(filePath, openMode, secureMode,
+                       createParentDirectories);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s",temp);
+                WcharToChar(temp,openMode.GetPointer());
+                log.length += sprintf(log.data + log.length,", %s",temp);
+                log.length += sprintf(log.data + log.length,", %s,%s`,%ld",(secureMode == 0 ? "false" : "true"),(createParentDirectories == 0 ? "false" : "true"),ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Construct(const Tizen::Base::String& filePath,
+               const Tizen::Base::String& openMode, bool secureMode,
+               const Tizen::Base::ByteBuffer& key, bool createParentDirectories) {
+       typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode, bool secureMode,
+                       const Tizen::Base::ByteBuffer& key, bool createParentDirectories);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!Constructp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                                               "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_bRKNS2_10ByteBufferEb");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Constructp)(filePath, openMode, secureMode, key,
+                       createParentDirectories);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s",temp);
+                WcharToChar(temp,openMode.GetPointer());
+                log.length += sprintf(log.data + log.length,", %s",temp);
+                log.length += sprintf(log.data + log.length,", %s,0x%x,%s`,%ld",(secureMode == 0 ? "false" : "true"),(unsigned int)&key,(createParentDirectories == 0 ? "false" : "true"),ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+*/
+result File::Construct(const Tizen::Base::String& filePath,
+               const Tizen::Base::String& openMode) {
+       typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String& openMode);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if(!Constructp) {
+               probeBlockStart();
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                               "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_");
+
+               if(tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Constructp)(filePath, openMode);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s",temp);
+                WcharToChar(temp,openMode.GetPointer());
+                log.length += sprintf(log.data + log.length,", %s`,%ld",temp,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,filePath.GetPointer());
+//              WcharToChar(temp,this->GetName().GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
+                //callstack
+
+//              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+/* deprecated apis
+result File::Construct(const Tizen::Base::String& filePath,
+               const Tizen::Base::String& openMode,
+               const Tizen::Base::ByteBuffer& secretKey) {
+       typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+                       const Tizen::Base::String &openMode,
+                       const Tizen::Base::ByteBuffer& secretKey);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if(!Constructp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                                               "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_RKNS2_10ByteBufferE");
+
+               if(tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Constructp)(filePath, openMode, secretKey);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s",temp);
+                WcharToChar(temp,openMode.GetPointer());
+                log.length += sprintf(log.data + log.length,", %s",temp);
+                log.length += sprintf(log.data + log.length,", 0x%x`,%ld",(unsigned int)&secretKey,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
+                //callstack
+
+//              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+       
+       return ret;
+}
+*/
+result File::Construct(const Tizen::Base::String& filePath,
+               const char *pOpenMode) {
+       typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+                       const char *pOpenMode);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if(!Constructp) {
+               probeBlockStart();
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                               "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringEPKc");
+
+               if(tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Constructp)(filePath, pOpenMode);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s",temp);
+                log.length += sprintf(log.data + log.length,", %s`,%ld",pOpenMode,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,filePath.GetPointer());
+//              WcharToChar(temp,this->GetName().GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
+                //callstack
+
+//              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Construct(const Tizen::Base::String& filePath,
+               const char *pOpenMode,
+               const Tizen::Base::ByteBuffer& secretKey) {
+       typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+                       const char *pOpenMode,
+                       const Tizen::Base::ByteBuffer& secretKey);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if(!Constructp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                                               "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringEPKcRKNS2_10ByteBufferE");
+
+               if(tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Constructp)(filePath, pOpenMode, secretKey);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s",temp);
+                log.length += sprintf(log.data + log.length,", %s",pOpenMode);
+                log.length += sprintf(log.data + log.length,", 0x%x`,%ld",(unsigned int)&secretKey,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,filePath.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
+                //callstack
+
+//              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+       
+       return ret;
+}
+
+result File::Flush(void) {
+       typedef result (File::*methodType)(void);
+       static methodType Flushp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!Flushp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5FlushEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Flush");
+                       exit(0);
+               }
+
+               memcpy(&Flushp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Flushp)();
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Flush",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,`,%ld",ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+Tizen::Base::String File::GetName(void) const{
+       typedef Tizen::Base::String (File::*methodType)(void) const;
+       static methodType GetNamep = 0;
+       Tizen::Base::String ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!GetNamep) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZNK5Tizen2Io4File7GetNameEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::GetName");
+                       exit(0);
+               }
+
+               memcpy(&GetNamep, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*GetNamep)();
+       result res = GetLastResult();
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::GetName",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,ret.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,`,%s",temp);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",res,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,temp);
+                //callstack
+
+//              if(E_SUCCESS != res || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Read(Tizen::Base::String& buffer) {
+       typedef result (File::*methodType)(Tizen::Base::String & buffer);
+       static methodType Readp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       int nRead = 0;
+       //FileAttributes attr;
+
+       if (!Readp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                               "_ZN5Tizen2Io4File4ReadERNS_4Base6StringE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Read");
+                       exit(0);
+               }
+
+               memcpy(&Readp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Readp)(buffer);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Read",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,0x%x`,%ld",(unsigned int)&buffer,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                nRead = buffer.GetLength();
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nRead,(unsigned int)this,FD_FILE,FD_API_READ,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Read(Tizen::Base::ByteBuffer& buffer) {
+       typedef result (File::*methodType)(Tizen::Base::ByteBuffer & buffer);
+       static methodType Readp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       int nRead = 0;
+       //FileAttributes attr;
+
+       if (!Readp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                               "_ZN5Tizen2Io4File4ReadERNS_4Base10ByteBufferE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Read");
+                       exit(0);
+               }
+
+               memcpy(&Readp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Readp)(buffer);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Read",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,0x%x`,%ld",(unsigned int)&buffer,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                buffer.GetInt(nRead);
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nRead,(unsigned int)this,FD_FILE,FD_API_READ,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+int File::Read(void *buffer, int length) {
+       typedef int (File::*methodType)(void *buffer, int length);
+       static methodType Readp = 0;
+       int ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       int nRead = 0;
+       //FileAttributes attr;
+
+       if (!Readp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File4ReadEPvi");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Read");
+                       exit(0);
+               }
+
+               memcpy(&Readp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               nRead = Tell();
+               preBlockEnd();
+       }
+
+       ret = (this->*Readp)(buffer, length);
+       result res = GetLastResult();
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Read",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,0x%x, %d`,%d",(unsigned int)buffer,length,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                nRead = Tell() - nRead;
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,?`,%s",res,blockresult,(unsigned int)CALLER_ADDRESS,nRead,(unsigned int)this,FD_FILE,FD_API_READ,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Seek(FileSeekPosition position, long offset) {
+       typedef result (File::*methodType)(FileSeekPosition position, long offset);
+       static methodType Seekp = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!Seekp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT,
+                               "_ZN5Tizen2Io4File4SeekE16FileSeekPositionl");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Seek");
+                       exit(0);
+               }
+
+               memcpy(&Seekp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Seekp)(position, offset);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Seek",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                if(FILESEEKPOSITION_BEGIN == position)
+                        log.length += sprintf(log.data + log.length,"`,FILESEEKPOSITION_BEGIN");
+                else if(FILESEEKPOSITION_CURRENT == position)
+                        log.length += sprintf(log.data + log.length,"`,FILESEEKPOSITION_CURRENT");
+                else if(FILESEEKPOSITION_END == position)
+                        log.length += sprintf(log.data + log.length,"`,FILESEEKPOSITION_END");
+                else
+                        log.length += sprintf(log.data + log.length,"`,%d",position);
+                log.length += sprintf(log.data + log.length,", %ld`,%ld",offset,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+int File::Tell(void) const {
+       typedef int (File::*methodType)(void) const;
+       static methodType Tellp = 0;
+       int ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!Tellp) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZNK5Tizen2Io4File4TellEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Tell");
+                       exit(0);
+               }
+
+               memcpy(&Tellp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Tellp)();
+       result res = GetLastResult();
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Tell",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,`,%d",ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",res,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Truncate(int length) {
+       typedef result (File::*methodType)(int length);
+       static methodType Truncatep = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       //FileAttributes attr;
+
+       if (!Truncatep) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File8TruncateEi");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Truncate");
+                       exit(0);
+               }
+
+               memcpy(&Truncatep, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+
+       ret = (this->*Truncatep)(length);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Truncate",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,%d`,%ld",length,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Write(const void *buffer, int length) {
+       typedef result (File::*methodType)(const void *buffer, int length);
+       static methodType Writep = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       int nWritten = 0;
+       //FileAttributes attr;
+
+       if (!Writep) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteEPKvi");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Write");
+                       exit(0);
+               }
+
+               memcpy(&Writep, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               nWritten = Tell();
+               preBlockEnd();
+       }
+
+       ret = (this->*Writep)(buffer, length);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Write",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,0x%x, %d`,%ld",(unsigned int)buffer,length,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                nWritten = Tell() - nWritten;
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nWritten,(unsigned int)this,FD_FILE,FD_API_WRITE,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Write(const Tizen::Base::ByteBuffer& buffer) {
+       typedef result (File::*methodType)(const Tizen::Base::ByteBuffer& buffer);
+       static methodType Writep = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       int nWritten = 0;
+       //FileAttributes attr;
+
+       if (!Writep) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteERKNS_4Base10ByteBufferE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Write");
+                       exit(0);
+               }
+
+               memcpy(&Writep, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               nWritten = Tell();
+               preBlockEnd();
+       }
+
+       ret = (this->*Writep)(buffer);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Write",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                log.length += sprintf(log.data + log.length,"`,0x%x`,%ld",(unsigned int)&buffer,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                nWritten = Tell() - nWritten;
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nWritten,(unsigned int)this,FD_FILE,FD_API_WRITE,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+
+       return ret;
+}
+
+result File::Write(const Tizen::Base::String& buffer) {
+       typedef result (File::*methodType)(const Tizen::Base::String& buffer);
+       static methodType Writep = 0;
+       result ret;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       char temp[50];
+       int nWritten = 0;
+       //FileAttributes attr;
+
+       if (!Writep) {
+               probeBlockStart();
+
+               void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteERKNS_4Base6StringE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::Write");
+                       exit(0);
+               }
+
+               memcpy(&Writep, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               nWritten = Tell();
+               preBlockEnd();
+       }
+
+       ret = (this->*Writep)(buffer);
+
+       if(postBlockBegin(blockresult)) {
+                log.type = 0;
+                log.length = 0;
+                log.data[0] = '\0';
+                log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                LC_RESOURCE, probeInfo.eventIndex, "File::Write",
+                probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+                //Input,ret
+                WcharToChar(temp,buffer.GetPointer());
+                log.length += sprintf(log.data + log.length,"`,%s`,%ld",temp,ret);
+                //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+                //File::GetAttributes(this->GetName(),attr);
+                WcharToChar(temp,this->GetName().GetPointer());
+                nWritten = Tell() - nWritten;
+                log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nWritten,(unsigned int)this,FD_FILE,FD_API_WRITE,temp);
+                //callstack
+
+                //              if(E_SUCCESS != ret || blockresult == 2) {
+//                      log.length += sprintf(log.data + log.length,
+//                                      "`,\ncallstack_start`,`,callstack_end");
+//              } else{
+                        log.length += sprintf(log.data + log.length,
+                                        "`,\ncallstack_start`,");
+                        getBacktraceString(&log, 4096 - log.length - 17);
+                        log.length += sprintf(log.data + log.length, "`,callstack_end");
+//              }
+
+                printLog(&log, MSG_LOG);
+                postBlockEnd();
+       }
+       return ret;
+}
+
+File::~File(void) {
+       typedef void (File::*methodType)();
+       static methodType FileDp = 0;
+       probeInfo_t     probeInfo;
+       log_t   log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!FileDp) {
+               probeBlockStart();
+
+               tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4FileD1Ev");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Io::File::~File");
+                       exit(0);
+               }
+
+               memcpy(&FileDp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+//
+       (this->*FileDp)();
+//
+       if(postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
+                               LC_RESOURCE, probeInfo.eventIndex, "File::~File",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length,"`,`,");
+               //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+               //File::GetAttributes(this->GetName(),attr);
+
+               log.length += sprintf(log.data + log.length,"`,0`,0`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,",blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_CLOSE);
+               //callstack
+
+//             if(E_SUCCESS != ret || blockresult == 2) {
+//                     log.length += sprintf(log.data + log.length,
+//                                     "`,\ncallstack_start`,`,callstack_end");
+//             } else{
+                       log.length += sprintf(log.data + log.length,
+                                       "`,\ncallstack_start`,");
+                       getBacktraceString(&log, 4096 - log.length - 17);
+                       log.length += sprintf(log.data + log.length, "`,callstack_end");
+//             }
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+}
+
+
+// static methods
+//static result File::ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
+//             const Tizen::Base::String &secureFilePath) {
+//     typedef result (File::*methodType)(
+//                     const Tizen::Base::String &plainFilePath,
+//                     const Tizen::Base::String &secureFilePath);
+//     static methodType ConvertToSecureFilep = 0;
+//
+//}
+//static result File::ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
+//             const Tizen::Base::String &secureFilePath,
+//             const Tizen::Base::ByteBuffer& key) {
+//     typedef result (File::*methodType)(
+//                     const Tizen::Base::String &plainFilePath,
+//                     const Tizen::Base::String &secureFilePath,
+//                     const Tizen::Base::ByteBuffer& key);
+//     static methodType ConvertToSecureFilep = 0;
+//
+//}
+//static result File::Copy(const Tizen::Base::String& srcFilePath,
+//             const Tizen::Base::String& destFilePath, bool failIfExist) {
+//     typedef result (File::*methodType)(const Tizen::Base::String& srcFilePath,
+//                     const Tizen::Base::String& destFilePath, bool failIfExist);
+//     static methodType Copyp = 0;
+//
+//}
+//static result File::GetAttributes(const Tizen::Base::String& filePath,
+//             FileAttributes& attribute) {
+//     typedef result (File::*methodType)(const Tizen::Base::String& filePath,
+//                     FileAttributes& attribute);
+//     static methodType GetAttributesp = 0;
+//
+//}
+//static const Tizen::Base::String File::GetFileExtension(
+//             const Tizen::Base::String& filePath) {
+//     typedef const Tizen::Base::String (File::*methodType)(
+//                     const Tizen::Base::String& filePath);
+//     static methodType GetFileExtensionp = 0;
+//
+//}
+//const Tizen::Base::String File::GetFileName(
+//             const Tizen::Base::String& filePath) {
+//     typedef const Tizen::Base::String (File::*methodType)(
+//                     const Tizen::Base::String& filePath);
+//     static methodType GetFileNamep = 0;
+//     Tizen::Base::String ret;
+//
+//     if (!GetFileNamep) {
+//                     probeBlockStart();
+//                     void *tmpPtr = dlsym(RTLD_NEXT,
+//                                     "_ZN5Tizen2Io4File11GetFileNameERKNS_4Base6StringE");
+//
+//                     if (tmpPtr == NULL || dlerror() != NULL) {
+//                             perror("dlsym failed : Tizen::Io::File::GetFileName");
+//                             exit(0);
+//                     }
+//
+//                     memcpy(&GetFileNamep, &tmpPtr, sizeof(&tmpPtr));
+//                     probeBlockEnd();
+//             }
+//     ret = (File::(*GetFileNamep))(filePath);
+//
+//return ret;
+//}
+//static bool File::IsEncrypted(const Tizen::Base::String &filePath) {
+//     typedef bool (File::*methodType)(const Tizen::Base::String &filePath);
+//     static methodType IsEncryptedp = 0;
+//
+//}
+//static bool File::IsFileExist(const Tizen::Base::String& filePath) {
+//     typedef bool (File::*methodType)(const Tizen::Base::String& filePath);
+//     static methodType IsFileExistp = 0;
+//
+//}
+//static result File::Move(const Tizen::Base::String& oldFilePath,
+//             const Tizen::Base::String& newFilePath) {
+//     typedef result (File::*methodType)(const Tizen::Base::String& oldFilePath,
+//                     const Tizen::Base::String& newFilePath);
+//     static methodType Movep = 0;
+//
+//}
+//static result File::Remove(const Tizen::Base::String& filePath) {
+//     typedef result (File::*methodType)(const Tizen::Base::String& filePath);
+//     static methodType Removep = 0;
+//
+//}
+
+}
+}
diff --git a/probe_badaapi/bada_lifecycle.cpp b/probe_badaapi/bada_lifecycle.cpp
new file mode 100755 (executable)
index 0000000..6a93843
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ *  DA probe
+ *
+ * Copyright (File::*c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <app.h>
+#include <FApp.h>
+#include <FBase.h>
+
+#include "daprobe.h"
+#include "dahelper.h"
+#include "probeinfo.h"
+#include "osp_probe.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#define LIFECYCLE_PROBE_BLOCK(FUNCNAME)                                        \
+       setProbePoint(&probeInfo);                                                      \
+       INIT_LOG;                                                                                       \
+       APPEND_LOG_BASIC_NAME(LC_LIFECYCLE, FUNCNAME);          \
+       APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);                         \
+       printLog(&log, MSG_LOG)
+
+namespace Tizen { namespace App
+{
+
+//class _IAppImpl
+//{
+//     virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation) = 0;
+//};
+
+class _AppImpl
+{
+       static void OnTerminate(void* user_data);
+       static void OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data);
+};
+
+class _UiAppImpl 
+//     : public Tizen::Base::Object
+//     , public _IAppImpl
+{
+       void OnBackground(void);
+       void OnForeground(void);
+//     virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation);
+};
+
+class _AppInfo
+{
+       static void SetAppState(AppState appstate);
+};
+
+result UiApp::Execute(UiAppInstanceFactory pUiAppFactory,
+               const IList* pArguments)
+{
+       typedef result (*methodType)(UiAppInstanceFactory pFactory, const IList* pArgs);
+       static methodType uiapp_executep;
+       DECLARE_COMMON_VARIABLE;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App5UiApp7ExecuteEPFPS1_vEPKNS_4Base10Collection5IListE,
+               libosp-uifw.so, uiapp_executep);
+
+       probeBlockStart();
+       LIFECYCLE_PROBE_BLOCK("INITIALIZING");
+       probeBlockEnd();
+
+       ret = uiapp_executep(pUiAppFactory, pArguments);
+
+       return ret;
+}
+
+void _AppImpl::OnTerminate(void* user_data)
+{
+       typedef void (*methodType)(void*);
+       static methodType appimpl_onterminatep;
+       DECLARE_COMMON_VARIABLE;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppImpl11OnTerminateEPv, libosp-appfw.so, appimpl_onterminatep);
+
+       probeBlockStart();
+       LIFECYCLE_PROBE_BLOCK("TERMINATING");
+       probeBlockEnd();
+
+       appimpl_onterminatep(user_data);
+}
+
+void _AppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data)
+{
+       typedef void (*methodType)(app_device_orientation_e, void*);
+       static methodType appimpl_ondeviceorientationchangedp;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppImpl26OnDeviceOrientationChangedE24app_device_orientation_ePv,
+                       libosp-appfw.so, appimpl_ondeviceorientationchangedp);
+
+       probeBlockStart();
+       on_orientation_changed((int)orientation, false);
+       probeBlockEnd();
+
+       appimpl_ondeviceorientationchangedp(orientation, user_data);
+}
+
+void _AppInfo::SetAppState(AppState appState)
+{
+       typedef void (*methodType)(AppState appstate);
+       static methodType appinfo_setappstatep;
+       DECLARE_COMMON_VARIABLE;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppInfo11SetAppStateENS0_8AppStateE, libosp-appfw.so, appinfo_setappstatep);
+
+       probeBlockStart();
+       if(appState == RUNNING)
+       {
+               LIFECYCLE_PROBE_BLOCK("RUNNING");
+       }
+       probeBlockEnd();
+
+       appinfo_setappstatep(appState);
+}
+
+void _UiAppImpl::OnBackground(void)
+{
+       typedef void (_UiAppImpl::*methodType)(void);
+       static methodType uiappimpl_onbackgroundp;
+       DECLARE_COMMON_VARIABLE;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App10_UiAppImpl12OnBackgroundEv, libosp-uifw.so, uiappimpl_onbackgroundp);
+
+       probeBlockStart();
+       SCREENSHOT_LOCK();
+       LIFECYCLE_PROBE_BLOCK("PAUSING");
+       probeBlockEnd();
+
+       (this->*uiappimpl_onbackgroundp)();
+}
+
+void _UiAppImpl::OnForeground(void)
+{
+       typedef void (_UiAppImpl::*methodType)(void);
+       static methodType uiappimpl_onforegroundp;
+       DECLARE_COMMON_VARIABLE;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App10_UiAppImpl12OnForegroundEv, libosp-uifw.so, uiappimpl_onforegroundp);
+
+       probeBlockStart();
+       LIFECYCLE_PROBE_BLOCK("RUNNING");
+       SCREENSHOT_UNLOCK();
+//     SCREENSHOT_DONE();
+       probeBlockEnd();
+
+       (this->*uiappimpl_onforegroundp)();
+}
+
+/*
+void _UiAppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation)
+{
+       typedef void (*methodType)(_UiAppImpl* th, app_device_orientation_e orientation);
+       static methodType uiappimpl_ondeviceorientationchangedp;
+       
+       GET_REAL_FUNC_OSP(_ZThn4_N5Tizen3App10_UiAppImpl26OnDeviceOrientationChangedE24app_device_orientation_e,
+                       libosp-uifw.so, uiappimpl_ondeviceorientationchangedp);
+
+       probeBlockStart();
+       on_orientation_changed((int)orientation, false);
+       probeBlockEnd();
+
+       uiappimpl_ondeviceorientationchangedp(static_cast<_UiAppImpl*>(dynamic_cast<_IAppImpl*>(this)), orientation);
+}
+*/
+} }    // end of namespace
+
diff --git a/probe_badaapi/bada_sync.cpp b/probe_badaapi/bada_sync.cpp
new file mode 100755 (executable)
index 0000000..05e36d3
--- /dev/null
@@ -0,0 +1,1166 @@
+/*
+ *  DA probe
+ *
+ * Copyright 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <FBaseResult.h>
+#include <FBaseString.h>
+#include <FBaseRtTypes.h>
+
+#include <string.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dahelper.h"
+
+namespace Tizen {
+namespace Base {
+namespace Runtime {
+
+class Mutex {
+public:
+       result Create(void);
+       result Create(const Tizen::Base::String& name);
+       result Release(void);
+       result Acquire(void);
+       result TryToAcquire(void);
+
+//     Mutex(void);
+//     virtual ~Mutex(void);
+
+//private:
+//     Mutex(const Mutex& value);
+//     Mutex& opereator =(const Mutex& value);
+
+//private:
+//     friend class _MutexImpl;
+//     class _MutexImpl * __pMutexImpl;
+};
+
+class Semaphore {
+public:
+       result Create(int count = 1);
+       result Create(const Tizen::Base::String& name, int count = 1);
+       result Acquire(long timeout = INFINITE);
+       result TryToAcquire(void);
+       result Release(void);
+
+//     Semaphore(void);
+//     virtual ~Semaphore(void);
+
+//private:
+//     Semaphore(const Semaphore& rhs);
+//     Semaphore& operator =(const Semaphore& rhs);
+
+//private:
+//     friend class _SemaphoreImpl;
+//     class _SemaphoreImpl * __pSemaphoreImpl;
+};
+
+class Monitor {
+public:
+       result Construct(void);
+       result Enter(void);
+       result Exit(void);
+       result Wait(void);
+       result Notify(void);
+       result NotifyAll(void);
+
+//     Monitor(void);
+//     virtual ~Monitor(void);
+
+//private:
+//     Monitor(const Monitor& rhs);
+//     Monitor& operator =(const Monitor& rhs);
+
+//private:
+//     friend class _MonitorImpl;
+//     class _MonitorImpl * __pMonitorImpl;
+};
+
+
+result Mutex::Create(void) {
+       typedef result
+               (Mutex::*methodType)(void);
+       static methodType Createp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Createp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime5Mutex6CreateEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
+                       exit(0);
+               }
+
+               memcpy(&Createp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Createp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Mutex::Create",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Mutex::Create(const Tizen::Base::String& name) {
+       typedef result 
+               (Mutex::*methodType)(const Tizen::Base::String& name);
+       static methodType Createp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+       char temp[50];
+
+       if (!Createp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime5Mutex6CreateERKNS0_6StringE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
+                       exit(0);
+               }
+
+               memcpy(&Createp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Createp)(name);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Mutex::Create",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               WcharToChar(temp, name.GetPointer());
+               log.length += sprintf(log.data + log.length, "`,%s`,%ld", temp, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Mutex::Release(void) {
+       typedef result 
+               (Mutex::*methodType)(void);
+       static methodType Releasep = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Releasep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime5Mutex7ReleaseEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Mutex::Release");
+                       exit(0);
+               }
+
+               memcpy(&Releasep, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Releasep)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Mutex::Release",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_RELEASE);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Mutex::Acquire(void) {
+       typedef result
+               (Mutex::*methodType)(void);
+       static methodType Acquirep = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Acquirep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime5Mutex7AcquireEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Mutex::Acquire");
+                       exit(0);
+               }
+
+               memcpy(&Acquirep, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Mutex::Acquire",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,");
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_ACQUIRE_WAIT_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Acquirep)();
+       //
+       if (postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Mutex::Acquire",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_ACQUIRE_WAIT_END);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Mutex::TryToAcquire(void) {
+       typedef result 
+               (Mutex::*methodType)(void);
+       static methodType TryToAcquirep = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!TryToAcquirep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime5Mutex12TryToAcquireEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Mutex::TryToAcquire");
+                       exit(0);
+               }
+
+               memcpy(&TryToAcquirep, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*TryToAcquirep)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Mutex::TryToAcquire",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_TRY_ACQUIRE);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+
+result Semaphore::Create(int count) {
+       typedef result 
+               (Semaphore::*methodType)(int count);
+       static methodType Createp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Createp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime9Semaphore6CreateEi");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
+                       exit(0);
+               }
+
+               memcpy(&Createp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Createp)(count);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Semaphore::Create",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%d`,%ld", count, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Semaphore::Create(const Tizen::Base::String& name, int count) {
+       typedef result 
+               (Semaphore::*methodType)(const Tizen::Base::String& name, int count);
+       static methodType Createp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+       char temp[50];
+
+       if (!Createp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime9Semaphore6CreateERKNS0_6StringEi");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
+                       exit(0);
+               }
+
+               memcpy(&Createp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Createp)(name, count);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Semaphore::Create",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               WcharToChar(temp, name.GetPointer());
+               log.length += sprintf(log.data + log.length, "`,%s,%d`,%ld", temp, count, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+
+}
+
+result Semaphore::Acquire(long timeout) {
+       typedef result
+               (Semaphore::*methodType)(long timeout);
+       static methodType Acquirep = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Acquirep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime9Semaphore7AcquireEl");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Acquire");
+                       exit(0);
+               }
+
+               memcpy(&Acquirep, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Semaphore::Acquire",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%ld`,", timeout);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_ACQUIRE_WAIT_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Acquirep)(timeout);
+       //
+       if (postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Semaphore::Acquire",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%ld`,%ld", timeout, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_ACQUIRE_WAIT_END);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Semaphore::TryToAcquire(void) {
+       typedef result 
+               (Semaphore::*methodType)(void);
+       static methodType TryToAcquirep = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!TryToAcquirep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime9Semaphore12TryToAcquireEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Semaphore::TryToAcquire");
+                       exit(0);
+               }
+
+               memcpy(&TryToAcquirep, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*TryToAcquirep)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Semaphore::TryToAcquire",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_TRY_ACQUIRE);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Semaphore::Release(void) {
+       typedef result 
+               (Semaphore::*methodType)(void);
+       static methodType Releasep = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Releasep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime9Semaphore7ReleaseEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Release");
+                       exit(0);
+               }
+
+               memcpy(&Releasep, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Releasep)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Semaphore::Release",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_RELEASE);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+
+result Monitor::Construct(void) {
+       typedef result 
+               (Monitor::*methodType)(void);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime7Monitor9ConstructEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Monitor::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Monitor::Enter(void) {
+       typedef result
+               (Monitor::*methodType)(void);
+       static methodType Enterp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Enterp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime7Monitor5EnterEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Monitor::Enter");
+                       exit(0);
+               }
+
+               memcpy(&Enterp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::Enter",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,");
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_ACQUIRE_WAIT_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Enterp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::Enter",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_ACQUIRE_WAIT_END);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Monitor::Exit(void) {
+       typedef result 
+               (Monitor::*methodType)(void);
+       static methodType Exitp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Exitp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime7Monitor4ExitEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Monitor::Exit");
+                       exit(0);
+               }
+
+               memcpy(&Exitp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Exitp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::Exit",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_RELEASE);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Monitor::Wait(void) {
+       typedef result
+               (Monitor::*methodType)(void);
+       static methodType Waitp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Waitp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime7Monitor4WaitEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Monitor::Wait");
+                       exit(0);
+               }
+
+               memcpy(&Waitp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::Wait",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,");
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_COND_WAIT_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Waitp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::Wait",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_COND_WAIT_END);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Monitor::Notify(void) {
+       typedef result 
+               (Monitor::*methodType)(void);
+       static methodType Notifyp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Notifyp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime7Monitor6NotifyEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Monitor::Notify");
+                       exit(0);
+               }
+
+               memcpy(&Notifyp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Notifyp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::Notify",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_NOTIFY);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Monitor::NotifyAll(void) {
+       typedef result 
+               (Monitor::*methodType)(void);
+       static methodType NotifyAllp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!NotifyAllp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime7Monitor9NotifyAllEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Monitor::NotifyAll");
+                       exit(0);
+               }
+
+               memcpy(&NotifyAllp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*NotifyAllp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
+                               probeInfo.eventIndex, "Monitor::NotifyAll",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_NOTIFY_ALL);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+}
+}
+}
diff --git a/probe_badaapi/bada_thread.cpp b/probe_badaapi/bada_thread.cpp
new file mode 100755 (executable)
index 0000000..2e2dcc7
--- /dev/null
@@ -0,0 +1,1795 @@
+/*
+ *  DA probe
+ *
+ * Copyright (Thread::*c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Yeongtaik Byeon <yeongtaik.byeon@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+//#include <FBase.h>
+#include <FBaseDataType.h>
+#include <FBaseRtIRunnable.h>
+#include <FBaseCol.h>
+//#include <FIo.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dahelper.h"
+
+extern __thread unsigned int gProbeDepth;
+
+namespace Tizen {
+namespace Base {
+namespace Runtime {
+enum ThreadType {
+       THREAD_TYPE_WORKER = 0, /**< The worker thread mode */
+       THREAD_TYPE_EVENT_DRIVEN, /**< The event-driven thread mode */
+       THREAD_TYPE_MAIN
+// This enum value is for internal use only. Using this enum value can cause behavioral,
+// security-related, and consistency-related issues in the application.
+// The main thread mode
+};
+
+enum ThreadPriority {
+       THREAD_PRIORITY_HIGH, /**< The high priority*/
+       THREAD_PRIORITY_MID, /**< The mid priority*/
+       THREAD_PRIORITY_LOW,
+/**< The low priority*/
+};
+
+class Thread {
+public:
+       const static unsigned long DEFAULT_STACK_SIZE = 64 * 1024;
+
+       static result Sleep(long milliSeconds);
+       static Thread* GetCurrentThread(void);
+       static result Yield(void);
+       static result Exit(int exitCode=0x00);
+
+       result Construct(ThreadType threadType, long stackSize, // deprecated
+                       ThreadPriority priority = THREAD_PRIORITY_MID);
+       result Construct(long stackSize = DEFAULT_STACK_SIZE,
+                       ThreadPriority priority = THREAD_PRIORITY_MID);
+       result Construct(const Tizen::Base::String &name, long stackSize =
+                       DEFAULT_STACK_SIZE, ThreadPriority priority = THREAD_PRIORITY_MID);
+       result Construct(const Tizen::Base::String &name, ThreadType threadType, // deprecated
+                       long stackSize = DEFAULT_STACK_SIZE, ThreadPriority priority =
+                                       THREAD_PRIORITY_MID);
+       result Construct(IRunnable &target, long stackSize = DEFAULT_STACK_SIZE,
+                       ThreadPriority priority = THREAD_PRIORITY_MID);
+       result Construct(const Tizen::Base::String &name, IRunnable &target,
+                       long stackSize = DEFAULT_STACK_SIZE, ThreadPriority priority =
+                                       THREAD_PRIORITY_MID);
+       result GetExitCode(int &exitCode) const;
+       const Tizen::Base::String & GetName(void) const;
+       result Join(void);
+//     virtual bool OnStart(void); // deprecated
+//     virtual void OnStop(void); // deprecated
+//     virtual void OnUserEventReceivedN(RequestId requestId, // deprecated
+//                     Tizen::Base::Collection::IList *pArgs);
+//     virtual Tizen::Base::Object * Run(void);
+//     virtual result SendUserEvent(RequestId requestId, // deprecated
+//                     const Tizen::Base::Collection::IList *pArgs);
+       result Start(void);
+       result Stop(void); // deprecated
+
+//     Thread(void);
+//     virtual ~Thread(void);
+
+//private:
+//     Thread(const Thread& rhs);
+//     Thread& operator =(const Thread& rhs);
+//private:
+//     friend class _ThreadImpl;
+//     class _ThreadImpl* __pThreadImpl;
+};
+
+class _ThreadImpl {
+//public:
+//     virtual result Stop(void);
+protected:
+//     virtual result Finalize(void);
+       const Thread* GetThread(void) const;
+private:
+       static void* ThreadProc(void* pParam);
+//protected:
+//     Thread* _pThread;
+};
+//const Thread*
+//_ThreadImpl::GetThread(void) const
+//{
+//     typedef const Thread*
+//     (_ThreadImpl::*methodType)(void) const;
+//     static methodType GetThreadp = 0;
+//     probeInfo_t probeInfo;
+//     log_t log;
+//     int blockresult;
+//     bool bfiltering = false;
+//     void *tmpPtr;
+//
+//     if (!GetThreadp) {
+//             probeBlockStart();
+//             void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+//             if (lib_handle == NULL) {
+//                     perror("dlopen failed : libosp-appfw.so");
+//                     exit(0);
+//             }
+//             tmpPtr = dlsym(lib_handle, "_ZNK5Tizen4Base7Runtime11_ThreadImpl9GetThreadEv");
+//
+//             if (tmpPtr == NULL || dlerror() != NULL) {
+//                     perror("dlsym failed : Tizen::Base::Runtime::_ThreadImpl::GetThreadp");
+//                     exit(0);
+//             }
+//
+//             memcpy(&GetThreadp, &tmpPtr, sizeof(&tmpPtr));
+//
+//             probeBlockEnd();
+//     }
+//
+//     if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+//             setProbePoint(&probeInfo);
+//             preBlockEnd();
+//     }
+//     //
+//     const Thread* ret = (this->*GetThreadp)();
+//     result res = GetLastResult();
+//     //
+//     if (postBlockBegin(blockresult)) {
+//             log.type = 0;
+//             log.length = 0;
+//             log.data[0] = '\0';
+//             log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+//                             probeInfo.eventIndex, "_ThreadImpl::GetThread", probeInfo.currentTime,
+//                             probeInfo.pID, probeInfo.tID);
+//
+//             //Input,ret
+//             log.length += sprintf(log.data + log.length, "`,`,0x%x",ret);
+//             //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+//             log.length += sprintf(log.data + log.length,
+//                             "`,0`,%ld`,%d`,0`,%u`,0x%x`,%d`,%d`,`,", res,blockresult,
+//                             (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_OTHER);
+//             //callstack
+//             log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+//             getBacktraceString(&log, 4096 - log.length - 17);
+//             log.length += sprintf(log.data + log.length, "`,callstack_end");
+//
+//             printLog(&log, MSG_LOG);
+//             postBlockEnd();
+//     }
+//     return ret;
+//}
+
+class EventDrivenThread : public Thread {
+public:
+       result Construct(long stackSize = DEFAULT_STACK_SIZE,
+                       ThreadPriority priority = THREAD_PRIORITY_MID);
+       result Construct(const Tizen::Base::String &name, long stackSize =
+                       DEFAULT_STACK_SIZE, ThreadPriority priority = THREAD_PRIORITY_MID);
+
+       virtual result Quit();
+//     virtual bool OnStart(void);
+//     virtual void OnStop(void);
+//     virtual void OnUserEventReceivedN(RequestId requestId,
+//                     Tizen::Base::Collection::IList *pArgs);
+//     virtual Tizen::Base::Object * Run(void);
+//     virtual result SendUserEvent(RequestId requestId,
+//                     const Tizen::Base::Collection::IList *pArgs);
+
+//     EventDrivenThread(void);
+//     virtual ~EventDrivenThread(void);
+
+//private:
+//     EventDrivenThread(const EventDrivenThread& rhs);
+//     EventDrivenThread& operator = (const EventDrivenThread& rhs);
+//private:
+//     class _EventDrivenThreadImpl* __pEventDrivenThreadImpl;
+//     friend class _EventDrivenThreadImpl;
+};
+
+
+void*
+_ThreadImpl::ThreadProc(void* params) {
+       typedef void*
+       (*methodType)(void*);
+       static methodType ThreadProcp = 0;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = false;
+       void *tmpPtr;
+
+       if (!ThreadProcp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime11_ThreadImpl10ThreadProcEPv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::_ThreadImpl::ThreadProc");
+                       exit(0);
+               }
+
+               memcpy(&ThreadProcp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "_ThreadImpl::ThreadProc", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+
+               _ThreadImpl* pSelf =(_ThreadImpl*)params;
+               const Thread* pThread;
+               if(pSelf != null){
+                       pThread = pSelf->GetThread();
+               }
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,0x%x`,",(unsigned int)pSelf);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,`,0x%x`,%d`,%d", blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int)pThread, THREAD_OSPTHREAD_WORKER, THREAD_API_INTERNAL_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       // all probe should be reachable inside thread start_routine (user implemented Thread::Run)
+       gProbeDepth--;
+       TRACE_STATE_UNSET(TS_ENTER_PROBE_BLOCK);
+       (ThreadProcp)(params);
+       TRACE_STATE_SET(TS_ENTER_PROBE_BLOCK);
+       gProbeDepth++;
+       //
+       if (postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "_ThreadImpl::ThreadProc", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+
+               _ThreadImpl* pSelf =(_ThreadImpl*)params;
+               const Thread* pThread;
+               if(pSelf != null){
+                       pThread = pSelf->GetThread();
+               }
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,0x%x`,",(unsigned int)pSelf);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,`,0x%x`,%d`,%d", blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int)pThread, THREAD_OSPTHREAD_WORKER, THREAD_API_INTERNAL_STOP);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return null;
+}
+//result _ThreadImpl::Stop(void) {
+//     typedef result
+//     (_ThreadImpl::*methodType)(void);
+//     static methodType Stopp = 0;
+//     probeInfo_t probeInfo;
+//     log_t log;
+//     int blockresult;
+//     bool bfiltering = true;
+//     void *tmpPtr;
+//
+//     if (!Stopp) {
+//             probeBlockStart();
+//             void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+//             if (lib_handle == NULL) {
+//                     perror("dlopen failed : libosp-appfw.so");
+//                     exit(0);
+//             }
+//             tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime11_ThreadImpl4StopEv");
+//
+//             if (tmpPtr == NULL || dlerror() != NULL) {
+//                     perror("dlsym failed : Tizen::Base::Runtime::_ThreadImpl::Stopp");
+//                     exit(0);
+//             }
+//
+//             memcpy(&Stopp, &tmpPtr, sizeof(&tmpPtr));
+//
+//             probeBlockEnd();
+//     }
+//
+//     if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+//             setProbePoint(&probeInfo);
+//             preBlockEnd();
+//     }
+//     //
+//     result ret= (this->*Stopp)();
+//     //
+//     if (postBlockBegin(blockresult)) {
+//             log.type = 0;
+//             log.length = 0;
+//             log.data[0] = '\0';
+//             log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+//                             probeInfo.eventIndex, "_ThreadImpl::Stop", probeInfo.currentTime,
+//                             probeInfo.pID, probeInfo.tID);
+//             //Input,ret
+//             log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+//             //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+//             log.length += sprintf(log.data + log.length,
+//                             "`,0`,%ld`,%d`,0`,%u`,0x%x`,%d`,%d`,`,", ret, blockresult,
+//                             (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_CLOSE);
+//             //callstack
+//             log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+//             getBacktraceString(&log, 4096 - log.length - 17);
+//             log.length += sprintf(log.data + log.length, "`,callstack_end");
+//
+//             printLog(&log, MSG_LOG);
+//             postBlockEnd();
+//     }
+//     return ret;
+//}
+//
+//result _ThreadImpl::Finalize(void) {
+//     typedef result
+//     (_ThreadImpl::*methodType)(void);
+//     static methodType Finalizep = 0;
+//     probeInfo_t probeInfo;
+//     log_t log;
+//     int blockresult;
+//     bool bfiltering = false;
+//     void *tmpPtr;
+//
+//     if (!Finalizep) {
+//             probeBlockStart();
+//             void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+//             if (lib_handle == NULL) {
+//                     perror("dlopen failed : libosp-appfw.so");
+//                     exit(0);
+//             }
+//             tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime11_ThreadImpl8FinalizeEv");
+//
+//             if (tmpPtr == NULL || dlerror() != NULL) {
+//                     perror("dlsym failed : Tizen::Base::Runtime::_ThreadImpl::Finalizep");
+//                     exit(0);
+//             }
+//
+//             memcpy(&Finalizep, &tmpPtr, sizeof(&tmpPtr));
+//             probeBlockEnd();
+//     }
+//
+//     if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+//             setProbePoint(&probeInfo);
+//             preBlockEnd();
+//     }
+//     //
+//     result ret= (this->*Finalizep)();
+//     //
+//     if (postBlockBegin(blockresult)) {
+//             log.type = 0;
+//             log.length = 0;
+//             log.data[0] = '\0';
+//             log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+//                             probeInfo.eventIndex, "_ThreadImpl::Finalize", probeInfo.currentTime,
+//                             probeInfo.pID, probeInfo.tID);
+//             //Input,ret
+//             log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+//             //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+//             log.length += sprintf(log.data + log.length,
+//                             "`,0`,%ld`,%d`,0`,%u`,0x%x`,%d`,%d`,`,", ret, blockresult,
+//                             (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_CLOSE);
+//             //callstack
+//             log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+//             getBacktraceString(&log, 4096 - log.length - 17);
+//             log.length += sprintf(log.data + log.length, "`,callstack_end");
+//
+//             printLog(&log, MSG_LOG);
+//             postBlockEnd();
+//     }
+//     return ret;
+//}
+//Thread::Thread(void) {
+//     typedef void (Thread::*methodType)();
+//     static methodType Threadp = 0;
+//     probeInfo_t probeInfo;
+//     log_t log;
+//     int blockresult;
+//     bool bfiltering = true;
+//     void *tmpPtr;
+//
+//     if (!Threadp) {
+//             probeBlockStart();
+//
+//             tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen4Base7Runtime6ThreadC1Ev");
+//
+//             if (tmpPtr == NULL || dlerror() != NULL) {
+//                     log.type = 0;
+//                                                                                     log.length = 0;
+//                                                                                     log.data[0] = '\0';
+//                                                                                     log.length = sprintf(log.data,"dlsym failed : Tizen::Base::Runtime::Thread::Thread");
+//                     perror("dlsym failed : Tizen::Base::Runtime::Thread::Thread");
+//                     printLog(&log, MSG_MSG);
+//                     return;
+//             }
+//
+//             memcpy(&Threadp, &tmpPtr, sizeof(&tmpPtr));
+//             probeBlockEnd();
+//     }
+//
+//     if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+//             setProbePoint(&probeInfo);
+//             preBlockEnd();
+//     }
+////
+//     (this->*Threadp)();
+////
+//     if (postBlockBegin(blockresult)) {
+//             log.type = 0;
+//             log.length = 0;
+//             log.data[0] = '\0';
+//             log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+//                             probeInfo.eventIndex, "Thread::Thread", probeInfo.currentTime,
+//                             probeInfo.pID, probeInfo.tID);
+//             //Input,ret
+//             log.length += sprintf(log.data + log.length, "`,`,");
+//             //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+//
+//             log.length += sprintf(log.data + log.length,
+//                             "`,0`,0`,%d`,0`,0x%x`,%d`,%d`,`,", blockresult,
+//                             (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_OPEN);
+//             //callstack
+//             log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+//             getBacktraceString(&log, 4096 - log.length - 17);
+//             log.length += sprintf(log.data + log.length, "`,callstack_end");
+//
+//             printLog(&log, MSG_LOG);
+//             postBlockEnd();
+//     }
+//}
+//
+//Thread::~Thread(void) {
+//     typedef void (Thread::*methodType)();
+//     static methodType ThreadDp = 0;
+//     probeInfo_t probeInfo;
+//     log_t log;
+//     int blockresult;
+//     bool bfiltering = true;
+//     void *tmpPtr;
+//
+//     if (!ThreadDp) {
+//             probeBlockStart();
+//
+//             void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+//             if (lib_handle == NULL) {
+//                     perror("dlopen failed : libosp-appfw.so");
+//                     exit(0);
+//             }
+//             tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6ThreadD0Ev");
+//
+//             if (tmpPtr == NULL || dlerror() != NULL) {
+//                     perror("dlsym failed : Tizen::Base::Runtime::Thread::~Thread");
+//                     exit(0);
+//             }
+//
+//             memcpy(&ThreadDp, &tmpPtr, sizeof(&tmpPtr));
+//             probeBlockEnd();
+//     }
+//
+//     if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+//             setProbePoint(&probeInfo);
+//             preBlockEnd();
+//     }
+////
+//     (this->*ThreadDp)();
+////
+//     if (postBlockBegin(blockresult)) {
+//             log.type = 0;
+//             log.length = 0;
+//             log.data[0] = '\0';
+//             log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+//                             probeInfo.eventIndex, "Thread::~Thread", probeInfo.currentTime,
+//                             probeInfo.pID, probeInfo.tID);
+//             //Input,ret
+//             log.length += sprintf(log.data + log.length, "`,`,");
+//             //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+//
+//             log.length += sprintf(log.data + log.length,
+//                             "`,0`,0`,%d`,0`,0x%x`,%d`,%d`,`,", blockresult,
+//                             (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_CLOSE);
+//             //callstack
+//             log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+//             getBacktraceString(&log, 4096 - log.length - 17);
+//             log.length += sprintf(log.data + log.length, "`,callstack_end");
+//
+//             printLog(&log, MSG_LOG);
+//             postBlockEnd();
+//     }
+//}
+result Thread::Sleep(long milliSeconds) {
+       typedef result
+       (*methodType)(long);
+       static methodType Sleepp = 0;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Sleepp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6Thread5SleepEl");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Sleep");
+                       exit(0);
+               }
+
+               memcpy(&Sleepp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Sleep", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+
+               Thread *currentThread;
+               currentThread = GetCurrentThread();
+
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%ld`,",milliSeconds);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                                               "`,0`,0`,%d`,%u`,`,0x%x`,%d`,%d",blockresult,
+                                               (unsigned int)CALLER_ADDRESS, (unsigned int)currentThread, THREAD_OSPTHREAD_WORKER, THREAD_API_WAIT_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       //
+       result ret = (Sleepp)(milliSeconds);
+       //
+       if (postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Sleep", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+
+               Thread *currentThread;
+               currentThread = GetCurrentThread();
+
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%ld`,%ld",milliSeconds,ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret,blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int)currentThread, THREAD_OSPTHREAD_WORKER, THREAD_API_WAIT_END);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+Thread* Thread::GetCurrentThread(void) {
+       typedef Thread*
+               (*methodType)(void);
+       static methodType GetCurrentThreadp = 0;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!GetCurrentThreadp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6Thread16GetCurrentThreadEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::GetCurrentThread");
+                       exit(0);
+               }
+
+               memcpy(&GetCurrentThreadp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       Thread *currentThread = (GetCurrentThreadp)();
+       result res = GetLastResult();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::GetCurrentThread", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,0x%x",(unsigned int)currentThread);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", res,blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int)currentThread, THREAD_OSPTHREAD_WORKER, THREAD_API_OTHER);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return currentThread;
+}
+
+result Thread::Yield(void) {
+       typedef result
+               (*methodType)(void);
+       static methodType Yieldp = 0;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Yieldp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6Thread5YieldEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Yield");
+                       exit(0);
+               }
+
+               memcpy(&Yieldp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       result ret = (Yieldp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Yield", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+
+               Thread *currentThread;
+               currentThread = GetCurrentThread();
+               
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld",ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret,blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int)currentThread, THREAD_OSPTHREAD_WORKER, THREAD_API_OTHER);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Thread::Exit(int exitCode) {
+       typedef result
+               (*methodType)(int exitCode);
+       static methodType Exitp = 0;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Exitp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6Thread4ExitEi");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Exit");
+                       exit(0);
+               }
+
+               memcpy(&Exitp, &tmpPtr, sizeof(&tmpPtr));
+
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Exit", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+
+               Thread *currentThread;
+               currentThread = GetCurrentThread();
+               
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%d`,",exitCode);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,`,0x%x`,%d`,%d",blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int)currentThread, THREAD_OSPTHREAD_WORKER, THREAD_API_EXIT);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       //
+       result ret = (Exitp)(exitCode);
+       //
+       return ret;
+}
+
+result Thread::Construct(ThreadType threadType, long stackSize,
+               ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(ThreadType threadType, long stackSize,
+                       ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr =
+                               dlsym(
+                                               lib_handle,
+                                               "_ZN5Tizen4Base7Runtime6Thread9ConstructENS1_10ThreadTypeElNS1_14ThreadPriorityE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(threadType, stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%d, %ld, %d`,%ld",
+                               threadType, stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+result Thread::Construct(long stackSize, ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(long stackSize, ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle,
+                               "_ZN5Tizen4Base7Runtime6Thread9ConstructElNS1_14ThreadPriorityE");
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%ld, %d`,%ld",
+                               stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+result Thread::Construct(const Tizen::Base::String &name, long stackSize,
+               ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(const Tizen::Base::String &name, long stackSize,
+                       ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+       char temp[50];
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr =
+                               dlsym(
+                                               lib_handle,
+                                               "_ZN5Tizen4Base7Runtime6Thread9ConstructERKNS0_6StringElNS1_14ThreadPriorityE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(name, stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               WcharToChar(temp, name.GetPointer());
+               log.length += sprintf(log.data + log.length, "`,%s, %ld, %d`,%ld", temp,
+                               stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+result Thread::Construct(const Tizen::Base::String &name, ThreadType threadType,
+               long stackSize, ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(const Tizen::Base::String &name, ThreadType threadType,
+                       long stackSize, ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+       char temp[50];
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+
+               tmpPtr =
+                               dlsym(
+                                               lib_handle,
+                                               "_ZN5Tizen4Base7Runtime6Thread9ConstructERKNS0_6StringENS1_10ThreadTypeElNS1_14ThreadPriorityE");
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(name, threadType, stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               WcharToChar(temp, name.GetPointer());
+               log.length += sprintf(log.data + log.length, "`,%s, %d, %ld, %d`,%ld",
+                               temp, threadType, stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+result Thread::Construct(IRunnable &target, long stackSize,
+               ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(IRunnable &target, long stackSize,
+                       ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr =
+                               dlsym(
+                                               lib_handle,
+                                               "_ZN5Tizen4Base7Runtime6Thread9ConstructERNS1_9IRunnableElNS1_14ThreadPriorityE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(target, stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,0x%x, %ld, %d`,%ld",
+                               (unsigned int) &target, stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+result Thread::Construct(const Tizen::Base::String &name, IRunnable &target,
+               long stackSize, ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(const Tizen::Base::String &name, IRunnable &target,
+                       long stackSize, ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+       char temp[50];
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr =
+                               dlsym(
+                                               lib_handle,
+                                               "_ZN5Tizen4Base7Runtime6Thread9ConstructERKNS0_6StringERNS1_9IRunnableElNS1_14ThreadPriorityE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(name, target, stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               WcharToChar(temp, name.GetPointer());
+               log.length += sprintf(log.data + log.length, "`,%s, 0x%x, %ld, %d`,%ld",
+                               temp, (unsigned int) &target, stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Thread::GetExitCode(int &exitCode) const {
+       typedef result
+       (Thread::*methodType)(int &exitCode) const;
+       static methodType GetExitCodep = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+//     int exitOld = exitCode;
+
+       if (!GetExitCodep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle,
+                               "_ZNK5Tizen4Base7Runtime6Thread11GetExitCodeERi");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::GetExitCode");
+                       exit(0);
+               }
+
+               memcpy(&GetExitCodep, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*GetExitCodep)(exitCode);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::GetExitCode",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+//             log.length += sprintf(log.data + log.length, "`,(%d->%d)`,%ld", exitOld,
+//                             exitCode, ret);
+               log.length += sprintf(log.data + log.length, "`,%d`,%ld", exitCode, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_OTHER);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+const Tizen::Base::String & Thread::GetName(void) const {
+       typedef const Tizen::Base::String &
+       (Thread::*methodType)(void) const;
+       static methodType GetNamep = 0;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+       char temp[50];
+
+       if (!GetNamep) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZNK5Tizen4Base7Runtime6Thread7GetNameEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::GetName");
+                       exit(0);
+               }
+
+               memcpy(&GetNamep, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       const Tizen::Base::String& ret = (this->*GetNamep)();
+       result res = GetLastResult();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::GetName", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               WcharToChar(temp, ret.GetPointer());
+               log.length += sprintf(log.data + log.length, "`,`,%s", temp);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", res, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_OTHER);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result Thread::Join(void) {
+       typedef result
+       (Thread::*methodType)(void);
+       static methodType Joinp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Joinp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6Thread4JoinEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Join");
+                       exit(0);
+               }
+
+               memcpy(&Joinp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Join", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,");
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,0`,%d`,%u`,`,0x%x`,%d`,%d",blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_WAIT_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Joinp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Join", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret,blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_WAIT_END);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+//Tizen::Base::Object * Thread::Run(void) {
+//     typedef Tizen::Base::Object * (Thread::*methodType)(void);
+//     static methodType Runp = 0;
+//     Tizen::Base::Object * ret;
+//     probeInfo_t probeInfo;
+//     log_t log;
+//     int blockresult;
+//     bool bfiltering = true;
+//     void *tmpPtr;
+//     log.type = 0;
+//                             log.length = 0;
+//                             log.data[0] = '\0';
+//                             log.length = sprintf(log.data, "call Thread::Run");
+//                             printLog(&log, MSG_MSG);
+//                             return null;
+//     if (!Runp) {
+//             probeBlockStart();
+//             void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+//             if (lib_handle == NULL) {
+//                     perror("dlopen failed : libosp-appfw.so");
+//                     log.type = 0;
+//                     log.length = 0;
+//                     log.data[0] = '\0';
+//                     log.length = sprintf(log.data, "dlopen failed :libosp-appfw.so");
+//                     printLog(&log, MSG_MSG);
+//                     return null;
+//             }
+//             tmpPtr =
+//                             dlsym(
+//                                             RTLD_NEXT,
+//                                             "_ZN5Tizen4Base7Runtime6Thread3RunEv");
+//
+//             if (tmpPtr == NULL || dlerror() != NULL) {
+//                     perror("dlsym failed : Thread::Run");
+//                     log.type = 0;
+//                     log.length = 0;
+//                     log.data[0] = '\0';
+//                     log.length = sprintf(log.data, "dlsym failed : Thread::Run");
+//                     printLog(&log, MSG_MSG);
+//                     return null;
+//             }
+//
+//             memcpy(&Runp, &tmpPtr, sizeof(&tmpPtr));
+//             probeBlockEnd();
+//     }
+//
+//     if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+//             setProbePoint(&probeInfo);
+//             preBlockEnd();
+//     }
+//     //
+//     ret = (this->*Runp)();
+//     //
+//     if (postBlockBegin(blockresult)) {
+//             log.type = 0;
+//             log.length = 0;
+//             log.data[0] = '\0';
+//             log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+//                             probeInfo.eventIndex, "Thread::Run",
+//                             probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+//             //Input,ret
+//             log.length += sprintf(log.data + log.length, "`,`,0x%x",(unsigned int)ret;
+//             //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
+//
+//
+//             log.length += sprintf(log.data + log.length,
+//                             "`,0`,0`,%d`,0`,0x%x`,%d`,%d`,`,", blockresult,
+//                             (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_OTHER);
+//             //callstack
+//             log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+//             getBacktraceString(&log, 4096 - log.length - 17);
+//             log.length += sprintf(log.data + log.length, "`,callstack_end");
+//
+//             printLog(&log, MSG_LOG);
+//             postBlockEnd();
+//     }
+//     return ret;
+//}
+
+result Thread::Start(void) {
+       typedef result (Thread::*methodType)(void);
+       static methodType Startp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Startp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6Thread5StartEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Start");
+                       exit(0);
+               }
+
+               memcpy(&Startp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Startp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Start", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_START);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+result Thread::Stop(void) {
+       typedef result (Thread::*methodType)(void);
+       static methodType Stopp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Stopp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime6Thread4StopEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::Thread::Stop");
+                       exit(0);
+               }
+
+               memcpy(&Stopp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Stopp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "Thread::Stop", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_WORKER, THREAD_API_STOP);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result EventDrivenThread::Construct(long stackSize, ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(long stackSize, ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle,
+                               "_ZN5Tizen4Base7Runtime17EventDrivenThread9ConstructElNS1_14ThreadPriorityE");
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::EventDrivenThread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "EventDrivenThread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,%ld, %d`,%ld",
+                               stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_EVENTDRIVEN, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+result EventDrivenThread::Construct(const Tizen::Base::String &name, long stackSize, 
+               ThreadPriority priority) {
+       typedef result
+       (Thread::*methodType)(const Tizen::Base::String &name, long stackSize,
+                       ThreadPriority priority);
+       static methodType Constructp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+       char temp[50];
+
+       if (!Constructp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr =
+                               dlsym(
+                                               lib_handle,
+                                               "_ZN5Tizen4Base7Runtime17EventDrivenThread9ConstructERKNS0_6StringElNS1_14ThreadPriorityE");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::EventDrivenThread::Construct");
+                       exit(0);
+               }
+
+               memcpy(&Constructp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Constructp)(name, stackSize, priority);
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "EventDrivenThread::Construct",
+                               probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               WcharToChar(temp, name.GetPointer());
+               log.length += sprintf(log.data + log.length, "`,%s, %ld, %d`,%ld", temp,
+                               stackSize, priority, ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_EVENTDRIVEN, THREAD_API_NEW);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+
+}
+
+result EventDrivenThread::Quit() {
+       typedef result (Thread::*methodType)(void);
+       static methodType Quitp = 0;
+       result ret;
+       probeInfo_t probeInfo;
+       log_t log;
+       int blockresult;
+       bool bfiltering = true;
+       void *tmpPtr;
+
+       if (!Quitp) {
+               probeBlockStart();
+               void* lib_handle = dlopen("libosp-appfw.so", RTLD_LAZY);
+               if (lib_handle == NULL) {
+                       perror("dlopen failed : libosp-appfw.so");
+                       exit(0);
+               }
+               tmpPtr = dlsym(lib_handle, "_ZN5Tizen4Base7Runtime17EventDrivenThread4QuitEv");
+
+               if (tmpPtr == NULL || dlerror() != NULL) {
+                       perror("dlsym failed : Tizen::Base::Runtime::EventThread::Quit");
+                       exit(0);
+               }
+
+               memcpy(&Quitp, &tmpPtr, sizeof(&tmpPtr));
+               probeBlockEnd();
+       }
+
+       if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering)) != 0) {
+               setProbePoint(&probeInfo);
+               preBlockEnd();
+       }
+       //
+       ret = (this->*Quitp)();
+       //
+       if (postBlockBegin(blockresult)) {
+               log.type = 0;
+               log.length = 0;
+               log.data[0] = '\0';
+               log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_THREAD,
+                               probeInfo.eventIndex, "EventThread::Quit", probeInfo.currentTime,
+                               probeInfo.pID, probeInfo.tID);
+               //Input,ret
+               log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
+               //PCAddr,errno,InternalCall,CallerPCAddr,PThreadID,OspThreadID,ThreadType,ApiType
+               log.length += sprintf(log.data + log.length,
+                               "`,0`,%lu`,%d`,%u`,`,0x%x`,%d`,%d", ret, blockresult,
+                               (unsigned int)CALLER_ADDRESS, (unsigned int) this, THREAD_OSPTHREAD_EVENTDRIVEN, THREAD_API_STOP);
+               //callstack
+               log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
+               getBacktraceString(&log, 4096 - log.length - 17);
+               log.length += sprintf(log.data + log.length, "`,callstack_end");
+
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       return ret;
+}
+
+}
+}
+}
diff --git a/probe_badaapi/osp_constructor.cpp b/probe_badaapi/osp_constructor.cpp
new file mode 100755 (executable)
index 0000000..4481f5e
--- /dev/null
@@ -0,0 +1,1182 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "daprobe.h"
+#include "dacollection.h"
+#include "osp_probe.h"
+
+namespace Tizen { namespace Ui {
+
+class Control
+{
+       Control(void);
+       ~Control(void);
+};
+
+class CustomControlBase
+{
+       CustomControlBase(void);
+};
+
+class Container
+{
+       Container(void);
+};
+
+class Window
+{
+       Window(void);
+};
+
+Control::Control(void)
+{
+       typedef void (Control::*methodType)(void);
+       static methodType control_controlp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui7ControlC2Ev, libosp-uifw.so, control_controlp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Control");
+       probeBlockEnd();
+
+       (this->*control_controlp)();
+}
+
+Control::~Control(void)
+{
+       typedef void (Control::*methodType)(void);
+       static methodType control__controlvoidp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui7ControlD2Ev, libosp-uifw.so, control__controlvoidp);
+
+       probeBlockStart();
+       del_object_hash(static_cast<void*>(this));
+       probeBlockEnd();
+
+       (this->*control__controlvoidp)();
+}
+
+CustomControlBase::CustomControlBase(void)
+{
+       typedef void (CustomControlBase::*methodType)(void);
+       static methodType customcontrolbase_customcontrolbasep;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui17CustomControlBaseC2Ev, libosp-uifw.so, customcontrolbase_customcontrolbasep);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "CustomControlBase");
+       probeBlockEnd();
+
+       (this->*customcontrolbase_customcontrolbasep)();
+}
+
+Container::Container(void)
+{
+       typedef void (Container::*methodType)(void);
+       static methodType container_containerp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9ContainerC2Ev, libosp-uifw.so, container_containerp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Container");
+       probeBlockEnd();
+
+       (this->*container_containerp)();
+}
+
+Window::Window(void)
+{
+       typedef void (Window::*methodType)(void);
+       static methodType window_windowp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui6WindowC2Ev, libosp-uifw.so, window_windowp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Window");
+       probeBlockEnd();
+
+       (this->*window_windowp)();
+}
+
+namespace Controls {
+
+class Animation
+{
+       Animation(void);
+};
+
+class Button
+{
+       Button(void);
+};
+
+class CheckButton
+{
+       CheckButton(void);
+};
+
+class ColorPicker
+{
+       ColorPicker(void);
+};
+
+class CustomList
+{
+       CustomList(void);
+};
+
+class EditArea
+{
+       EditArea(void);
+};
+
+class EditDate
+{
+       EditDate(void);
+};
+
+class EditField
+{
+       EditField(void);
+};
+
+class EditTime
+{
+       EditTime(void);
+};
+
+class ExpandableEditArea
+{
+       ExpandableEditArea(void);
+};
+
+class ExpandableList
+{
+       ExpandableList(void);
+};
+
+class Footer
+{
+       Footer(void);
+};
+
+class Gallery
+{
+       Gallery(void);
+};
+
+class GroupedList
+{
+       GroupedList(void);
+};
+
+class GroupedListView
+{
+       GroupedListView(void);
+};
+
+class Header
+{
+       Header(void);
+};
+
+class IconList
+{
+       IconList(void);
+};
+
+class IconListView
+{
+       IconListView(void);
+};
+
+class Label
+{
+       Label(void);
+};
+
+class List
+{
+       List(void);
+};
+
+class ListView
+{
+       ListView(void);
+};
+
+class Progress
+{
+       Progress(void);
+};
+
+class RadioGroup
+{
+       RadioGroup(void);
+};
+
+class SearchBar
+{
+       SearchBar(void);
+};
+
+class SlidableGroupedList
+{
+       SlidableGroupedList(void);
+};
+
+class SlidableList
+{
+       SlidableList(void);
+};
+
+class Slider
+{
+       Slider(void);
+};
+
+class SplitPanel
+{
+       SplitPanel(void);
+};
+
+class Tab
+{
+       Tab(void);
+};
+
+class TabBar
+{
+       TabBar(void);
+};
+
+class TextBox
+{
+       TextBox(void);
+};
+
+class Form
+{
+       Form(void);
+};
+
+class GroupedTableView
+{
+       GroupedTableView(void);
+};
+
+class Panel
+{
+       Panel(void);
+};
+
+class OverlayPanel
+{
+       OverlayPanel(void);
+};
+
+class ScrollPanel
+{
+       ScrollPanel(void);
+};
+
+class SectionTableView
+{
+       SectionTableView(void);
+};
+
+class TableView
+{
+       TableView(void);
+};
+
+class TableViewItemBase
+{
+       TableViewItemBase(void);
+};
+
+class TableViewContextItem
+{
+       TableViewContextItem(void);
+};
+
+class TableViewGroupItem
+{
+       TableViewGroupItem(void);
+};
+
+class TableViewItem
+{
+       TableViewItem(void);
+};
+
+class TableViewSimpleGroupItem
+{
+       TableViewSimpleGroupItem(void);
+};
+
+class TableViewSimpleItem
+{
+       TableViewSimpleItem(void);
+};
+
+class ContextMenu
+{
+       ContextMenu(void);
+};
+
+class DatePicker
+{
+       DatePicker(void);
+};
+
+class DateTimePicker
+{
+       DateTimePicker(void);
+};
+
+class Frame
+{
+       Frame(void);
+};
+
+class Keypad
+{
+       Keypad(void);
+};
+
+class MessageBox
+{
+       MessageBox(void);
+};
+
+class NotificationFrame
+{
+       NotificationFrame(void);
+};
+
+class OptionMenu
+{
+       OptionMenu(void);
+};
+
+class Popup
+{
+       Popup(void);
+};
+
+class TimePicker
+{
+       TimePicker(void);
+};
+
+Animation::Animation(void)
+{
+       typedef void (Animation::*methodType)(void);
+       static methodType animation_animationp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls9AnimationC2Ev, libosp-uifw.so, animation_animationp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Animation");
+       probeBlockEnd();
+
+       (this->*animation_animationp)();
+}
+
+Button::Button(void)
+{
+       typedef void (Button::*methodType)(void);
+       static methodType button_buttonp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls6ButtonC2Ev, libosp-uifw.so, button_buttonp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Button");
+       probeBlockEnd();
+
+       (this->*button_buttonp)();
+}
+
+CheckButton::CheckButton(void)
+{
+       typedef void (CheckButton::*methodType)(void);
+       static methodType checkbutton_checkbuttonp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls11CheckButtonC2Ev, libosp-uifw.so, checkbutton_checkbuttonp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "CheckButton");
+       probeBlockEnd();
+
+       (this->*checkbutton_checkbuttonp)();
+}
+
+ColorPicker::ColorPicker(void)
+{
+       typedef void (ColorPicker::*methodType)(void);
+       static methodType colorpicker_colorpickerp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls11ColorPickerC2Ev, libosp-uifw.so, colorpicker_colorpickerp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "ColorPicker");
+       probeBlockEnd();
+
+       (this->*colorpicker_colorpickerp)();
+}
+
+CustomList::CustomList(void)
+{
+       typedef void (CustomList::*methodType)(void);
+       static methodType customlist_customlistp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls10CustomListC2Ev, libosp-uifw.so, customlist_customlistp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "CustomList");
+       probeBlockEnd();
+
+       (this->*customlist_customlistp)();
+}
+
+EditArea::EditArea(void)
+{
+       typedef void (EditArea::*methodType)(void);
+       static methodType editarea_editareap;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls8EditAreaC2Ev, libosp-uifw.so, editarea_editareap);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "EditArea");
+       probeBlockEnd();
+
+       (this->*editarea_editareap)();
+}
+
+EditDate::EditDate(void)
+{
+       typedef void (EditDate::*methodType)(void);
+       static methodType editdate_editdatep;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls8EditDateC2Ev, libosp-uifw.so, editdate_editdatep);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "EditDate");
+       probeBlockEnd();
+
+       (this->*editdate_editdatep)();
+}
+
+EditField::EditField(void)
+{
+       typedef void (EditField::*methodType)(void);
+       static methodType editfield_editfieldp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls9EditFieldC2Ev, libosp-uifw.so, editfield_editfieldp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "EditField");
+       probeBlockEnd();
+
+       (this->*editfield_editfieldp)();
+}
+
+EditTime::EditTime(void)
+{
+       typedef void (EditTime::*methodType)(void);
+       static methodType edittime_edittimep;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls8EditTimeC2Ev, libosp-uifw.so, edittime_edittimep);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "EditTime");
+       probeBlockEnd();
+
+       (this->*edittime_edittimep)();
+}
+
+ExpandableEditArea::ExpandableEditArea(void)
+{
+       typedef void (ExpandableEditArea::*methodType)(void);
+       static methodType expandableeditarea_expandableeditareap;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls18ExpandableEditAreaC2Ev, libosp-uifw.so, expandableeditarea_expandableeditareap);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "ExpandableEditArea");
+       probeBlockEnd();
+
+       (this->*expandableeditarea_expandableeditareap)();
+}
+
+ExpandableList::ExpandableList(void)
+{
+       typedef void (ExpandableList::*methodType)(void);
+       static methodType expandablelist_expandablelistp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls14ExpandableListC2Ev, libosp-uifw.so, expandablelist_expandablelistp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "ExpandableList");
+       probeBlockEnd();
+
+       (this->*expandablelist_expandablelistp)();
+}
+
+Footer::Footer(void)
+{
+       typedef void (Footer::*methodType)(void);
+       static methodType footer_footerp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls6FooterC2Ev, libosp-uifw.so, footer_footerp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Footer");
+       probeBlockEnd();
+
+       (this->*footer_footerp)();
+}
+
+Gallery::Gallery(void)
+{
+       typedef void (Gallery::*methodType)(void);
+       static methodType gallery_galleryp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls7GalleryC2Ev, libosp-uifw.so, gallery_galleryp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Gallery");
+       probeBlockEnd();
+
+       (this->*gallery_galleryp)();
+}
+
+GroupedList::GroupedList(void)
+{
+       typedef void (GroupedList::*methodType)(void);
+       static methodType groupedlist_groupedlistp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls11GroupedListC2Ev, libosp-uifw.so, groupedlist_groupedlistp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "GroupedList");
+       probeBlockEnd();
+
+       (this->*groupedlist_groupedlistp)();
+}
+
+GroupedListView::GroupedListView(void)
+{
+       typedef void (GroupedListView::*methodType)(void);
+       static methodType groupedlistview_groupedlistviewp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls15GroupedListViewC2Ev, libosp-uifw.so, groupedlistview_groupedlistviewp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "GroupedListView");
+       probeBlockEnd();
+
+       (this->*groupedlistview_groupedlistviewp)();
+}
+
+Header::Header(void)
+{
+       typedef void (Header::*methodType)(void);
+       static methodType header_headerp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls6HeaderC2Ev, libosp-uifw.so, header_headerp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Header");
+       probeBlockEnd();
+
+       (this->*header_headerp)();
+}
+
+IconList::IconList(void)
+{
+       typedef void (IconList::*methodType)(void);
+       static methodType iconlist_iconlistp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls8IconListC2Ev, libosp-uifw.so, iconlist_iconlistp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "IconList");
+       probeBlockEnd();
+
+       (this->*iconlist_iconlistp)();
+}
+
+IconListView::IconListView(void)
+{
+       typedef void (IconListView::*methodType)(void);
+       static methodType iconlistview_iconlistviewp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls12IconListViewC2Ev, libosp-uifw.so, iconlistview_iconlistviewp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "IconListView");
+       probeBlockEnd();
+
+       (this->*iconlistview_iconlistviewp)();
+}
+
+Label::Label(void)
+{
+       typedef void (Label::*methodType)(void);
+       static methodType label_labelp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls5LabelC2Ev, libosp-uifw.so, label_labelp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Label");
+       probeBlockEnd();
+
+       (this->*label_labelp)();
+}
+
+List::List(void)
+{
+       typedef void (List::*methodType)(void);
+       static methodType list_listp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls4ListC2Ev, libosp-uifw.so, list_listp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "List");
+       probeBlockEnd();
+
+       (this->*list_listp)();
+}
+
+ListView::ListView(void)
+{
+       typedef void (ListView::*methodType)(void);
+       static methodType listview_listviewp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls8ListViewC2Ev, libosp-uifw.so, listview_listviewp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "ListView");
+       probeBlockEnd();
+
+       (this->*listview_listviewp)();
+}
+
+Progress::Progress(void)
+{
+       typedef void (Progress::*methodType)(void);
+       static methodType progress_progressp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls8ProgressC2Ev, libosp-uifw.so, progress_progressp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Progress");
+       probeBlockEnd();
+
+       (this->*progress_progressp)();
+}
+
+RadioGroup::RadioGroup(void)
+{
+       typedef void (RadioGroup::*methodType)(void);
+       static methodType radiogroup_radiogroupp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls10RadioGroupC2Ev, libosp-uifw.so, radiogroup_radiogroupp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "RadioGroup");
+       probeBlockEnd();
+
+       (this->*radiogroup_radiogroupp)();
+}
+
+SearchBar::SearchBar(void)
+{
+       typedef void (SearchBar::*methodType)(void);
+       static methodType searchbar_searchbarp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls9SearchBarC2Ev, libosp-uifw.so, searchbar_searchbarp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "SearchBar");
+       probeBlockEnd();
+
+       (this->*searchbar_searchbarp)();
+}
+
+SlidableGroupedList::SlidableGroupedList(void)
+{
+       typedef void (SlidableGroupedList::*methodType)(void);
+       static methodType slidablegroupedlist_slidablegroupedlistp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls19SlidableGroupedListC2Ev, libosp-uifw.so, slidablegroupedlist_slidablegroupedlistp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "SlidableGroupedList");
+       probeBlockEnd();
+
+       (this->*slidablegroupedlist_slidablegroupedlistp)();
+}
+
+SlidableList::SlidableList(void)
+{
+       typedef void (SlidableList::*methodType)(void);
+       static methodType slidablelist_slidablelistp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls12SlidableListC2Ev, libosp-uifw.so, slidablelist_slidablelistp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "SlidableList");
+       probeBlockEnd();
+
+       (this->*slidablelist_slidablelistp)();
+}
+
+Slider::Slider(void)
+{
+       typedef void (Slider::*methodType)(void);
+       static methodType slider_sliderp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls6SliderC2Ev, libosp-uifw.so, slider_sliderp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Slider");
+       probeBlockEnd();
+
+       (this->*slider_sliderp)();
+}
+
+SplitPanel::SplitPanel(void)
+{
+       typedef void (SplitPanel::*methodType)(void);
+       static methodType splitpanel_splitpanelp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls10SplitPanelC2Ev, libosp-uifw.so, splitpanel_splitpanelp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "SplitPanel");
+       probeBlockEnd();
+
+       (this->*splitpanel_splitpanelp)();
+}
+
+Tab::Tab(void)
+{
+       typedef void (Tab::*methodType)(void);
+       static methodType tab_tabp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls3TabC2Ev, libosp-uifw.so, tab_tabp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Tab");
+       probeBlockEnd();
+
+       (this->*tab_tabp)();
+}
+
+TabBar::TabBar(void)
+{
+       typedef void (TabBar::*methodType)(void);
+       static methodType tabbar_tabbarp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls6TabBarC2Ev, libosp-uifw.so, tabbar_tabbarp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TabBar");
+       probeBlockEnd();
+
+       (this->*tabbar_tabbarp)();
+}
+
+TextBox::TextBox(void)
+{
+       typedef void (TextBox::*methodType)(void);
+       static methodType textbox_textboxp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls7TextBoxC2Ev, libosp-uifw.so, textbox_textboxp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TextBox");
+       probeBlockEnd();
+
+       (this->*textbox_textboxp)();
+}
+
+Form::Form(void)
+{
+       typedef void (Form::*methodType)(void);
+       static methodType form_formp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls4FormC2Ev, libosp-uifw.so, form_formp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Form");
+       probeBlockEnd();
+
+       (this->*form_formp)();
+}
+
+GroupedTableView::GroupedTableView(void)
+{
+       typedef void (GroupedTableView::*methodType)(void);
+       static methodType groupedtableview_groupedtableviewp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls16GroupedTableViewC2Ev, libosp-uifw.so, groupedtableview_groupedtableviewp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "GroupedTableView");
+       probeBlockEnd();
+
+       (this->*groupedtableview_groupedtableviewp)();
+}
+
+Panel::Panel(void)
+{
+       typedef void (Panel::*methodType)(void);
+       static methodType panel_panelp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls5PanelC2Ev, libosp-uifw.so, panel_panelp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Panel");
+       probeBlockEnd();
+
+       (this->*panel_panelp)();
+}
+
+OverlayPanel::OverlayPanel(void)
+{
+       typedef void (OverlayPanel::*methodType)(void);
+       static methodType overlaypanel_overlaypanelp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls12OverlayPanelC2Ev, libosp-uifw.so, overlaypanel_overlaypanelp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "OverlayPanel");
+       probeBlockEnd();
+
+       (this->*overlaypanel_overlaypanelp)();
+}
+
+ScrollPanel::ScrollPanel(void)
+{
+       typedef void (ScrollPanel::*methodType)(void);
+       static methodType scrollpanel_scrollpanelp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls11ScrollPanelC2Ev, libosp-uifw.so, scrollpanel_scrollpanelp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "ScrollPanel");
+       probeBlockEnd();
+
+       (this->*scrollpanel_scrollpanelp)();
+}
+
+SectionTableView::SectionTableView(void)
+{
+       typedef void (SectionTableView::*methodType)(void);
+       static methodType sectiontableview_sectiontableviewp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls16SectionTableViewC2Ev, libosp-uifw.so, sectiontableview_sectiontableviewp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "SectionTableView");
+       probeBlockEnd();
+
+       (this->*sectiontableview_sectiontableviewp)();
+}
+
+TableView::TableView(void)
+{
+       typedef void (TableView::*methodType)(void);
+       static methodType tableview_tableviewp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls9TableViewC2Ev, libosp-uifw.so, tableview_tableviewp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TableView");
+       probeBlockEnd();
+
+       (this->*tableview_tableviewp)();
+}
+
+TableViewItemBase::TableViewItemBase(void)
+{
+       typedef void (TableViewItemBase::*methodType)(void);
+       static methodType tableviewitembase_tableviewitembasep;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls17TableViewItemBaseC2Ev, libosp-uifw.so, tableviewitembase_tableviewitembasep);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TableViewItemBase");
+       probeBlockEnd();
+
+       (this->*tableviewitembase_tableviewitembasep)();
+}
+
+TableViewContextItem::TableViewContextItem(void)
+{
+       typedef void (TableViewContextItem::*methodType)(void);
+       static methodType tableviewcontextitem_tableviewcontextitemp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls20TableViewContextItemC2Ev, libosp-uifw.so, tableviewcontextitem_tableviewcontextitemp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TableViewContextItem");
+       probeBlockEnd();
+
+       (this->*tableviewcontextitem_tableviewcontextitemp)();
+}
+
+TableViewGroupItem::TableViewGroupItem(void)
+{
+       typedef void (TableViewGroupItem::*methodType)(void);
+       static methodType tableviewgroupitem_tableviewgroupitemp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls18TableViewGroupItemC2Ev, libosp-uifw.so, tableviewgroupitem_tableviewgroupitemp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TableViewGroupItem");
+       probeBlockEnd();
+
+       (this->*tableviewgroupitem_tableviewgroupitemp)();
+}
+
+TableViewItem::TableViewItem(void)
+{
+       typedef void (TableViewItem::*methodType)(void);
+       static methodType tableviewitem_tableviewitemp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls13TableViewItemC2Ev, libosp-uifw.so, tableviewitem_tableviewitemp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TableViewItem");
+       probeBlockEnd();
+
+       (this->*tableviewitem_tableviewitemp)();
+}
+
+TableViewSimpleGroupItem::TableViewSimpleGroupItem(void)
+{
+       typedef void (TableViewSimpleGroupItem::*methodType)(void);
+       static methodType tableviewsimplegroupitem_tableviewsimplegroupitemp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls24TableViewSimpleGroupItemC2Ev, libosp-uifw.so, tableviewsimplegroupitem_tableviewsimplegroupitemp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TableViewSimpleGroupItem");
+       probeBlockEnd();
+
+       (this->*tableviewsimplegroupitem_tableviewsimplegroupitemp)();
+}
+
+TableViewSimpleItem::TableViewSimpleItem(void)
+{
+       typedef void (TableViewSimpleItem::*methodType)(void);
+       static methodType tableviewsimpleitem_tableviewsimpleitemp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls19TableViewSimpleItemC2Ev, libosp-uifw.so, tableviewsimpleitem_tableviewsimpleitemp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TableViewSimpleItem");
+       probeBlockEnd();
+
+       (this->*tableviewsimpleitem_tableviewsimpleitemp)();
+}
+
+ContextMenu::ContextMenu(void)
+{
+       typedef void (ContextMenu::*methodType)(void);
+       static methodType contextmenu_contextmenup;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls11ContextMenuC2Ev, libosp-uifw.so, contextmenu_contextmenup);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "ContextMenu");
+       probeBlockEnd();
+
+       (this->*contextmenu_contextmenup)();
+}
+
+DatePicker::DatePicker(void)
+{
+       typedef void (DatePicker::*methodType)(void);
+       static methodType datepicker_datepickerp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls10DatePickerC2Ev, libosp-uifw.so, datepicker_datepickerp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "DatePicker");
+       probeBlockEnd();
+
+       (this->*datepicker_datepickerp)();
+}
+
+DateTimePicker::DateTimePicker(void)
+{
+       typedef void (DateTimePicker::*methodType)(void);
+       static methodType datetimepicker_datetimepickerp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls14DateTimePickerC2Ev, libosp-uifw.so, datetimepicker_datetimepickerp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "DateTimePicker");
+       probeBlockEnd();
+
+       (this->*datetimepicker_datetimepickerp)();
+}
+
+Frame::Frame(void)
+{
+       typedef void (Frame::*methodType)(void);
+       static methodType frame_framep;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls5FrameC2Ev, libosp-uifw.so, frame_framep);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Frame");
+       probeBlockEnd();
+
+       (this->*frame_framep)();
+}
+
+Keypad::Keypad(void)
+{
+       typedef void (Keypad::*methodType)(void);
+       static methodType keypad_keypadp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls6KeypadC2Ev, libosp-uifw.so, keypad_keypadp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Keypad");
+       probeBlockEnd();
+
+       (this->*keypad_keypadp)();
+}
+
+MessageBox::MessageBox(void)
+{
+       typedef void (MessageBox::*methodType)(void);
+       static methodType messagebox_messageboxp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls10MessageBoxC2Ev, libosp-uifw.so, messagebox_messageboxp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "MessageBox");
+       probeBlockEnd();
+
+       (this->*messagebox_messageboxp)();
+}
+
+NotificationFrame::NotificationFrame(void)
+{
+       typedef void (NotificationFrame::*methodType)(void);
+       static methodType notificationframe_notificationframep;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls17NotificationFrameC2Ev, libosp-uifw.so, notificationframe_notificationframep);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "NotificationFrame");
+       probeBlockEnd();
+
+       (this->*notificationframe_notificationframep)();
+}
+
+OptionMenu::OptionMenu(void)
+{
+       typedef void (OptionMenu::*methodType)(void);
+       static methodType optionmenu_optionmenup;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls10OptionMenuC2Ev, libosp-uifw.so, optionmenu_optionmenup);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "OptionMenu");
+       probeBlockEnd();
+
+       (this->*optionmenu_optionmenup)();
+}
+
+Popup::Popup(void)
+{
+       typedef void (Popup::*methodType)(void);
+       static methodType popup_popupp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls5PopupC2Ev, libosp-uifw.so, popup_popupp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Popup");
+       probeBlockEnd();
+
+       (this->*popup_popupp)();
+}
+
+TimePicker::TimePicker(void)
+{
+       typedef void (TimePicker::*methodType)(void);
+       static methodType timepicker_timepickerp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls10TimePickerC2Ev, libosp-uifw.so, timepicker_timepickerp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "TimePicker");
+       probeBlockEnd();
+
+       (this->*timepicker_timepickerp)();
+}
+
+}              // end of namespace Tizen::Ui::Controls
+
+} }            // end of namespace Tizen::Ui
+
+
+namespace Tizen { namespace Web { namespace Controls {
+
+class Web
+{
+       Web(void);
+};
+
+Web::Web(void)
+{
+       typedef void (Web::*methodType)(void);
+       static methodType web_webp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen3Web8Controls3WebC2Ev, libosp-web.so, web_webp);
+
+       probeBlockStart();
+       add_object_hash_type((void*)this, "Web");
+       probeBlockEnd();
+
+       (this->*web_webp)();
+}
+
+} } }  // end of namespace Tizen::Web::Controls
diff --git a/probe_badaapi/osp_controls.cpp b/probe_badaapi/osp_controls.cpp
new file mode 100755 (executable)
index 0000000..8c19c0b
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <typeinfo>
+#include <FApp.h>
+#include <FUi.h>
+
+#include "daprobe.h"
+#include "dacollection.h"
+#include "dahelper.h"
+#include "osp_probe.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+
+#define APPEND_LOG_CONTROL_OSP(CONTROL)                                                                                                                \
+       do {                                                                                                                                                                    \
+               if(unlikely(CONTROL == NULL)) {                                                                                                         \
+                       log.length += sprintf(log.data + log.length, "`,`,`,");                                                 \
+               } else {                                                                                                                                                        \
+                       char *type = NULL, *name = NULL;                                                                                                \
+                       if(find_object_hash((void*)(CONTROL), &type, &name) == 1) {                                             \
+                               log.length += sprintf(log.data + log.length, "`,%s`,%s", type, name);           \
+                       } else {                                                                                                                                                \
+                               log.length += sprintf(log.data + log.length, "`,`,");                                           \
+                       }                                                                                                                                                               \
+                       log.length += sprintf(log.data + log.length, "`,%p",                                                    \
+                                       (void*)(CONTROL));                                                                                                              \
+               }                                                                                                                                                                       \
+       } while(0)
+
+extern IFrameAnimatorEventListener& GetFrameAnimatorEventListener();
+
+bool IsRegisteredFrameAnimatorEventListener = false;
+
+namespace Tizen { namespace App {
+
+result UiApp::AddFrame(const Tizen::Ui::Controls::Frame& frame)
+{
+       typedef result (UiApp::*methodType)(const Tizen::Ui::Controls::Frame& frame);
+       static methodType uiapp_addframep;
+       DECLARE_COMMON_VARIABLE;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App5UiApp8AddFrameERKNS_2Ui8Controls5FrameE, libosp-uifw.so, uiapp_addframep);
+
+       ret = (this->*uiapp_addframep)(frame);
+
+       probeBlockStart();
+       if(ret == E_SUCCESS)
+       {
+               Control* parent = NULL;
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               APPEND_LOG_BASIC_NAME(LC_UICREATE, "AddFrame");
+               APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
+
+               frame.IsInTouchMode();
+
+               APPEND_LOG_CONTROL_OSP(parent);
+               APPEND_LOG_CONTROL_OSP(&frame);
+               printLog(&log, MSG_LOG);
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
+result UiApp::RemoveFrame(const Tizen::Ui::Controls::Frame &frame)
+{
+       typedef result (UiApp::*methodType)(const Tizen::Ui::Controls::Frame& frame);
+       static methodType uiapp_removeframep;
+       DECLARE_COMMON_VARIABLE;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen3App5UiApp11RemoveFrameERKNS_2Ui8Controls5FrameE, libosp-uifw.so, uiapp_removeframep);
+
+       probeBlockStart();
+       Control* parent = NULL;
+       setProbePoint(&probeInfo);
+       INIT_LOG;
+       APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveFrame");
+       APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
+
+       frame.IsInTouchMode();
+
+       APPEND_LOG_CONTROL_OSP(parent);
+       APPEND_LOG_CONTROL_OSP(&frame);
+       probeBlockEnd();
+
+       ret = (this->*uiapp_removeframep)(frame);
+
+       probeBlockStart();
+       if(ret == E_SUCCESS)
+       {
+               printLog(&log, MSG_LOG);
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
+} }            // end of namespce Tizen::App
+
+
+namespace Tizen { namespace Ui {
+
+bool Control::IsInTouchMode(void) const
+{
+       typedef bool (Control::*methodType)(void) const;
+       static methodType control_isintouchmodep;
+
+       GET_REAL_FUNC_OSP(_ZNK5Tizen2Ui7Control13IsInTouchModeEv, libosp-uifw.so, control_isintouchmodep);
+
+       probeBlockStart();
+       add_object_hash_class((void*)(this), typeid(*this).name());
+       probeBlockEnd();
+
+       return (this->*control_isintouchmodep)();
+}
+
+void Control::SetName(const Tizen::Base::String &name)
+{
+       typedef void (Control::*methodType)(const Tizen::Base::String &name);
+       static methodType control_setnamep;
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui7Control7SetNameERKNS_4Base6StringE, libosp-uifw.so, control_setnamep);
+
+       (this->*control_setnamep)(name);
+
+       probeBlockStart();
+       Control* parent = NULL;
+       setProbePoint(&probeInfo);
+       INIT_LOG;
+       APPEND_LOG_BASIC_NAME(LC_UICREATE, "SetName");
+       APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
+
+       IsInTouchMode();
+
+       APPEND_LOG_CONTROL_OSP(this);
+       APPEND_LOG_CONTROL_OSP(parent);
+
+       printLog(&log, MSG_LOG);
+       probeBlockEnd();
+}
+
+result Container::AddControl(const Control &control)
+{
+       typedef result (Container::*methodType)(const Control &control);
+       static methodType container_addcontrolp;
+       DECLARE_COMMON_VARIABLE;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container10AddControlERKNS0_7ControlE, libosp-uifw.so, container_addcontrolp);
+
+       probeBlockStart();
+       if(unlikely(IsRegisteredFrameAnimatorEventListener == false))
+       {
+               char *type = NULL, *classname = NULL;
+               if(likely(find_object_hash((void*)this, &type, &classname) == 1))       // there is entry in object hash
+               {
+                       if(strcmp(type, "Frame") == 0)
+                       {
+                               FrameAnimator* fa = ((Frame*)this)->GetFrameAnimator();
+                               if(fa != NULL)
+                               {
+                                       fa->AddFrameAnimatorEventListener(GetFrameAnimatorEventListener());
+                                       IsRegisteredFrameAnimatorEventListener = true;
+                               }
+                               else    // frame is not yet constructed
+                               {
+                               }
+                       }
+               }
+       }
+       probeBlockEnd();
+
+       ret = (this->*container_addcontrolp)(control);
+
+       probeBlockStart();
+       if(ret == E_SUCCESS)
+       {
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               APPEND_LOG_BASIC_NAME(LC_UICREATE, "AddControl");
+               APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
+
+               IsInTouchMode();
+               control.IsInTouchMode();
+
+               APPEND_LOG_CONTROL_OSP(this);
+               APPEND_LOG_CONTROL_OSP(&control);
+
+               printLog(&log, MSG_LOG);
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
+result Container::RemoveControl(const Control &control)
+{
+       typedef result (Container::*methodType)(const Control &control);
+       static methodType container_removecontrolp;
+       DECLARE_COMMON_VARIABLE;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container13RemoveControlERKNS0_7ControlE, libosp-uifw.so, container_removecontrolp);
+
+       probeBlockStart();
+       setProbePoint(&probeInfo);
+       INIT_LOG;
+       APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveControl");
+       APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
+
+       control.IsInTouchMode();
+
+       APPEND_LOG_CONTROL_OSP(this);
+       APPEND_LOG_CONTROL_OSP(&control);
+       probeBlockEnd();
+
+       ret = (this->*container_removecontrolp)(control);
+
+       probeBlockStart();
+       if(ret == E_SUCCESS)
+       {
+               printLog(&log, MSG_LOG);
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
+result Container::RemoveControl(int index)
+{
+       typedef result (Container::*methodType)(int index);
+       static methodType container_removecontrolip;
+       DECLARE_COMMON_VARIABLE;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container13RemoveControlEi, libosp-uifw.so, container_removecontrolip);
+
+       probeBlockStart();
+       Control* pcontrol;
+       setProbePoint(&probeInfo);
+       INIT_LOG;
+       APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveControl");
+       APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
+
+       pcontrol = GetControl(index);
+       pcontrol->IsInTouchMode();
+
+       APPEND_LOG_CONTROL_OSP(this);
+       APPEND_LOG_CONTROL_OSP(pcontrol);
+       probeBlockEnd();
+
+       ret = (this->*container_removecontrolip)(index);
+
+       probeBlockStart();
+       if(ret == E_SUCCESS)
+       {
+               printLog(&log, MSG_LOG);
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
+void Container::RemoveAllControls(void)
+{
+       typedef void (Container::*methodType)(void);
+       static methodType container_removeallcontrolp;
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container17RemoveAllControlsEv, libosp-uifw.so, container_removeallcontrolp);
+
+       probeBlockStart();
+       Control* pcontrol = NULL;
+       setProbePoint(&probeInfo);
+       INIT_LOG;
+       APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveAllControl");
+       APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
+
+       APPEND_LOG_CONTROL_OSP(this);
+       APPEND_LOG_CONTROL_OSP(pcontrol);
+       printLog(&log, MSG_LOG);
+       probeBlockEnd();
+
+       (this->*container_removeallcontrolp)();
+}
+
+} }    // end of namespace Tizen::Ui
diff --git a/probe_event/da_event.c b/probe_event/da_event.c
new file mode 100755 (executable)
index 0000000..37e98b9
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <appfw/app.h>
+#include <runtime_info.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+#include <Ecore_X.h>
+
+#include "daprobe.h"
+#include "dahelper.h"
+#include "da_event.h"
+
+static int external_angle = 0;
+static int internal_angle = 0;
+static bool orientation_enabled = false;
+
+// ===================================================================
+// orientation related functions
+// ===================================================================
+
+static int convert_angle(int angle)
+{
+       int os = _OS_NONE;
+
+       switch(angle)
+       {
+       case 0:
+               os = _OS_PORTRAIT;
+               break;
+       case 90:
+               os = _OS_LANDSCAPE_REVERSE;
+               break;
+       case 180:
+               os = _OS_PORTRAIT_REVERSE;
+               break;
+       case 270:
+               os = _OS_LANDSCAPE;
+               break;
+       default:
+               break;
+       }
+
+       return os;
+}
+
+void on_orientation_changed(int angle, bool capi)
+{
+       DECLARE_COMMON_VARIABLE;
+       bool autoRotation = true;
+
+       probeBlockStart();
+
+       internal_angle = angle;
+       runtime_info_get_value_bool(
+                       RUNTIME_INFO_KEY_AUTO_ROTATION_ENABLED, &autoRotation);
+
+       if(autoRotation)        // rotation is not locked
+       {
+               external_angle = internal_angle;
+               setProbePoint(&probeInfo);
+
+               INIT_LOG;
+               APPEND_LOG_BASIC_NAME(LC_UIEVENT, "OrientationChanged");
+               APPEND_LOG_COMMON_NONE(0);
+               log.length += sprintf(log.data + log.length, "`,%d`,`,`,`,%d`,",
+                               _EVENT_ORIENTATION, convert_angle(external_angle));
+               printLog(&log, MSG_LOG);
+
+//             if(orientation_enabled)
+//             {
+                       SCREENSHOT_SET();
+//                     if(!capi)
+//                     {
+//                             SCREENSHOT_DONE();
+//                     }
+//             }
+       }
+       else { }        // do nothing
+
+       probeBlockEnd();
+}
+
+void orientationEnabled()
+{
+       orientation_enabled = true;
+}
+
+int getOrientation()
+{
+       return external_angle;
+}
+
+// ====================================================================
+// initialize and finalize event
+// ====================================================================
+
+int initialize_event()
+{
+       external_angle = internal_angle = app_get_device_orientation();
+       return 0;
+}
+
+int finalize_event()
+{
+       return 0;
+}
+
+
diff --git a/probe_event/da_event.h b/probe_event/da_event.h
new file mode 100755 (executable)
index 0000000..d59625d
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DA_EVENT_H__
+#define __DA_EVENT_H__
+
+#include "daprobe.h"
+
+/*******************************************************************
+ * Type definition
+ *******************************************************************/
+
+enum __event_type
+{
+       _EVENT_KEY = 1,
+       _EVENT_TOUCH = 2,
+       _EVENT_GESTURE = 3,
+       _EVENT_ORIENTATION = 4,
+       _EVENT_LISTENER = 5
+} EVENT_TYPE;
+
+enum __key_status
+{
+       _KEY_PRESSED = 0,
+       _KEY_RELEASED = 1
+} KEY_STATUS;
+
+enum __touch_status
+{
+       _TOUCH_PRESSED = 0,
+       _TOUCH_LONG_PRESSED = 1,
+       _TOUCH_RELEASED = 2,
+       _TOUCH_MOVED = 3,
+       _TOUCH_DOUBLE_PRESSED = 4,
+       _TOUCH_FOCUS_IN = 5,
+       _TOUCH_FOCUS_OUT = 6,
+       _TOUCH_CANCELED = 7
+} _TOUCH_STATUS;
+
+enum __gesture_type
+{
+       _GESTURE_FLICK = 0,
+       _GESTURE_LONGPRESS = 1,
+       _GESTURE_PANNING = 2,
+       _GESTURE_PINCH = 3,
+       _GESTURE_ROTATION = 4,
+       _GESTURE_TAP = 5,
+       _GESTURE_CUSTOM = 6
+} GESTURE_TYPE;
+
+enum _orientation_status
+{
+       _OS_NONE = 0,
+       _OS_PORTRAIT = 1,
+       _OS_LANDSCAPE = 2,
+       _OS_PORTRAIT_REVERSE = 3,
+       _OS_LANDSCAPE_REVERSE = 4
+} ORIENTATION_STATUS;
+
+
+/*******************************************************************
+ * macros for event probe
+ *
+ * log format:
+ *             SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,x`,y`,\n
+ *             callstack_start`,callstack`,callstack_end
+ *
+ *******************************************************************/
+
+#define DECLARE_VARIABLE_EVENT                 \
+       DECLARE_COMMON_VARIABLE;                        \
+       static unsigned int oldtime = 0;        \
+       int blockresult = 0
+
+#define PRE_PROBEBLOCK_BEGIN_EVENT(FUNCNAME, LIBNAME, EVENTTYPE)       \
+       GET_REAL_FUNC(FUNCNAME, LIBNAME);                                                               \
+       do {                                                                                                                    \
+               if(oldtime != timestamp && (EVENTTYPE != EVENT_TYPE_MOVE ||     \
+                       getTouchState() == EVENT_TYPE_DOWN ||                                   \
+                       getTouchState() == EVENT_TYPE_MOVE))                                    \
+               {                                                                                                                       \
+                       blockresult = 1;                                                                                \
+                       detectTouchEvent(EVENTTYPE);                                                    \
+                       PRE_UNCONDITIONAL_BLOCK_BEGIN()
+
+#define PRE_PROBEBLOCK_END_EVENT()                     \
+                       PRE_UNCONDITIONAL_BLOCK_END();  \
+               }                                                                       \
+       } while(0)
+
+#define BEFORE_ORIGINAL_EVENT(FUNCNAME, LIBNAME, EVENTTYPE)            \
+       DECLARE_VARIABLE_EVENT;                                                                         \
+       PRE_PROBEBLOCK_BEGIN_EVENT(FUNCNAME, LIBNAME, EVENTTYPE);       \
+       PRE_PROBEBLOCK_END_EVENT()
+
+#define AFTER_ORIGINAL_EVENT(EVENTTYPE, INPUTFORMAT, ...)              \
+       do {                                                                                                            \
+               if(blockresult == 1) {                                                                  \
+                       POST_UNCONDITIONAL_BLOCK_BEGIN(LC_UIEVENT);                     \
+                       APPEND_LOG_INPUT(INPUTFORMAT, __VA_ARGS__);                     \
+                       log.length += sprintf(log.data + log.length,            \
+                                       "`,`,`,`,1`,`,%d`,%d`,%d", x, y, EVENTTYPE);\
+                       APPEND_LOG_NULL_CALLSTACK();                                            \
+                       POST_UNCONDITIONAL_BLOCK_END();                                         \
+                       oldtime = timestamp;                                                            \
+               }                                                                                                               \
+       } while(0)
+
+
+#endif // __DA_EVENT_H__
diff --git a/probe_event/gesture.cpp b/probe_event/gesture.cpp
new file mode 100755 (executable)
index 0000000..9a2cf3d
--- /dev/null
@@ -0,0 +1,587 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "osp_probe.h"
+#include "dacollection.h"
+#include "da_event.h"
+#include "gesture.h"
+
+#define GESTURE_EVENT_LOG(_FUNCNAME, _GESTURETYPE, _X, _Y, _INFO1, _INFO2)             \
+       setProbePoint(&probeInfo);                                                                                                      \
+       INIT_LOG;                                                                                                                                       \
+       APPEND_LOG_BASIC_NAME(LC_UIEVENT, _FUNCNAME);                                                           \
+       APPEND_LOG_COMMON_NONE(0);                                                                                                      \
+       log.length += sprintf(log.data + log.length, "`,%d`,%d`,%d`,%d`,%d`,%d",        \
+                       _EVENT_GESTURE, _GESTURETYPE, _X, _Y, _INFO1, _INFO2);                          \
+       printLog(&log, MSG_LOG)
+
+GestureEventListener GestureEventListener::rInstance;
+
+GestureEventListener::GestureEventListener()
+{
+
+}
+
+GestureEventListener::~GestureEventListener()
+{
+
+}
+
+void GestureEventListener::OnCustomGestureCanceled (TouchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       GESTURE_EVENT_LOG("canceled", _GESTURE_CUSTOM, 0, 0, 0, 0);
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnCustomGestureChanged (TouchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       GESTURE_EVENT_LOG("changed", _GESTURE_CUSTOM, 0, 0, 0, 0);
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnCustomGestureFinished (TouchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       GESTURE_EVENT_LOG("finished", _GESTURE_CUSTOM, 0, 0, 0, 0);
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnCustomGestureStarted (TouchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       GESTURE_EVENT_LOG("started", _GESTURE_CUSTOM, 0, 0, 0, 0);
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnFlickGestureCanceled (TouchFlickGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int x = 0, y = 0, dur = 0;
+               FlickDirection direction = FLICK_DIRECTION_NONE;
+
+               gestureDetector.GetDistance(x, y);
+               dur = gestureDetector.GetDuration();
+               direction = gestureDetector.GetDirection();
+               GESTURE_EVENT_LOG("canceled", _GESTURE_FLICK, x, y, dur, (int)direction);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnFlickGestureDetected (TouchFlickGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int x = 0, y = 0, dur = 0;
+               FlickDirection direction = FLICK_DIRECTION_NONE;
+
+               gestureDetector.GetDistance(x, y);
+               dur = gestureDetector.GetDuration();
+               direction = gestureDetector.GetDirection();
+               GESTURE_EVENT_LOG("detected", _GESTURE_FLICK, x, y, dur, (int)direction);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnLongPressGestureCanceled (TouchLongPressGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int moveallow = 0, tcount = 0, dur = 0;
+
+               moveallow = gestureDetector.GetMoveAllowance();
+               dur = gestureDetector.GetDuration();
+               tcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("canceled", _GESTURE_LONGPRESS, moveallow, 0, dur, tcount);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnLongPressGestureDetected (TouchLongPressGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int moveallow = 0, tcount = 0, dur = 0;
+
+               moveallow = gestureDetector.GetMoveAllowance();
+               dur = gestureDetector.GetDuration();
+               tcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("detected", _GESTURE_LONGPRESS, moveallow, 0, dur, tcount);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPanningGestureCanceled (TouchPanningGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int tcount = 0;
+
+               tcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("canceled", _GESTURE_PANNING, 0, 0, 0, tcount);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPanningGestureChanged (TouchPanningGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int tcount = 0;
+
+               tcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("changed", _GESTURE_PANNING, 0, 0, 0, tcount);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPanningGestureFinished (TouchPanningGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int tcount = 0;
+
+               tcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("finished", _GESTURE_PANNING, 0, 0, 0, tcount);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPanningGestureStarted (TouchPanningGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int tcount = 0;
+
+               tcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("started", _GESTURE_PANNING, 0, 0, 0, tcount);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPinchGestureCanceled (TouchPinchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               Tizen::Graphics::Point point;
+               int scale = 0;
+
+               point = gestureDetector.GetCenterPoint();
+               scale = gestureDetector.GetScale();
+               GESTURE_EVENT_LOG("canceled", _GESTURE_PINCH, point.x, point.y, scale, 0);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPinchGestureChanged (TouchPinchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               Tizen::Graphics::Point point;
+               int scale = 0;
+
+               point = gestureDetector.GetCenterPoint();
+               scale = gestureDetector.GetScale();
+               GESTURE_EVENT_LOG("changed", _GESTURE_PINCH, point.x, point.y, scale, 0);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPinchGestureFinished (TouchPinchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               Tizen::Graphics::Point point;
+               int scale = 0;
+
+               point = gestureDetector.GetCenterPoint();
+               scale = gestureDetector.GetScale();
+               GESTURE_EVENT_LOG("finished", _GESTURE_PINCH, point.x, point.y, scale, 0);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnPinchGestureStarted (TouchPinchGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               Tizen::Graphics::Point point;
+               int scale = 0;
+
+               point = gestureDetector.GetCenterPoint();
+               scale = gestureDetector.GetScale();
+               GESTURE_EVENT_LOG("started", _GESTURE_PINCH, point.x, point.y, scale, 0);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnRotationGestureCanceled (TouchRotationGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int distance = 0;
+               float angle = 0.0f;
+
+               distance = gestureDetector.GetDistance();
+               angle = gestureDetector.GetAngle();
+               GESTURE_EVENT_LOG("canceled", _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle));
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnRotationGestureChanged (TouchRotationGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int distance = 0;
+               float angle = 0.0f;
+
+               distance = gestureDetector.GetDistance();
+               angle = gestureDetector.GetAngle();
+               GESTURE_EVENT_LOG("changed", _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle));
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnRotationGestureFinished (TouchRotationGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int distance = 0;
+               float angle = 0.0f;
+
+               distance = gestureDetector.GetDistance();
+               angle = gestureDetector.GetAngle();
+               GESTURE_EVENT_LOG("finished", _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle));
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnRotationGestureStarted (TouchRotationGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int distance = 0;
+               float angle = 0.0f;
+
+               distance = gestureDetector.GetDistance();
+               angle = gestureDetector.GetAngle();
+               GESTURE_EVENT_LOG("started", _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle));
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnTapGestureCanceled (TouchTapGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int move = 0, tapcount = 0, touchcount = 0, interval = 0;
+
+               move = gestureDetector.GetMoveAllowance();
+               tapcount = gestureDetector.GetTapCount();
+               interval = gestureDetector.GetTapInterval();
+               touchcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("canceled", _GESTURE_TAP, move, tapcount, interval, touchcount);
+       }
+       probeBlockEnd();
+}
+
+void GestureEventListener::OnTapGestureDetected (TouchTapGestureDetector &gestureDetector)
+{
+       DECLARE_COMMON_VARIABLE;
+
+       probeBlockStart();
+       {
+               int move = 0, tapcount = 0, touchcount = 0, interval = 0;
+
+               move = gestureDetector.GetMoveAllowance();
+               tapcount = gestureDetector.GetTapCount();
+               interval = gestureDetector.GetTapInterval();
+               touchcount = gestureDetector.GetTouchCount();
+               GESTURE_EVENT_LOG("detected", _GESTURE_TAP, move, tapcount, interval, touchcount);
+       }
+       probeBlockEnd();
+}
+
+GestureEventListener& GestureEventListener::GetInstance()
+{
+       return rInstance;
+}
+
+
+namespace Tizen { namespace Ui {
+
+result TouchFlickGestureDetector::AddFlickGestureEventListener(ITouchFlickGestureEventListener& listener)
+{
+       typedef result (TouchFlickGestureDetector::*methodType)(ITouchFlickGestureEventListener& listener);
+       static methodType addflickgestureeventlistenerp;
+       result iret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui25TouchFlickGestureDetector28AddFlickGestureEventListenerERNS0_31ITouchFlickGestureEventListenerE,
+                       libosp-uifw.so, addflickgestureeventlistenerp);
+
+       probeBlockStart();
+       GestureEventListener& mylistener = GestureEventListener::GetInstance();
+       if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
+       {
+               iret = (this->*addflickgestureeventlistenerp)(static_cast<ITouchFlickGestureEventListener&>(mylistener));
+               if(likely(iret == E_SUCCESS))
+               {
+                       // do nothing
+               }
+               else
+               {
+                       del_detector_hash(static_cast<void*>(this));
+               }
+       }
+       probeBlockEnd();
+
+       return (this->*addflickgestureeventlistenerp)(listener);
+}
+
+result TouchLongPressGestureDetector::AddLongPressGestureEventListener(ITouchLongPressGestureEventListener& listener)
+{
+       typedef result (TouchLongPressGestureDetector::*methodType)(ITouchLongPressGestureEventListener& listener);
+       static methodType addlongpressgestureeventlistenerp;
+       result iret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui29TouchLongPressGestureDetector32AddLongPressGestureEventListenerERNS0_35ITouchLongPressGestureEventListenerE,
+                       libosp-uifw.so, addlongpressgestureeventlistenerp);
+
+       probeBlockStart();
+       GestureEventListener& mylistener = GestureEventListener::GetInstance();
+       if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
+       {
+               iret = (this->*addlongpressgestureeventlistenerp)(static_cast<ITouchLongPressGestureEventListener&>(mylistener));
+               if(likely(iret == E_SUCCESS))
+               {
+                       // do nothing
+               }
+               else
+               {
+                       del_detector_hash(static_cast<void*>(this));
+               }
+       }
+       probeBlockEnd();
+
+       return (this->*addlongpressgestureeventlistenerp)(listener);
+}
+
+result TouchPanningGestureDetector::AddPanningGestureEventListener(ITouchPanningGestureEventListener& listener)
+{
+       typedef result (TouchPanningGestureDetector::*methodType)(ITouchPanningGestureEventListener& listener);
+       static methodType addpanninggestureeventlistenerp;
+       result iret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui27TouchPanningGestureDetector30AddPanningGestureEventListenerERNS0_33ITouchPanningGestureEventListenerE,
+                       libosp-uifw.so, addpanninggestureeventlistenerp);
+
+       probeBlockStart();
+       GestureEventListener& mylistener = GestureEventListener::GetInstance();
+       if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
+       {
+               iret = (this->*addpanninggestureeventlistenerp)(static_cast<ITouchPanningGestureEventListener&>(mylistener));
+               if(likely(iret == E_SUCCESS))
+               {
+                       // do nothing
+               }
+               else
+               {
+                       del_detector_hash(static_cast<void*>(this));
+               }
+       }
+       probeBlockEnd();
+
+       return (this->*addpanninggestureeventlistenerp)(listener);
+}
+
+result TouchPinchGestureDetector::AddPinchGestureEventListener(ITouchPinchGestureEventListener& listener)
+{
+       typedef result (TouchPinchGestureDetector::*methodType)(ITouchPinchGestureEventListener& listener);
+       static methodType addpinchgestureeventlistenerp;
+       result iret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui25TouchPinchGestureDetector28AddPinchGestureEventListenerERNS0_31ITouchPinchGestureEventListenerE,
+                       libosp-uifw.so, addpinchgestureeventlistenerp);
+
+       probeBlockStart();
+       GestureEventListener& mylistener = GestureEventListener::GetInstance();
+       if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
+       {
+               iret = (this->*addpinchgestureeventlistenerp)(static_cast<ITouchPinchGestureEventListener&>(mylistener));
+               if(likely(iret == E_SUCCESS))
+               {
+                       // do nothing
+               }
+               else
+               {
+                       del_detector_hash(static_cast<void*>(this));
+               }
+       }
+       probeBlockEnd();
+
+       return (this->*addpinchgestureeventlistenerp)(listener);
+}
+
+result TouchRotationGestureDetector::AddRotationGestureEventListener(ITouchRotationGestureEventListener& listener)
+{
+       typedef result (TouchRotationGestureDetector::*methodType)(ITouchRotationGestureEventListener& listener);
+       static methodType addrotationgestureeventlistenerp;
+       result iret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui28TouchRotationGestureDetector31AddRotationGestureEventListenerERNS0_34ITouchRotationGestureEventListenerE,
+                       libosp-uifw.so, addrotationgestureeventlistenerp);
+
+       probeBlockStart();
+       GestureEventListener& mylistener = GestureEventListener::GetInstance();
+       if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
+       {
+               iret = (this->*addrotationgestureeventlistenerp)(static_cast<ITouchRotationGestureEventListener&>(mylistener));
+               if(likely(iret == E_SUCCESS))
+               {
+                       // do nothing
+               }
+               else
+               {
+                       del_detector_hash(static_cast<void*>(this));
+               }
+       }
+       probeBlockEnd();
+
+       return (this->*addrotationgestureeventlistenerp)(listener);
+}
+
+result TouchTapGestureDetector::AddTapGestureEventListener(ITouchTapGestureEventListener& listener)
+{
+       typedef result (TouchTapGestureDetector::*methodType)(ITouchTapGestureEventListener& listener);
+       static methodType addtapgestureeventlistenerp;
+       result iret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui23TouchTapGestureDetector26AddTapGestureEventListenerERNS0_29ITouchTapGestureEventListenerE,
+                       libosp-uifw.so, addtapgestureeventlistenerp);
+
+       probeBlockStart();
+       GestureEventListener& mylistener = GestureEventListener::GetInstance();
+       if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
+       {
+               iret = (this->*addtapgestureeventlistenerp)(static_cast<ITouchTapGestureEventListener&>(mylistener));
+               if(likely(iret == E_SUCCESS))
+               {
+                       // do nothing
+               }
+               else
+               {
+                       del_detector_hash(static_cast<void*>(this));
+               }
+       }
+       probeBlockEnd();
+
+       return (this->*addtapgestureeventlistenerp)(listener);
+}
+
+result TouchGestureDetector::AddGestureEventListener(ITouchGestureEventListener& listener)
+{
+       typedef result (TouchGestureDetector::*methodType)(ITouchGestureEventListener& listener);
+       static methodType addgestureeventlistenerp;
+       result iret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui20TouchGestureDetector23AddGestureEventListenerERNS0_26ITouchGestureEventListenerE,
+                       libosp-uifw.so, addgestureeventlistenerp);
+
+       probeBlockStart();
+       GestureEventListener& mylistener = GestureEventListener::GetInstance();
+       if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
+       {
+               iret = (this->*addgestureeventlistenerp)(static_cast<ITouchGestureEventListener&>(mylistener));
+               if(likely(iret == E_SUCCESS))
+               {
+                       // do nothing
+               }
+               else
+               {
+                       del_detector_hash(static_cast<void*>(this));
+               }
+       }
+       probeBlockEnd();
+
+       return (this->*addgestureeventlistenerp)(listener);
+}
+
+
+} }    // end of namespace
+
+
+
diff --git a/probe_event/gesture.h b/probe_event/gesture.h
new file mode 100644 (file)
index 0000000..20fdea1
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef __GESTURE_H__
+#define __GESTURE_H__
+
+#include <FUi.h>
+
+using namespace Tizen::Ui;
+
+class GestureEventListener :
+               public ITouchCustomGestureEventListener,
+               public ITouchFlickGestureEventListener,
+               public ITouchLongPressGestureEventListener,
+               public ITouchPanningGestureEventListener,
+               public ITouchPinchGestureEventListener,
+               public ITouchRotationGestureEventListener,
+               public ITouchTapGestureEventListener
+{
+public:
+       GestureEventListener();
+       virtual ~GestureEventListener();
+
+       virtual void    OnCustomGestureStarted (TouchGestureDetector &gestureDetector);
+       virtual void    OnCustomGestureChanged (TouchGestureDetector &gestureDetector);
+       virtual void    OnCustomGestureFinished (TouchGestureDetector &gestureDetector);
+       virtual void    OnCustomGestureCanceled (TouchGestureDetector &gestureDetector);
+
+       virtual void    OnFlickGestureDetected (TouchFlickGestureDetector &gestureDetector);
+       virtual void    OnFlickGestureCanceled (TouchFlickGestureDetector &gestureDetector);
+
+       virtual void    OnLongPressGestureDetected (TouchLongPressGestureDetector &gestureDetector);
+       virtual void    OnLongPressGestureCanceled (TouchLongPressGestureDetector &gestureDetector);
+
+       virtual void    OnPanningGestureStarted (TouchPanningGestureDetector &gestureDetector);
+       virtual void    OnPanningGestureChanged (TouchPanningGestureDetector &gestureDetector);
+       virtual void    OnPanningGestureFinished (TouchPanningGestureDetector &gestureDetector);
+       virtual void    OnPanningGestureCanceled (TouchPanningGestureDetector &gestureDetector);
+
+       virtual void    OnPinchGestureStarted (TouchPinchGestureDetector &gestureDetector);
+       virtual void    OnPinchGestureChanged (TouchPinchGestureDetector &gestureDetector);
+       virtual void    OnPinchGestureFinished (TouchPinchGestureDetector &gestureDetector);
+       virtual void    OnPinchGestureCanceled (TouchPinchGestureDetector &gestureDetector);
+
+       virtual void    OnRotationGestureStarted (TouchRotationGestureDetector &gestureDetector);
+       virtual void    OnRotationGestureChanged (TouchRotationGestureDetector &gestureDetector);
+       virtual void    OnRotationGestureFinished (TouchRotationGestureDetector &gestureDetector);
+       virtual void    OnRotationGestureCanceled (TouchRotationGestureDetector &gestureDetector);
+
+       virtual void    OnTapGestureDetected (TouchTapGestureDetector &gestureDetector);
+       virtual void    OnTapGestureCanceled (TouchTapGestureDetector &gestureDetector);
+
+       static GestureEventListener& GetInstance(void);
+
+private:
+       static GestureEventListener rInstance;
+};
+
+#endif
diff --git a/probe_event/keytouch.c b/probe_event/keytouch.c
new file mode 100755 (executable)
index 0000000..0e403cf
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+//#include <stdio.h>
+//#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+
+//#include <fcntl.h>
+//#include <dlfcn.h>
+//#include <unistd.h>
+//#include <errno.h>
+#include <Eina.h>
+#include <Ecore_Input.h>
+#include <Evas.h>
+//#include <linux/input.h>
+
+#include "daprobe.h"
+#include "probeinfo.h"
+//#include "dautil.h"
+#include "da_event.h"
+
+bool touch_pressed = false;
+
+#define LIBECOREINPUT libecore_input_evas.so.1
+
+#define HW_EVENT_LOG(_EVENTTYPE, _DETAILTYPE, _X, _Y, _KEYCODE, _EXTRA)                        \
+       setProbePoint(&probeInfo);                                                                                                      \
+       INIT_LOG;                                                                                                                                       \
+       APPEND_LOG_BASIC(LC_UIEVENT);                                                                                           \
+       APPEND_LOG_COMMON_NONE(0);                                                                                                      \
+       log.length += sprintf(log.data + log.length, "`,%d`,%d`,%d`,%d`,%s`,%d",        \
+                       _EVENTTYPE, _DETAILTYPE, _X, _Y, _KEYCODE, _EXTRA);                                     \
+       printLog(&log, MSG_LOG)
+
+Eina_Bool ecore_event_evas_key_down(void *data, int type, void *event)
+{
+       static Eina_Bool (*ecore_event_evas_key_downp)(void *data, int type, void *event);
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC(ecore_event_evas_key_down, LIBECOREINPUT);
+
+       probeBlockStart();
+       if(event != NULL)
+       {
+               Ecore_Event_Key* pEv = (Ecore_Event_Key*)event;
+               if(strcasestr(pEv->keyname, "volume") == NULL)
+               {
+                       HW_EVENT_LOG(_EVENT_KEY, _KEY_PRESSED, 0, 0, pEv->keyname, 0);
+               }
+       }
+       probeBlockEnd();
+
+       return ecore_event_evas_key_downp(data, type, event);
+}
+
+Eina_Bool ecore_event_evas_key_up(void *data, int type, void *event)
+{
+       static Eina_Bool (*ecore_event_evas_key_upp)(void *data, int type, void *event);
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC(ecore_event_evas_key_up, LIBECOREINPUT);
+
+       probeBlockStart();
+       if(event != NULL)
+       {
+               Ecore_Event_Key* pEv = (Ecore_Event_Key*)event;
+               if(strcasestr(pEv->keyname, "volume") == NULL) 
+               {
+                       HW_EVENT_LOG(_EVENT_KEY, _KEY_RELEASED, 0, 0, pEv->keyname, 0);
+               }
+       }
+       probeBlockEnd();
+
+       return ecore_event_evas_key_upp(data, type, event);
+}
+
+Eina_Bool ecore_event_evas_mouse_button_down(void *data, int type, void *event)
+{
+       static Eina_Bool (*ecore_event_evas_mouse_button_downp)(void *data, int type, void *event);
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC(ecore_event_evas_mouse_button_down, LIBECOREINPUT);
+
+       probeBlockStart();
+       if(event != NULL)
+       {
+               Ecore_Event_Mouse_Button* pEv = (Ecore_Event_Mouse_Button*)event;
+               touch_pressed = true;
+               HW_EVENT_LOG(_EVENT_TOUCH, _TOUCH_PRESSED, pEv->root.x, pEv->root.y, "", pEv->multi.device);
+       }
+       probeBlockEnd();
+
+       return ecore_event_evas_mouse_button_downp(data, type, event);
+}
+
+Eina_Bool ecore_event_evas_mouse_button_up(void *data, int type, void *event)
+{
+       static Eina_Bool (*ecore_event_evas_mouse_button_upp)(void *data, int type, void *event);
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC(ecore_event_evas_mouse_button_up, LIBECOREINPUT);
+
+       probeBlockStart();
+       if(event != NULL)
+       {
+               Ecore_Event_Mouse_Button* pEv = (Ecore_Event_Mouse_Button*)event;
+               touch_pressed = false;
+               HW_EVENT_LOG(_EVENT_TOUCH, _TOUCH_RELEASED, pEv->root.x, pEv->root.y, "", pEv->multi.device);
+       }
+       probeBlockEnd();
+
+       return ecore_event_evas_mouse_button_upp(data, type, event);
+}
+
+Eina_Bool ecore_event_evas_mouse_move(void *data, int type, void *event)
+{
+       static Eina_Bool (*ecore_event_evas_mouse_movep)(void *data, int type, void *event);
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC(ecore_event_evas_mouse_move, LIBECOREINPUT);
+
+       probeBlockStart();
+       if(touch_pressed)
+       {
+               if(event != NULL)
+               {
+                       Ecore_Event_Mouse_Move* pEv = (Ecore_Event_Mouse_Move*)event;
+                       HW_EVENT_LOG(_EVENT_TOUCH, _TOUCH_MOVED, pEv->root.x, pEv->root.y, "", pEv->multi.device);
+               }
+       }
+       probeBlockEnd();
+
+       return ecore_event_evas_mouse_movep(data, type, event);
+}
+
+
+/*
+void evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags,
+               unsigned int timestamp, const void *data)
+{
+       static void (*evas_event_feed_mouse_downp)(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
+
+       DECLARE_COMMON_VARIABLE;
+
+       GET_REAL_FUNC(evas_event_feed_mouse_down, LIBEVAS);
+
+       PRE_UNCONDITIONAL_BLOCK_BEGIN();
+       HW_EVENT_LOG(_EVENT_TOUCH, _TOUCH_PRESSED, )
+       PRE_UNCONDITIONAL_BLOCK_END();
+
+       
+       DECLARE_VARIABLE_EVENT;
+       int x, y;
+       
+       PRE_PROBEBLOCK_BEGIN_EVENT(evas_event_feed_mouse_down, LIBEVAS, EVENT_TYPE_DOWN);
+               evas_pointer_output_xy_get(e, &x, &y);
+       PRE_PROBEBLOCK_END_EVENT();     
+       
+       evas_event_feed_mouse_downp(e, b, flags, timestamp, data);
+       
+       AFTER_ORIGINAL_EVENT(EVENT_TYPE_DOWN, "%d", b);
+}                      
+
+void evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags,
+               unsigned int timestamp, const void *data)
+{
+       static void (*evas_event_feed_mouse_upp)(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
+       
+       DECLARE_VARIABLE_EVENT;
+       int x, y;
+       
+       PRE_PROBEBLOCK_BEGIN_EVENT(evas_event_feed_mouse_up, LIBEVAS, EVENT_TYPE_UP);
+               evas_pointer_output_xy_get(e, &x, &y);
+       PRE_PROBEBLOCK_END_EVENT();     
+       
+       evas_event_feed_mouse_upp(e, b, flags, timestamp, data);
+       
+       AFTER_ORIGINAL_EVENT(EVENT_TYPE_UP, "%d", b);
+}
+
+void evas_event_feed_mouse_move(Evas *e, int x, int y,
+               unsigned int timestamp, const void *data)
+{
+       static void (*evas_event_feed_mouse_movep)(Evas *e, int x, int y, unsigned int timestamp, const void *data);
+       
+       BEFORE_ORIGINAL_EVENT(evas_event_feed_mouse_move, LIBEVAS, EVENT_TYPE_MOVE);
+       
+       evas_event_feed_mouse_movep(e, x, y, timestamp, data);
+       
+       AFTER_ORIGINAL_EVENT(EVENT_TYPE_MOVE, "%u", timestamp);
+}
+
+void evas_event_feed_multi_down(Evas *e, int d, int x, int y,
+               double rad, double radx, double rady,
+               double pres, double ang, double fx, double fy,
+               Evas_Button_Flags flags, unsigned int timestamp, const void *data)
+{
+       static void (*evas_event_feed_multi_downp)(Evas *e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
+
+       BEFORE_ORIGINAL_EVENT(evas_event_feed_multi_down, LIBEVAS, EVENT_TYPE_DOWN);
+       
+       evas_event_feed_multi_downp(e, d, x, y, rad, radx,
+                       rady, pres, ang, fx, fy, flags, timestamp, data);
+               
+       AFTER_ORIGINAL_EVENT(EVENT_TYPE_DOWN, "%d", d);
+}
+
+void evas_event_feed_multi_up(Evas *e, int d, int x, int y, double rad, double radx,
+               double rady, double pres, double ang, double fx, double fy,
+               Evas_Button_Flags flags, unsigned int timestamp, const void *data)
+{
+       static void (*evas_event_feed_multi_upp)(Evas *e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data);
+
+       BEFORE_ORIGINAL_EVENT(evas_event_feed_multi_up, LIBEVAS, EVENT_TYPE_UP);
+       
+       evas_event_feed_multi_upp(e, d, x, y, rad, radx, rady,
+                       pres, ang, fx, fy, flags, timestamp, data);
+                       
+       AFTER_ORIGINAL_EVENT(EVENT_TYPE_UP, "%d", d);
+}
+
+void evas_event_feed_multi_move (Evas *e, int d, int x, int y, double rad, double radx,
+               double rady, double pres, double ang, double fx, double fy,
+               unsigned int timestamp, const void *data)
+{
+       static void (*evas_event_feed_multi_movep)(Evas *e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, unsigned int timestamp, const void *data);
+
+       BEFORE_ORIGINAL_EVENT(evas_event_feed_multi_move, LIBEVAS, EVENT_TYPE_MOVE);
+       
+       evas_event_feed_multi_movep(e, d, x, y, rad, radx, rady,
+                       pres, ang, fx, fy, timestamp, data);
+                       
+       AFTER_ORIGINAL_EVENT(EVENT_TYPE_MOVE, "%d", d);
+}
+*/
diff --git a/probe_file/da_io.h b/probe_file/da_io.h
new file mode 100755 (executable)
index 0000000..a6ce09e
--- /dev/null
@@ -0,0 +1,147 @@
+/*\r
+ *  DA probe\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: \r
+ *\r
+ * Jaewon Lim <jaewon81.lim@samsung.com>\r
+ * Woojin Jung <woojin2.jung@samsung.com>\r
+ * Juyoung Kim <j0.kim@samsung.com>\r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the\r
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+ * License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ * \r
+ */\r
+\r
+#ifndef __DA_IO_H__\r
+#define __DA_IO_H__\r
+\r
+#include <stdio.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+#include <unistd.h>\r
+\r
+#include "daprobe.h"\r
+\r
+/********************************************************************\r
+ * RESOURCE PROBE MACRO\r
+ *\r
+ * log format\r
+ *             SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,\r
+ *             Size`,FDValue`,FDType`,FDApiType`,\n\r
+ *             callstack_start`,callstack`,callstack_end\r
+ *\r
+ * fd type\r
+ *             FD_TYPE_FILE, FD_TYPE_SOCKET\r
+ *\r
+ * fd api type\r
+ *             FD_API_TYPE_OPEN, FD_API_TYPE_CLOSE, FD_API_TYPE_READ, FD_API_TYPE_WRITE,\r
+ *             FD_API_TYPE_DIRECTORY, FD_API_TYPE_PERMISSION, FD_API_TYPE_OTHER,\r
+ *             FD_API_TYPE_SEND, FD_API_TYPE_RECEIVE, FD_API_TYPE_OPTION, FD_API_TYPE_MANAGE\r
+ *\r
+ ************************************************************************/\r
+\r
+// ===================================================================\r
+// macro for file probe\r
+// ===================================================================\r
+\r
+#define GET_FD_FROM_FILEP(FILEP)       \\r
+       _fd = (FILEP != NULL) ? fileno(FILEP) : -1\r
+\r
+#define DECLARE_VARIABLE_FD                                                    \\r
+               DECLARE_VARIABLE_STANDARD;                                      \\r
+               char* _filepath = "";                                           \\r
+               int __attribute((unused)) _fd;                          \\r
+               int __attribute((unused)) _fstatret = -1;       \\r
+               struct stat __attribute((unused)) _statbuf\r
+\r
+// =================================================================\r
+// POST_PROBEBLOCK_MIDDLE for file\r
+// =================================================================\r
+\r
+#define POST_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE)                                                   \\r
+       log.length += sprintf(log.data + log.length, "`,%u`,%d`,%d`,%d`,%ld`,%s",       \\r
+                       SIZE, FD, FD_FILE, APITYPE, (_fstatret == 0 ? _statbuf.st_size : 0), _filepath)\r
+\r
+#define POST_PROBEBLOCK_MIDDLE_NOFD(SIZE, APITYPE)                                                     \\r
+       log.length += sprintf(log.data + log.length, "`,%u`,`,%d`,%d`,0`,%s",   \\r
+                       SIZE, FD_FILE, APITYPE, _filepath)\r
+\r
+#define POST_PROBEBLOCK_CALLSTACK_RESOURCE(APITYPE)                                    \\r
+       do {                                                                                                                    \\r
+               if(APITYPE == FD_API_OPEN) {                                                            \\r
+                       APPEND_LOG_CALLSTACK();                                                                 \\r
+               } else if(unlikely(newerrno != 0 || blockresult == 2)) {        \\r
+                       APPEND_LOG_CALLSTACK();                                                                 \\r
+               } else {                                                                                                        \\r
+                       APPEND_LOG_NULL_CALLSTACK();                                                    \\r
+               }                                                                                                                       \\r
+       } while(0)\r
+\r
+// ==================================================================\r
+// BEFORE_ORIGINAL macro for file\r
+// ==================================================================\r
+\r
+#define BEFORE_ORIGINAL_FILE(FUNCNAME, LIBNAME)        \\r
+       DECLARE_VARIABLE_FD;                                            \\r
+       GET_REAL_FUNC(FUNCNAME, LIBNAME);                       \\r
+       PRE_PROBEBLOCK()\r
+\r
+#define BEFORE_ORIGINAL_FILE_NOFILTER(FUNCNAME, LIBNAME)       \\r
+       DECLARE_VARIABLE_FD;                                                                    \\r
+       GET_REAL_FUNC(FUNCNAME, LIBNAME);                                               \\r
+       bfiltering = false;                                                                             \\r
+       PRE_PROBEBLOCK()\r
+\r
+// ==================================================================\r
+// AFTER_ORIGINAL macro for file\r
+// ==================================================================\r
+\r
+#define AFTER_ORIGINAL_FD_RET(RTYPE, RVAL, SIZE, FD, APITYPE, INPUTFORMAT, ...)        \\r
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);      \\r
+       _fstatret = fstat(FD, &_statbuf);                                                                                       \\r
+       POST_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE);                                                           \\r
+       POST_PROBEBLOCK_CALLSTACK_RESOURCE(APITYPE);                                                            \\r
+       POST_PROBEBLOCK_END()\r
+\r
+#define AFTER_ORIGINAL_NOFD_RET(RTYPE, RVAL, SIZE, APITYPE, INPUTFORMAT, ...)  \\r
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);      \\r
+       POST_PROBEBLOCK_MIDDLE_NOFD(SIZE, APITYPE);                                                                     \\r
+       POST_PROBEBLOCK_CALLSTACK_RESOURCE(APITYPE);                                                            \\r
+       POST_PROBEBLOCK_END()\r
+\r
+#define AFTER_ORIGINAL_FILEP_RET(RTYPE, RVAL, SIZE, FILEP, APITYPE, INPUTFORMAT, ...)  \\r
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);                      \\r
+       GET_FD_FROM_FILEP(FILEP);                                                                                                                       \\r
+       _fstatret = fstat(_fd, &_statbuf);                                                                                                      \\r
+       if(_fstatret != 0) PRINTMSG("ERROR : fstat error");                                                                     \\r
+       POST_PROBEBLOCK_MIDDLE_FD(SIZE, _fd, APITYPE);                                                                          \\r
+       POST_PROBEBLOCK_CALLSTACK_RESOURCE(APITYPE);                                                                            \\r
+       POST_PROBEBLOCK_END()\r
+\r
+\r
+#define AFTER_ORIGINAL_FD(SIZE, FD, APITYPE, INPUTFORMAT, ...)                 \\r
+       AFTER_ORIGINAL_FD_RET(VT_INT, ret, SIZE, FD, APITYPE, INPUTFORMAT, __VA_ARGS__)\r
+\r
+#define AFTER_ORIGINAL_NOFD(SIZE, APITYPE, INPUTFORMAT, ...)                   \\r
+       AFTER_ORIGINAL_NOFD_RET(VT_INT, ret, SIZE, APITYPE, INPUTFORMAT, __VA_ARGS__)\r
+\r
+#define AFTER_ORIGINAL_FILEP(SIZE, FILEP, APITYPE, INPUTFORMAT, ...)   \\r
+       AFTER_ORIGINAL_FILEP_RET(VT_INT, ret, SIZE, FILEP, APITYPE, INPUTFORMAT, __VA_ARGS__)\r
+\r
+#endif // __DA_IO_H__\r
diff --git a/probe_file/da_io_posix.c b/probe_file/da_io_posix.c
new file mode 100755 (executable)
index 0000000..8eb39b5
--- /dev/null
@@ -0,0 +1,874 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <dlfcn.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dautil.h"
+#include "da_io.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <utime.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <sys/uio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+int open(const char* path, int oflag, ...)
+{
+       static int (*openp)(const char* path, int oflag, ...);
+       int mode = 0;
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(open, libc.so.6);
+       _filepath = (char*)path;
+
+       if(oflag & O_CREAT)
+       {
+               va_list arg;
+               va_start(arg, oflag);
+               mode = va_arg(arg, int);
+               va_end(arg);
+       }
+
+       ret = openp(path, oflag, mode);
+
+       AFTER_ORIGINAL_FD(0, ret, FD_API_OPEN, "%s, %d, %d", path, oflag, mode);
+
+       return ret;
+}
+
+int openat(int fd, const char* path, int oflag, ...)
+{
+       static int (*openatp)(int fd, const char* path, int oflag, ...);
+       int mode = 0;
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(openat, libc.so.6);
+       _filepath = (char*)path;
+
+       if(oflag & O_CREAT)
+       {
+               va_list arg;
+               va_start(arg, oflag);
+               mode = va_arg(arg, int);
+               va_end(arg);
+       }
+
+       ret = openatp(fd, path, oflag, mode);
+
+       AFTER_ORIGINAL_FD(0, ret, FD_API_OPEN, "%d, %s, %d, %d", fd, path, oflag, mode);
+
+       return ret;
+}
+
+int creat(const char* path, mode_t mode)
+{
+       static int (*creatp)(const char* path, mode_t mode);
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(creat, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = creatp(path, mode);
+
+       AFTER_ORIGINAL_FD(0, ret, FD_API_OPEN, "%s, %d", path, mode);
+
+       return ret;
+}
+
+int close(int fd)
+{
+       static int (*closep)(int fd);
+       DECLARE_VARIABLE_FD;
+
+       GET_REAL_FUNC(close, libc.so.6);
+
+       bfiltering = false;
+       PRE_PROBEBLOCK_BEGIN();
+       _fstatret = fstat(fd, &_statbuf);
+       PRE_PROBEBLOCK_END();
+
+       ret = closep(fd);
+
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, VT_INT, ret, "%d", fd);
+       POST_PROBEBLOCK_MIDDLE_FD(0, fd, FD_API_CLOSE);
+       POST_PROBEBLOCK_CALLSTACK_RESOURCE(FD_API_CLOSE);
+       POST_PROBEBLOCK_END();
+
+       return ret;
+}
+
+int access(const char *path, int amode)
+{
+       static int (*accessp)(const char *path, int amode);
+
+       BEFORE_ORIGINAL_FILE(access, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = accessp(path, amode);
+
+       AFTER_ORIGINAL_NOFD(0, FD_API_PERMISSION, "%s, %d", path, amode);
+
+       return ret;
+}
+
+int faccessat(int fd, const char *path, int amode, int flag)
+{
+       static int (*faccessatp)(int fd, const char *path, int amode, int flag);
+
+       BEFORE_ORIGINAL_FILE(faccessat, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = faccessatp(fd, path, amode, flag);
+
+       AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION,
+                       "%d, %s, %d, %d", fd, path, amode, flag);
+
+       return ret;
+}
+
+off_t lseek(int fd, off_t offset, int whence)
+{
+       static int (*lseekp)(int fd, off_t offset, int whence);
+       off_t offret;
+
+       BEFORE_ORIGINAL_FILE(lseek, libc.so.6);
+
+       offret = lseekp(fd, offset, whence);
+
+       AFTER_ORIGINAL_FD_RET(VT_OFF_T, offret, (unsigned int)offset, fd, FD_API_OTHER,
+                       "%d, %ld, %d", fd, offset, whence);
+
+       return offret;
+}
+
+int fsync(int fd)
+{
+       static int (*fsyncp)(int fd);
+
+       BEFORE_ORIGINAL_FILE(fsync, libc.so.6);
+
+       ret = fsyncp(fd);
+
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d", fd);
+
+       return ret;
+}
+
+int fdatasync(int fd)
+{
+       static int (*fdatasyncp)(int fd);
+
+       BEFORE_ORIGINAL_FILE(fdatasync, libc.so.6);
+
+       ret = fdatasyncp(fd);
+
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d", fd);
+
+       return ret;
+}
+
+int truncate(const char *path, off_t length)
+{
+       static int (*truncatep)(const char *path, off_t length);
+
+       BEFORE_ORIGINAL_FILE(truncate, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = truncatep(path, length);
+
+       AFTER_ORIGINAL_NOFD((unsigned int)length, FD_API_DIRECTORY,
+                       "%s, %ld", path, length);
+
+       return ret;
+}
+
+int ftruncate(int fd, off_t length)
+{
+       static int (*ftruncatep)(int fd, off_t length);
+
+       BEFORE_ORIGINAL_FILE(ftruncate, libc.so.6);
+
+       ret = ftruncatep(fd, length);
+
+       AFTER_ORIGINAL_FD((unsigned int)length, fd, FD_API_DIRECTORY,
+                       "%d, %ld", fd, length);
+
+       return ret;
+}
+
+#if 1
+//not return FD, only make file
+int mkfifo(const char *path, mode_t mode)
+{
+       static int (*mkfifop)(const char *path, mode_t mode);
+
+       BEFORE_ORIGINAL_FILE(mkfifo, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = mkfifop(path, mode);
+
+       AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %u", path, mode);
+
+       return ret;
+}
+
+int mkfifoat(int fd, const char *path, mode_t mode)
+{
+       static int (*mkfifoatp)(int fd, const char *path, mode_t mode);
+
+       BEFORE_ORIGINAL_FILE(mkfifoat, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = mkfifoatp(fd, path, mode);
+
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER,
+                       "%d, %s, %u", fd, path, mode);
+
+       return ret;
+}
+
+int mknod(const char *path, mode_t mode, dev_t dev)
+{
+       static int (*mknodp)(const char *path, mode_t mode, dev_t dev);
+
+       BEFORE_ORIGINAL_FILE(mknod, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = mknodp(path, mode, dev);
+
+       AFTER_ORIGINAL_NOFD(0, FD_API_OTHER,
+                       "%s, %u, %lu", path, mode, (unsigned long int)dev);
+
+       return ret;
+}
+
+int mknodat(int fd, const char *path, mode_t mode, dev_t dev)
+{
+       static int (*mknodatp)(int fd, const char *path, mode_t mode, dev_t dev);
+
+       BEFORE_ORIGINAL_FILE(mknodat, libc.so.6);
+       _filepath = (char*)path;
+
+       ret = mknodatp(fd,path, mode,dev);
+
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER,
+                       "%d, %s, %u, %lu", fd, path, mode, (unsigned long int)dev);
+
+       return ret;
+}
+#endif
+
+// ****************************************************************
+// File Permission APIs
+// ****************************************************************
+int chown(const char *path, uid_t owner, gid_t group)
+{
+       static int (*chownp)(const char *path, uid_t owner, gid_t group);
+
+       BEFORE_ORIGINAL_FILE(chown, libc.so.6);
+       _filepath = (char*)path;
+       ret = chownp(path, owner, group);
+       AFTER_ORIGINAL_NOFD(0, FD_API_PERMISSION, "%s, %u, %u", path, owner, group);
+       return ret;
+}
+
+int fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag)
+{
+       static int (*fchownatp)(int fd, const char *path, uid_t owner, gid_t group, int flag);
+
+       BEFORE_ORIGINAL_FILE(fchownat, libc.so.6);
+       _filepath = (char*)path;
+       ret = fchownatp(fd, path, owner, group, flag);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION,
+                       "%d, %s, %u, %u, %d", fd, path, owner, group, flag);
+       return ret;
+}
+
+int fchown(int fd, uid_t owner, gid_t group)
+{
+       static int (*fchownp)(int fd, uid_t owner, gid_t group);
+
+       BEFORE_ORIGINAL_FILE(fchown, libc.so.6);
+       ret = fchownp(fd, owner, group);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION, "%d, %u, %u", fd, owner, group);
+       return ret;
+}
+
+int lchown(const char *path, uid_t owner, gid_t group)
+{
+       static int (*lchownp)(const char *path, uid_t owner, gid_t group);
+
+       BEFORE_ORIGINAL_FILE(lchown, libc.so.6);
+       _filepath = (char*)path;
+       ret = lchownp(path, owner, group);
+       AFTER_ORIGINAL_NOFD(0, FD_API_PERMISSION, "%s, %u, %u", path, owner, group);
+       return ret;
+}
+
+int lockf(int fd, int function, off_t size)
+{
+       static int (*lockfp)(int fd, int function, off_t size);
+
+       BEFORE_ORIGINAL_FILE(lockf, libc.so.6);
+       ret = lockfp(fd, function, size);
+       AFTER_ORIGINAL_FD((unsigned int)size, fd, FD_API_PERMISSION,
+                       "%d, %d, %ld", fd, function, size);
+       return ret;
+}
+
+int chmod(const char *path, mode_t mode)
+{
+       static int (*chmodp)(const char *path, mode_t mode);
+
+       BEFORE_ORIGINAL_FILE(chmod, libc.so.6);
+       _filepath = (char*)path;
+       ret = chmodp(path, mode);
+       AFTER_ORIGINAL_NOFD(0, FD_API_PERMISSION, "%s, %u", path, mode);
+       return ret;
+}
+
+int fchmodat(int fd, const char *path, mode_t mode, int flag)
+{
+       static int (*fchmodatp)(int fd, const char *path, mode_t mode, int flag);
+
+       BEFORE_ORIGINAL_FILE(fchmodat, libc.so.6);
+       _filepath = (char*)path;
+       ret = fchmodatp(fd, path, mode, flag);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION,
+                       "%d, %s, %u, %d", fd, path, mode, flag);
+       return ret;
+}
+
+int fchmod(int fd, mode_t mode)
+{
+       static int (*fchmodp)(int fd, mode_t mode);
+
+       BEFORE_ORIGINAL_FILE(fchmod, libc.so.6);
+       ret = fchmodp(fd, mode);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION, "%d, %u", fd, mode);
+       return ret;
+}
+
+// *****************************************************************
+// Read / Write APIs
+// *****************************************************************
+
+ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset)
+{
+       static ssize_t (*preadp)(int fd, void *buf, size_t nbyte, off_t offset);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL_FILE(pread, libc.so.6);
+
+       sret = preadp(fd, buf, nbyte, offset);
+
+       AFTER_ORIGINAL_FD_RET(VT_SSIZE_T, sret, (unsigned int)sret, fd, FD_API_READ,
+                       "%d, %p, %u, %ld", fd, buf, nbyte, offset);
+
+       return sret;
+}
+ssize_t read(int fd, void *buf, size_t nbyte)
+{
+       static ssize_t (*readp)(int fildes, void *buf, size_t nbyte);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL_FILE(read, libc.so.6);
+
+       sret = readp(fd, buf, nbyte);
+
+       AFTER_ORIGINAL_FD_RET(VT_SSIZE_T, sret, (unsigned int)sret, fd, FD_API_READ,
+                       "%d, %p, %u", fd, buf, nbyte);
+
+       return sret;
+}
+
+ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
+{
+       static ssize_t (*pwritep)(int fd, const void *buf, size_t nbyte, off_t offset);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL_FILE(pwrite, libc.so.6);
+
+       sret = pwritep(fd, buf, nbyte, offset);
+
+       AFTER_ORIGINAL_FD_RET(VT_SSIZE_T, sret, (unsigned int)sret, fd, FD_API_WRITE,
+                       "%d, %p, %u, %ld", fd, buf, nbyte, offset);
+
+       return sret;
+}
+
+ssize_t write(int fd, const void *buf, size_t nbyte)
+{
+       static ssize_t (*writep)(int fildes, const void *buf, size_t nbyte);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL_FILE(write, libc.so.6);
+
+       sret = writep(fd, buf, nbyte);
+
+       AFTER_ORIGINAL_FD_RET(VT_SSIZE_T, sret, (unsigned int)sret, fd, FD_API_WRITE,
+                       "%d, %p, %u", fd, buf, nbyte);
+
+       return sret;
+}
+
+
+ssize_t readv(int fd, const struct iovec *iov, int iovcnt)
+{
+       static ssize_t (*readvp)(int fd, const struct iovec *iov, int iovcnt);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL_FILE(readv, libc.so.6);
+       sret = readvp(fd,iov,iovcnt);
+
+       AFTER_ORIGINAL_FD_RET(VT_SSIZE_T, sret, (unsigned int)sret, fd, FD_API_READ,
+                       "%d, %p, %d", fd, iov, iovcnt);
+
+       return sret;
+}
+
+// why writev is commented ?
+#if 0
+ssize_t writev(int fd, const struct iovec *iov, int iovcnt)
+{
+       static ssize_t (*writevp)(int fd, const struct iovec *iov, int iovcnt);
+
+       MAKE_RESOURCE_PREBLOCK(writev, libc.so.6,3,VT_INT,fd,VT_PTR,iov,VT_INT,iovcnt);
+       ssize_t ret;
+       ret = writevp(fd,iov,iovcnt);
+       MAKE_RESOURCE_POSTBLOCK(VT_SSIZE_T,ret,VT_SSIZE_T,ret,VT_INT,fd, FD_API_WRITE);
+       return ret;
+}
+#endif
+
+// *****************************************************************
+// Directory I/O
+// *****************************************************************
+
+int rmdir(const char *path)
+{
+       static int (*rmdirp)(const char *path);
+
+       BEFORE_ORIGINAL_FILE(rmdir, libc.so.6);
+       _filepath = (char*)path;
+       ret = rmdirp(path);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s", path);
+       return ret;
+}
+
+int fchdir(int fd)
+{
+       static int (*fchdirp)(int fd);
+
+       BEFORE_ORIGINAL_FILE(fchdir, libc.so.6);
+       ret = fchdirp(fd);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%d", fd);
+       return ret;
+}
+
+int chdir(const char *path)
+{
+       static int (*chdirp)(const char *path);
+
+       BEFORE_ORIGINAL_FILE(chdir, libc.so.6);
+       _filepath = (char*)path;
+       ret = chdirp(path);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s", path);
+       return ret;
+}
+
+int link(const char *path1, const char *path2)
+{
+       static int (*linkp)(const char *path1, const char *path2);
+
+       BEFORE_ORIGINAL_FILE(link, libc.so.6);
+       _filepath = (char*)path1;
+       ret = linkp(path1, path2);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s, %s", path1, path2);
+       return ret;
+}
+
+int linkat(int fd1, const char *path1, int fd2, const char *path2, int flag)
+{
+       static int (*linkatp)(int fd1, const char *path1, int fd2, const char *path2, int flag);
+
+       BEFORE_ORIGINAL_FILE(linkat, libc.so.6);
+       _filepath = (char*)path1;
+       ret = linkatp(fd1, path1, fd2, path2, flag);
+       AFTER_ORIGINAL_FD(0, fd2, FD_API_DIRECTORY,
+                       "%d, %s, %d, %s, %d", fd1, path2, fd2, path2, flag);
+       return ret;
+}
+
+int unlink(const char *path)
+{
+       static int (*unlinkp)(const char *path);
+
+       BEFORE_ORIGINAL_FILE(unlink, libc.so.6);
+       _filepath = (char*)path;
+       ret = unlinkp(path);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s", path);
+       return ret;
+}
+
+int unlinkat(int fd, const char *path, int flag)
+{
+       static int (*unlinkatp)(int fd, const char *path, int flag);
+
+       BEFORE_ORIGINAL_FILE(unlinkat, libc.so.6);
+       _filepath = (char*)path;
+       ret = unlinkatp(fd, path, flag);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%d, %s, %d", fd, path, flag);
+       return ret;
+}
+
+int symlink(const char *path1, const char *path2)
+{
+       static int (*symlinkp)(const char *path1, const char *path2);
+
+       BEFORE_ORIGINAL_FILE(symlink, libc.so.6);
+       _filepath = (char*)path1;
+       ret = symlinkp(path1, path2);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s, %s", path1, path2);
+       return ret;
+}
+
+int symlinkat(const char *path1, int fd, const char *path2)
+{
+       static int (*symlinkatp)(const char *path1, int fd, const char *path2);
+
+       BEFORE_ORIGINAL_FILE(symlinkat, libc.so.6);
+       _filepath = (char*)path1;
+       ret = symlinkatp(path1, fd, path2);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%s, %d, %s", path1, fd, path2);
+       return ret;
+}
+
+ssize_t readlink(const char* path, char* buf, size_t bufsize)
+{
+       static int (*readlinkp)(const char* path, char* buf, size_t bufsize);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL_FILE(readlink, libc.so.6);
+       _filepath = (char*)path;
+
+       sret = readlinkp(path, buf, bufsize);
+
+       AFTER_ORIGINAL_NOFD_RET(VT_SSIZE_T, sret, bufsize, FD_API_DIRECTORY,
+                       "%s, %s, %u", path, buf, bufsize);
+
+       return sret;
+}
+
+ssize_t readlinkat(int fd, const char * path, char * buf, size_t bufsize)
+{
+       static int (*readlinkatp)(int fd, const char * path, char * buf, size_t bufsize);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL_FILE(readlinkat, libc.so.6);
+       _filepath = (char*)path;
+
+       sret = readlinkatp(fd, path, buf, bufsize);
+
+       AFTER_ORIGINAL_FD_RET(VT_SSIZE_T, sret, bufsize, fd, FD_API_DIRECTORY,
+                       "%d, %s, %s, %u", fd, path, buf, bufsize);
+
+       return sret;
+}
+
+int mkdir(const char *path, mode_t mode)
+{
+       static int (*mkdirp)(const char *path, mode_t mode);
+
+       BEFORE_ORIGINAL_FILE(mkdir, libc.so.6);
+       _filepath = (char*)path;
+       ret = mkdirp(path, mode);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s, %u", path, mode);
+       return ret;
+}
+
+int mkdirat(int fd, const char *path, mode_t mode)
+{
+       static int (*mkdiratp)(int fd, const char *path, mode_t mode);
+
+       BEFORE_ORIGINAL_FILE(mkdirat, libc.so.6);
+       _filepath = (char*)path;
+       ret = mkdiratp(fd, path, mode);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%d, %s, %u", fd, path, mode);
+       return ret;
+}
+
+int closedir(DIR *dirp)
+{
+       static int (*closedirp)(DIR *dirp);
+
+       BEFORE_ORIGINAL_FILE(closedir, libc.so.6);
+       ret = closedirp(dirp);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%p", dirp);
+       return ret;
+}
+
+DIR *fdopendir(int fd)
+{
+       static DIR* (*fdopendirp)(int fd);
+       DIR* dret;
+
+       BEFORE_ORIGINAL_FILE(fdopendir, libc.so.6);
+
+       dret = fdopendirp(fd);
+
+       AFTER_ORIGINAL_FD_RET(VT_PTR, dret, 0, fd, FD_API_DIRECTORY, "%d", fd);
+
+       return dret;
+}
+
+DIR *opendir(const char *dirname)
+{
+       static DIR* (*opendirp)(const char *dirname);
+       DIR* dret;
+
+       BEFORE_ORIGINAL_FILE(opendir, libc.so.6);
+       _filepath = (char*)dirname;
+
+       dret = opendirp(dirname);
+
+       AFTER_ORIGINAL_NOFD_RET(VT_PTR, dret, 0, FD_API_DIRECTORY, "%s", dirname);
+
+       return dret;
+}
+
+struct dirent *readdir(DIR *dirp)
+{
+       static struct dirent* (*readdirp)(DIR *dirp);
+       struct dirent* dret;
+
+       BEFORE_ORIGINAL_FILE(readdir, libc.so.6);
+
+       dret = readdirp(dirp);
+       
+       AFTER_ORIGINAL_NOFD_RET(VT_PTR, dret, 0, FD_API_DIRECTORY, "%p", dirp);
+
+       return dret;
+}
+
+int readdir_r(DIR * dirp, struct dirent * entry, struct dirent ** result)
+{
+       static int (*readdir_rp)(DIR * dirp, struct dirent * entry, struct dirent ** result);
+
+       BEFORE_ORIGINAL_FILE(readdir_r, libc.so.6);
+       ret = readdir_rp(dirp, entry, result);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%p, %p, %p", dirp, entry, result);
+       return ret;
+}
+
+void rewinddir(DIR *dirp)
+{
+       static void (*rewinddirp)(DIR *dirp);
+
+       BEFORE_ORIGINAL_FILE(rewinddir, libc.so.6);
+
+       rewinddirp(dirp);
+       
+       AFTER_ORIGINAL_NOFD_RET(VT_NULL, NULL, 0, FD_API_DIRECTORY, "%p", dirp);
+}
+
+void seekdir(DIR *dirp, long loc)
+{
+       static void (*seekdirp)(DIR *dirp, long loc);
+
+       BEFORE_ORIGINAL_FILE(seekdir, libc.so.6);
+
+       seekdirp(dirp, loc);
+
+       AFTER_ORIGINAL_NOFD_RET(VT_NULL, NULL, 0, FD_API_DIRECTORY,
+                       "%p, %ld", dirp, loc);
+}
+
+long telldir(DIR *dirp)
+{
+       static int (*telldirp)(DIR *dirp);
+       long lret;
+
+       BEFORE_ORIGINAL_FILE(telldir, libc.so.6);
+
+       lret = telldirp(dirp);
+
+       AFTER_ORIGINAL_NOFD_RET(VT_LONG, lret, 0, FD_API_DIRECTORY, "%p", dirp);
+
+       return lret;
+}
+
+// *****************************************************************
+// File Attributes APIs
+// *****************************************************************
+
+int fcntl(int fd, int cmd, ...)
+{
+       static int (*fcntlp)(int fd, int cmd, ...);
+       int arg = 0;
+
+       BEFORE_ORIGINAL_FILE(fcntl, libc.so.6);
+
+       va_list argl;
+       va_start(argl, cmd);
+       arg = va_arg(argl, int);
+       va_end(argl);
+
+       ret = fcntlp(fd, cmd, arg);
+
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d, %d, %d", fd, cmd, arg);
+
+       return ret;
+}
+
+int dup(int fd)
+{
+       static int (*dupp)(int fd);
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(dup, libc.so.6);
+
+       ret = dupp(fd);
+
+       AFTER_ORIGINAL_FD(0, ret, FD_API_OPEN, "%d", fd);
+
+       return ret;
+}
+
+int dup2(int fd, int fd2)
+{
+       static int (*dup2p)(int fd, int fd2);
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(dup2, libc.so.6);
+
+       ret = dup2p(fd, fd2);
+
+       AFTER_ORIGINAL_FD(0, ret, FD_API_OPEN, "%d, %d", fd, fd2);
+
+       return ret;
+}
+
+//FIXME dlsym error
+// fstat is not in libc.so.6
+#if 0
+int fstat(int fd, struct stat *buf)
+{
+       static int (*fstatp)(int fd, struct stat *buf);
+
+       BEFORE_ORIGINAL_FILE(fstat, libc.so.6);
+       ret = fstatp(fd, buf);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d, %p", fd, buf);
+       return ret;
+}
+
+int stat(const char * path, struct stat * buf)
+{
+       static int (*statp)(const char * path, struct stat * buf);
+
+       BEFORE_ORIGINAL_FILE(stat, libc.so.6);
+       _filepath = (char*)path;
+       ret = statp(path, buf);
+       AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, buf);
+       return ret;
+}
+
+#endif
+
+int fstatat(int fd, const char * path, struct stat * buf, int flag)
+{
+       static int (*fstatatp)(int fd, const char * path, struct stat * buf, int flag);
+
+       BEFORE_ORIGINAL_FILE(fstatat, libc.so.6);
+       _filepath = (char*)path;
+       ret = fstatatp(fd, path, buf, flag);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d, %s, %p, %d", fd, path, buf, flag);
+       return ret;
+}
+
+int lstat(const char * path, struct stat * buf)
+{
+       static int (*lstatp)(const char * path, struct stat * buf);
+
+       BEFORE_ORIGINAL_FILE(lstat, libc.so.6);
+       _filepath = (char*)path;
+       ret = lstatp(path, buf);
+       AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, buf);
+       return ret;
+}
+
+int futimens(int fd, const struct timespec times[2])
+{
+       static int (*futimensp)(int fd, const struct timespec times[2]);
+
+       BEFORE_ORIGINAL_FILE(futimens, libc.so.6);
+       ret = futimensp(fd, times);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d, %p", fd, times);
+       return ret;
+}
+
+int utimensat(int fd, const char *path, const struct timespec times[2], int flag)
+{
+       static int (*utimensatp)(int fd, const char *path, const struct timespec times[2], int flag);
+
+       BEFORE_ORIGINAL_FILE(utimensat, libc.so.6);
+       _filepath = (char*)path;
+       ret = utimensatp(fd, path, times, flag);
+       AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER,
+                       "%d, %s, %p, %d", fd, path, times, flag);
+       return ret;
+}
+
+int utimes(const char *path, const struct timeval times[2])
+{
+       static int (*utimesp)(const char *path, const struct timeval times[2]);
+
+       BEFORE_ORIGINAL_FILE(utimes, libc.so.6);
+       _filepath = (char*)path;
+       ret = utimesp(path, times);
+       AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, times);
+       return ret;
+}
+
+int utime(const char *path, const struct utimbuf *times)
+{
+       static int (*utimep)(const char *path, const struct utimbuf *times);
+
+       BEFORE_ORIGINAL_FILE(utime, libc.so.6);
+       _filepath = (char*)path;
+       ret = utimep(path, times);
+       AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, times);
+       return ret;
+}
+
+
diff --git a/probe_file/da_io_stdc.c b/probe_file/da_io_stdc.c
new file mode 100644 (file)
index 0000000..cd0e27b
--- /dev/null
@@ -0,0 +1,571 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dautil.h"
+#include "da_io.h"
+
+FILE* fopen(const char* filename, const char* mode)
+{
+       static FILE* (*fopenp)(const char* filename, const char* mode);
+       FILE* fret;
+       
+       BEFORE_ORIGINAL_FILE_NOFILTER(fopen, libc.so.6);
+       _filepath = (char*)filename;
+       
+       fret = fopenp(filename, mode);
+       
+       AFTER_ORIGINAL_FILEP_RET(VT_PTR, fret, 0, fret, FD_API_OPEN, "%s, %s", filename, mode);
+
+       return fret;
+}
+
+FILE* freopen(const char * filename, const char * mode, FILE * stream)
+{
+       static FILE* (*freopenp)(const char * filename, const char * mode, FILE * stream);
+       FILE* fret;
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(freopen, libc.so.6);
+       _filepath = (char*)filename;
+
+       fret = freopenp(filename, mode, stream);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_PTR, fret, 0, fret, FD_API_OPEN,
+                       "%s, %s, %p", filename, mode, stream);
+
+       return fret;
+}
+
+FILE* fdopen(int fildes, const char *mode)
+{
+       static FILE* (*fdopenp)(int fildes, const char *mode);
+       FILE* fret;
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(fdopen, libc.so.6);
+
+       fret = fdopenp(fildes, mode);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_PTR, fret, 0, fret, FD_API_OPEN, "%d, %s", fildes, mode);
+
+       return fret;
+}
+
+int fflush(FILE* stream)
+{
+       static int (*fflushp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(fflush, libc.so.6);
+       ret = fflushp(stream);
+       AFTER_ORIGINAL_FILEP(0, stream, FD_API_OTHER, "%p", stream);
+       return ret;
+}
+
+int fclose(FILE* stream)
+{
+       static int (*fclosep)(FILE* stream);
+       DECLARE_VARIABLE_FD;
+
+       GET_REAL_FUNC(fclose, libc.so.6);
+
+       bfiltering = false;
+       PRE_PROBEBLOCK_BEGIN();
+       GET_FD_FROM_FILEP(stream);
+       _fstatret = fstat(_fd, &_statbuf);
+       PRE_PROBEBLOCK_END();
+
+       ret = fclosep(stream);
+
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, VT_INT, ret, "%p", stream);
+       POST_PROBEBLOCK_MIDDLE_FD(0, _fd, FD_API_CLOSE);
+       POST_PROBEBLOCK_CALLSTACK_RESOURCE(FD_API_CLOSE);
+       POST_PROBEBLOCK_END();
+
+       return ret;
+}
+
+int remove(const char* filename)
+{
+       static int (*removep)(const char* filename);
+
+       BEFORE_ORIGINAL_FILE(remove, libc.so.6);
+       _filepath = (char*)filename;
+       ret = removep(filename);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s", filename);
+       return ret;
+}
+
+int rename(const char* oldname, const char* newname)
+{
+       static int (*renamep)(const char* oldname, const char* newname);
+
+       BEFORE_ORIGINAL_FILE(rename, libc.so.6);
+       _filepath = (char*)newname;
+       ret = renamep(oldname, newname);
+       AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s, %s", oldname, newname);
+       return ret;
+}
+
+FILE * tmpfile ( void )
+{
+       static FILE* (*tmpfilep) ( void );
+       FILE* fret;
+
+       BEFORE_ORIGINAL_FILE_NOFILTER(tmpfile, libc.so.6);
+       _filepath = "<temp file>";
+       fret = tmpfilep();
+
+       AFTER_ORIGINAL_FILEP_RET(VT_PTR, fret, 0, fret, FD_API_OPEN, "%s", "");
+
+       return fret;
+}
+
+int fgetpos(FILE* stream, fpos_t* position)
+{
+       static int (*fgetposp)(FILE* stream, fpos_t* position);
+
+       BEFORE_ORIGINAL_FILE(fgetpos, libc.so.6);
+       ret = fgetposp(stream, position);
+       AFTER_ORIGINAL_FILEP(0, stream, FD_API_OTHER, "%p, %p", stream, position);
+       return ret;
+}
+
+int fseek(FILE* stream, long int offset, int origin)
+{
+       static int (*fseekp)(FILE* stream, long int offset, int origin);
+
+       BEFORE_ORIGINAL_FILE(fseek, libc.so.6);
+       ret = fseekp(stream, offset, origin);
+       AFTER_ORIGINAL_FILEP((unsigned int)offset, stream, FD_API_OTHER,
+                       "%p, %ld, %d", stream, offset, origin);
+       return ret;
+}
+
+int fsetpos(FILE* stream, const fpos_t* pos)
+{
+       static int (*fsetposp)(FILE* stream, const fpos_t* pos);
+
+       BEFORE_ORIGINAL_FILE(fsetpos, libc.so.6);
+       ret = fsetposp(stream, pos);
+       AFTER_ORIGINAL_FILEP(0, stream, FD_API_OTHER, "%p, %p", stream, pos);
+       return ret;
+}
+
+long int ftell(FILE* stream)
+{
+       static long int (*ftellp)(FILE* stream);
+       long int lret;
+
+       BEFORE_ORIGINAL_FILE(ftell, libc.so.6);
+       
+       lret = ftellp(stream);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_LONG, lret, 0, stream, FD_API_OTHER, "%p", stream);
+
+       return lret;
+}
+
+void rewind(FILE* stream)
+{
+       static void (*rewindp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(rewind, libc.so.6);
+
+       rewindp(stream);
+       
+       AFTER_ORIGINAL_FILEP_RET(VT_NULL, NULL, 0, stream, FD_API_OTHER, "%p", stream);
+}
+
+void clearerr(FILE* stream)
+{
+       static void (*clearerrp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(clearerr, libc.so.6);
+
+       clearerrp(stream);
+       
+       AFTER_ORIGINAL_FILEP_RET(VT_NULL, NULL, 0, stream, FD_API_OTHER, "%p", stream);
+}
+
+int feof(FILE* stream)
+{
+       static int (*feofp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(feof, libc.so.6);
+       ret = feofp(stream);
+       AFTER_ORIGINAL_FILEP(0, stream, FD_API_OTHER, "%p", stream);
+       return ret;
+}
+
+int ferror(FILE* stream)
+{
+       static int (*ferrorp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(ferror, libc.so.6);
+       ret = ferrorp(stream);
+       AFTER_ORIGINAL_FILEP(0, stream, FD_API_OTHER, "%p", stream);
+       return ret;
+}
+
+int fileno(FILE* stream)
+{
+       static int (*filenop)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(fileno, libc.so.6);
+       ret = filenop(stream);
+       AFTER_ORIGINAL_FILEP(0, stream, FD_API_OTHER, "%p", stream);
+       return ret;
+}
+
+void perror(const char* string)
+{
+       static void (*perrorp)(const char* string);
+
+       BEFORE_ORIGINAL_FILE(perror, libc.so.6);
+
+       perrorp(string);
+
+       AFTER_ORIGINAL_NOFD_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", string);
+}
+
+// *******************************************************************
+// File read / write APIs
+// *******************************************************************
+
+int vfprintf(FILE* stream, const char* format, va_list arg)
+{
+       static int (*vfprintfp)(FILE* stream, const char* format, va_list arg);
+
+       BEFORE_ORIGINAL_FILE(vfprintf, libc.so.6);
+       ret = vfprintfp(stream, format, arg);
+       AFTER_ORIGINAL_FILEP(ret, stream, FD_API_WRITE, "%p, %s", stream, format);
+       return ret;
+}
+
+int vfscanf(FILE* stream, const char* format, va_list arg)
+{
+       static int (*vfscanfp)(FILE* stream, const char* format, va_list arg);
+
+       BEFORE_ORIGINAL_FILE(vfscanf, libc.so.6);
+       ret = vfscanfp(stream, format, arg);
+       AFTER_ORIGINAL_FILEP(ret, stream, FD_API_READ, "%p, %s", stream, format);
+       return ret;
+}
+
+int fgetc(FILE* stream)
+{
+       static int (*fgetcp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(fgetc, libc.so.6);
+       ret = fgetcp(stream);
+       AFTER_ORIGINAL_FILEP((ret == EOF ? 0 : 1), stream, FD_API_READ, "%p", stream);
+       return ret;
+}
+
+#if 0  // why is this commented?
+char* fgets(char* str, int size, FILE* stream)
+{
+       static char* (*fgetsp)(char* str, int num, FILE* stream);
+       char* cret;
+
+       BEFORE_ORIGINAL_FILE(fgets, libc.so.6);
+       
+       cret = fgetsp(str, size, stream);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_STR, cret, (ret == NULL ? 0 : strlen(cret)),
+                       stream, FD_API_READ, "%s, %d, %p", str, size, stream);
+
+       return cret;
+}
+#endif
+
+int fputc(int character, FILE* stream)
+{
+       static int (*fputcp)(int character, FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(fputc, libc.so.6);
+       ret = fputcp(character, stream);
+       AFTER_ORIGINAL_FILEP((ret == EOF ? 0 : 1), stream, FD_API_WRITE,
+                       "%d, %p", character, stream);
+       return ret;
+}
+
+int fputs(const char* str, FILE* stream)
+{
+       static int (*fputsp)(const char* str, FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(fputs, libc.so.6);
+       ret = fputsp(str, stream);
+       AFTER_ORIGINAL_FILEP(ret, stream, FD_API_WRITE, "%s, %p", str, stream);
+       return ret;
+}
+
+int getc(FILE* stream)
+{
+       static int (*getcp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(getc, libc.so.6);
+       ret = getcp(stream);
+       AFTER_ORIGINAL_FILEP((ret == EOF ? 0 : 1), stream, FD_API_READ, "%p", stream);
+       return ret;
+}
+
+int putc(int character, FILE* stream)
+{
+       static int (*putcp)(int character, FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(putc, libc.so.6);
+       ret = putcp(character, stream);
+       AFTER_ORIGINAL_FILEP((ret == EOF ? 0 : 1), stream, FD_API_WRITE,
+                       "%d, %p", character, stream);
+       return ret;
+}
+
+int ungetc(int character, FILE* stream)
+{
+       static int (*ungetcp)(int character, FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(ungetc, libc.so.6);
+       ret = ungetcp(character, stream);
+       AFTER_ORIGINAL_FILEP(0, stream, FD_API_OTHER, "%d, %p", character, stream);
+       return ret;
+}
+
+size_t fread(void* ptr, size_t size, size_t count, FILE* stream)
+{
+       static size_t (*freadp)(void* ptr, size_t size, size_t count, FILE* stream);
+       size_t tret;
+
+       BEFORE_ORIGINAL_FILE(fread, libc.so.6);
+
+       tret = freadp(ptr, size, count, stream);
+       
+       AFTER_ORIGINAL_FILEP_RET(VT_SIZE_T, tret, 0, stream, FD_API_READ,
+                       "%p, %u, %u, %p", ptr, size, count, stream);
+       
+       return tret;
+}
+
+size_t fwrite(const void* ptr, size_t size, size_t count, FILE* stream)
+{
+       static size_t (*fwritep)(const void* ptr, size_t size, size_t count, FILE* stream);
+       size_t tret;
+
+       BEFORE_ORIGINAL_FILE(fwrite, libc.so.6);
+
+       tret = fwritep(ptr, size, count, stream);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_SIZE_T, tret, 0, stream, FD_API_WRITE,
+                       "%p, %u, %u, %p", ptr, size, count, stream);
+
+       return tret;
+}
+
+// *********************************************************
+// variable parameter function
+// *********************************************************
+int fprintf(FILE* stream, const char* format, ...)
+{
+       static int (*vfprintfp)(FILE* stream, const char* format, ...);
+
+       BEFORE_ORIGINAL_FILE(vfprintf, libc.so.6);
+
+       va_list arg;
+       va_start(arg, format);
+       ret = vfprintfp(stream, format, arg);
+
+       AFTER_ORIGINAL_FILEP(ret, stream, FD_API_WRITE, "%p, %s, ...", stream, format);
+       va_end(arg);
+
+       return ret;
+}
+
+int fscanf(FILE* stream, const char* format, ...)
+{
+       static int (*vfscanfp)(FILE* stream, const char* format, ...);
+       
+       BEFORE_ORIGINAL_FILE(vfscanf, libc.so.6);
+
+       va_list arg;
+       va_start(arg, format);
+       ret = vfscanfp(stream, format, arg);
+
+       AFTER_ORIGINAL_FILEP(ret, stream, FD_API_READ, "%p, %s, ...", stream, format);
+       va_end(arg);
+
+       return ret;
+}
+
+#if !defined(DA_DEBUG_LOG) && !defined(PRINT_STDOUT)
+int printf(const char* format, ...)
+{
+       static int (*vprintfp)(const char* format, ...);
+       
+       BEFORE_ORIGINAL_FILE(vprintf, libc.so.6);
+
+       va_list arg;
+       va_start(arg, format);
+       ret = vprintfp(format, arg);
+
+       AFTER_ORIGINAL_NOFD(ret, FD_API_WRITE, "%s,...", format);
+       va_end(arg);
+
+       return ret;
+}
+#endif
+
+int scanf(const char* format, ...)
+{
+       static int (*vscanfp)(const char* format, ...);
+
+       BEFORE_ORIGINAL_FILE(vscanf, libc.so.6);
+
+       va_list arg;
+       va_start(arg, format);
+       ret = vscanfp(format, arg);
+
+       AFTER_ORIGINAL_NOFD(ret, FD_API_READ, "%s,...", format);
+       va_end(arg);
+
+       return ret;
+}
+
+int getchar()
+{
+       static int (*getcharp)();
+
+       BEFORE_ORIGINAL_FILE(getchar, libc.so.6);
+       ret = getcharp();
+       AFTER_ORIGINAL_NOFD((ret == EOF ? 0 : 1), FD_API_READ, "%s", "");
+       return ret;
+}
+
+int putchar(int c)
+{
+       static int (*putcharp)(int c);
+
+       BEFORE_ORIGINAL_FILE(putchar, libc.so.6);
+       ret = putcharp(c);
+       AFTER_ORIGINAL_NOFD((ret == EOF ? 0 : 1), FD_API_WRITE, "%d", c);
+       return ret;
+}
+
+char* gets(char* str)
+{
+       static char* (*getsp)(char* str);
+       char* cret;
+
+       BEFORE_ORIGINAL_FILE(gets, libc.so.6);
+
+       cret = getsp(str);
+       
+       AFTER_ORIGINAL_NOFD_RET(VT_STR, cret, strlen(cret), FD_API_READ, "%s", str);
+
+       return cret;
+}
+
+#if !defined(DA_DEBUG_LOG) && !defined(PRINT_STDOUT)
+int puts(const char* str)
+{
+       static int (*putsp)(const char* str);
+
+       BEFORE_ORIGINAL_FILE(puts, libc.so.6);
+       ret = putsp(str);
+       AFTER_ORIGINAL_NOFD(ret, FD_API_WRITE, "%s", str);
+       return ret;
+}
+#endif
+
+char* tmpnam(char* str)
+{
+       static char* (*tmpnamp)(char* str);
+       char* cret;
+
+       BEFORE_ORIGINAL_FILE(tmpnam, libc.so.6);
+
+       cret = tmpnamp(str);
+
+       AFTER_ORIGINAL_NOFD_RET(VT_STR, cret, 0, FD_API_OTHER, "%s", str);
+
+       return cret;
+}
+
+void setbuf(FILE* stream, char* buf)
+{
+       static void (*setbufp)(FILE* stream, char* buf);
+
+       BEFORE_ORIGINAL_FILE(setbuf, libc.so.6);
+
+       setbufp(stream, buf);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_NULL, NULL, 0, stream, FD_API_OTHER,
+                       "%p, %p", stream, buf);
+}
+
+void setbuffer(FILE* stream, char* buf, size_t size)
+{
+       static void (*setbufferp)(FILE* stream, char* buf, size_t size);
+
+       BEFORE_ORIGINAL_FILE(setbuffer, libc.so.6);
+
+       setbufferp(stream, buf, size);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_NULL, NULL, size, stream, FD_API_OTHER,
+                       "%p, %p, %u", stream, buf, size);
+}
+
+void setlinebuf(FILE* stream)
+{
+       static int (*setlinebufp)(FILE* stream);
+
+       BEFORE_ORIGINAL_FILE(setlinebuf, libc.so.6);
+
+       setlinebufp(stream);
+
+       AFTER_ORIGINAL_FILEP_RET(VT_NULL, NULL, 0, stream, FD_API_OTHER, "%p", stream);
+}
+
+int setvbuf(FILE* stream, char* buf, int mode, size_t size)
+{
+       static int (*setvbufp)(FILE* stream, char* buf, int mode, size_t size);
+
+       BEFORE_ORIGINAL_FILE(setvbuf, libc.so.6);
+       ret = setvbufp(stream,buf,mode,size);
+       AFTER_ORIGINAL_FILEP(size, stream, FD_API_OTHER,
+                       "%p, %p, %d, %u", stream, buf, mode, size);
+       return ret;
+}
+
diff --git a/probe_memory/da_memory.h b/probe_memory/da_memory.h
new file mode 100644 (file)
index 0000000..3e6a06c
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DA_MEMORY_H__
+#define __DA_MEMORY_H__
+
+#include "daprobe.h"
+
+/*******************************************************************
+ * MEMORY PROBE MACRO
+ *
+ * log format
+ *             SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,
+ *             Size`,MemoryAPIType`,Addr`,\n
+ *             callstack_start`,callstack`,callstack_end
+ * 
+ ********************************************************************/
+
+#define POST_PROBEBLOCK_MIDDLE_MEM(SIZE, APITYPE, ADDR)        \
+       log.length += sprintf(log.data + log.length,            \
+                       "`,%u`,%d`,%p", SIZE, APITYPE, ADDR)
+
+#define POST_PROBEBLOCK_BEGIN_MEM(LCTYPE, APINAME, RETTYPE, RETVALUE, INPUTFORMAT, ...)        \
+       newerrno = errno;                                                                                                                                       \
+       if(postBlockBegin(blockresult)) {                                                                                                       \
+               INIT_LOG;                                                                                                                                               \
+               APPEND_LOG_BASIC_NAME(LCTYPE, APINAME);                                                                                 \
+               APPEND_LOG_INPUT(INPUTFORMAT, __VA_ARGS__);                                                                             \
+               APPEND_LOG_RESULT(RETTYPE, RETVALUE);                                                                                   \
+               APPEND_LOG_CALLER()
+
+#endif // __DA_MEMORY_H__
diff --git a/probe_memory/libdamemalloc.c b/probe_memory/libdamemalloc.c
new file mode 100755 (executable)
index 0000000..d851b47
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <stdbool.h>
+#include <memory.h>
+#include <errno.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dacollection.h"
+#include "dautil.h"
+#include "da_memory.h"
+
+#define EXTRA_MEM_SIZE         20
+#define MEMORYFILTERING                (!isEnableInternalMalloc())
+static char extra_mem[EXTRA_MEM_SIZE];
+
+void *malloc(size_t size)
+{
+       static void*(*mallocp)(size_t size);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNC_RTLD_NEXT(malloc);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       pret = mallocp(size);
+
+       if(pret != NULL && getTraceState() == 0)
+       {
+               add_memory_hash(pret, size);
+       }
+
+       POST_PROBEBLOCK_BEGIN(LC_MEMORY, VT_PTR, pret, "%u", size);
+       POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
+void free(void *ptr)
+{
+       static void (*freep)(void *);
+       DECLARE_VARIABLE_STANDARD;
+
+       GET_REAL_FUNC_RTLD_NEXT(free);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       if(ptr != NULL && getTraceState() == 0)
+       {
+               del_memory_hash(ptr);
+       }
+
+       freep(ptr);
+
+       POST_PROBEBLOCK_BEGIN(LC_MEMORY, VT_NULL, NULL, "%p", ptr);
+       POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+}
+
+/*     calloc's helper fucntion
+ *     - dlsym calls calloc - recursion occurs
+ *     - first dlsym calls temp_calloc
+ *  */
+void *temp_calloc(size_t nelem, size_t elsize)
+{
+       int i;
+       if(nelem * elsize > EXTRA_MEM_SIZE)
+       {
+               PRINTMSG("temp_calloc size error\n");
+               abort();
+       }
+       for(i = 0; i < elsize * nelem; i++)
+       {
+               extra_mem[i] = 0;
+       }
+       //memset(extra_mem,0,elsize*nelem);
+       return extra_mem;
+}
+
+void *calloc(size_t nelem, size_t elsize)
+{
+       static void *(*callocp)(size_t,size_t);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       if(!callocp) {
+               probeBlockStart();
+               callocp = temp_calloc;  // make callocp is not null for dlsym
+               // dlsym use calloc function
+               callocp = dlsym(RTLD_NEXT, "calloc");
+               if(callocp == NULL || dlerror() != NULL) {
+                       perror("calloc dlsym failed");
+                       exit(0);
+               }
+               probeBlockEnd();
+       }
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       pret = callocp(nelem, elsize);
+
+       if(pret != NULL && getTraceState() == 0)
+       {
+               add_memory_hash(pret, nelem * elsize);
+       }
+
+       POST_PROBEBLOCK_BEGIN(LC_MEMORY, VT_PTR, pret, "%u, %u", nelem, elsize);
+       POST_PROBEBLOCK_MIDDLE_MEM(nelem * elsize, MEMORY_API_ALLOC, pret);
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
+void *realloc(void *memblock, size_t size)
+{
+       static void *(*reallocp)(void *,size_t);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNC_RTLD_NEXT(realloc);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       if(memblock != NULL && getTraceState() == 0)
+       {
+               del_memory_hash(memblock);
+       }
+
+       pret = reallocp(memblock, size);
+
+       if(pret != NULL && getTraceState() == 0)
+       {
+               add_memory_hash(pret, size);
+       }
+
+       POST_PROBEBLOCK_BEGIN(LC_MEMORY, VT_PTR, pret, "%p, %u", memblock, size);
+       POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
diff --git a/probe_memory/libdamemmanage.c b/probe_memory/libdamemmanage.c
new file mode 100644 (file)
index 0000000..82918cd
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <stdbool.h>
+#include <memory.h>
+#include <errno.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dautil.h"
+#include "da_memory.h"
+
+void *memset(void *memblock, int c, size_t n)
+{
+       static void *(*memsetp)(void *,int,size_t);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNC_RTLD_NEXT(memset);
+
+       PRE_PROBEBLOCK();
+
+       pret = memsetp(memblock, c, n);
+
+       POST_PROBEBLOCK_BEGIN(LC_MEMORY, VT_PTR, pret, "%p, %d, %u", memblock, c, n);
+       POST_PROBEBLOCK_MIDDLE_MEM(n, MEMORY_API_MANAGE, memblock);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
+int memcmp(const void * ptr1, const void * ptr2, size_t num)
+{
+       static int(*memcmpp)(const void *,const void *,size_t);
+       DECLARE_VARIABLE_STANDARD;
+
+       GET_REAL_FUNC_RTLD_NEXT(memcmp);
+
+       PRE_PROBEBLOCK();
+
+       ret = memcmpp(ptr1, ptr2, num);
+
+       POST_PROBEBLOCK_BEGIN(LC_MEMORY, VT_INT, ret, "%p, %p, %u", ptr1, ptr2, num);
+       POST_PROBEBLOCK_MIDDLE_MEM(num, MEMORY_API_MANAGE, ptr1);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return ret;
+}
+
+void *memcpy(void * destination, const void * source, size_t num )
+{
+       static void *(*memcpyp)(void *,const void *,size_t);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNC_RTLD_NEXT(memcpy);
+
+       PRE_PROBEBLOCK();
+
+       pret = memcpyp(destination, source, num);
+
+       POST_PROBEBLOCK_BEGIN(LC_MEMORY, VT_PTR, pret, "%p, %p, %u", destination, source, num);
+       POST_PROBEBLOCK_MIDDLE_MEM(num, MEMORY_API_MANAGE, destination);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
diff --git a/probe_memory/libdanew.cpp b/probe_memory/libdanew.cpp
new file mode 100644 (file)
index 0000000..2085858
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <new>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dacollection.h"
+#include "da_memory.h"
+
+#define MEMORYFILTERING                (!isEnableInternalMalloc())
+
+void *operator new(std::size_t size) throw (std::bad_alloc)
+{
+       static void*(*newp)(std::size_t size);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_Znwj,newp);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       pret = newp(size);
+
+       if(pret != NULL && getTraceState() == 0)
+       {
+               add_memory_hash(pret, size);
+       }
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "new", VT_PTR, pret, "%u", size);
+       POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
+void *operator new[](std::size_t size) throw (std::bad_alloc)
+{
+       static void*(*newp)(std::size_t size);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_Znaj, newp);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       pret = newp(size);
+
+       if(pret != NULL && getTraceState() == 0)
+       {
+               add_memory_hash(pret, size);
+       }
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "new", VT_PTR, pret, "%u", size);
+       POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
+void operator delete(void *ptr) throw()
+{
+       static void (*deletep)(void *ptr);
+       DECLARE_VARIABLE_STANDARD;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_ZdlPv, deletep);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       if(ptr != NULL && getTraceState() == 0)
+       {
+               del_memory_hash(ptr);
+       }
+
+       deletep(ptr);
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
+       POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+}
+
+void operator delete[](void *ptr) throw()
+{
+       static void (*deletep)(void *ptr);
+       DECLARE_VARIABLE_STANDARD;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_ZdaPv, deletep);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       if(ptr != NULL && getTraceState() == 0)
+       {
+               del_memory_hash(ptr);
+       }
+
+       deletep(ptr);
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
+       POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+}
+
+void *operator new(std::size_t size, const std::nothrow_t& nothrow) throw()
+{
+       static void*(*newp)(std::size_t size, const std::nothrow_t& nothrow);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_ZnwjRKSt9nothrow_t, newp);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       pret = newp(size, nothrow);
+
+       if(pret != NULL && getTraceState() == 0)
+       {
+               add_memory_hash(pret, size);
+       }
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "new", VT_PTR, pret, "%u", size);
+       POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
+void *operator new[](std::size_t size, const std::nothrow_t& nothrow) throw()
+{
+       static void*(*newp)(std::size_t size, const std::nothrow_t& nothrow);
+       DECLARE_VARIABLE_STANDARD;
+       void *pret;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_ZnajRKSt9nothrow_t, newp);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       pret = newp(size, nothrow);
+
+       if(pret != NULL && getTraceState() == 0)
+       {
+               add_memory_hash(pret, size);
+       }
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "new", VT_PTR, pret, "%u", size);
+       POST_PROBEBLOCK_MIDDLE_MEM(size, MEMORY_API_ALLOC, pret);
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return pret;
+}
+
+void operator delete(void *ptr, const std::nothrow_t& nothrow) throw()
+{
+       static void (*deletep)(void *ptr, const std::nothrow_t& nothrow);
+       DECLARE_VARIABLE_STANDARD;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_ZdlPvRKSt9nothrow_t, deletep);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       if(ptr != NULL && getTraceState() == 0)
+       {
+               del_memory_hash(ptr);
+       }
+
+       deletep(ptr, nothrow);
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
+       POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+}
+
+void operator delete[](void *ptr, const std::nothrow_t& nothrow) throw()
+{
+       static void (*deletep)(void *ptr, const std::nothrow_t& nothrow);
+       DECLARE_VARIABLE_STANDARD;
+
+       GET_REAL_FUNCP_RTLD_NEXT_CPP(_ZdaPvRKSt9nothrow_t, deletep);
+
+       bfiltering = MEMORYFILTERING;
+       PRE_PROBEBLOCK();
+
+       if(ptr != NULL && getTraceState() == 0)
+       {
+               del_memory_hash(ptr);
+       }
+
+       deletep(ptr, nothrow);
+
+       POST_PROBEBLOCK_BEGIN_MEM(LC_MEMORY, "delete", VT_NULL, NULL, "%p", ptr);
+       POST_PROBEBLOCK_MIDDLE_MEM(0, MEMORY_API_FREE, ptr);
+       POST_PROBEBLOCK_CALLSTACK();
+       POST_PROBEBLOCK_END();
+}
+
diff --git a/probe_socket/da_socket.h b/probe_socket/da_socket.h
new file mode 100644 (file)
index 0000000..eedf58a
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DA_SOCKET_H__
+#define __DA_SOCKET_H__
+
+#include "daprobe.h"
+
+#define POST_PROBEBLOCK_MIDDLE_SOCK(SIZE, FD, APITYPE, PATH)                           \
+       log.length += sprintf(log.data + log.length, "`,%u`,%d`,%d`,%d`,0`,%s", \
+                       SIZE, FD, FD_SOCKET, APITYPE, PATH)
+#define POST_PROBEBLOCK_MIDDLE_NOSOCK(SIZE, APITYPE, PATH)                             \
+       log.length += sprintf(log.data + log.length, "`,%u`,`,%d`,%d`,0`,%s",   \
+                       SIZE, FD_SOCKET, APITYPE, PATH)
+
+#define POST_PROBEBLOCK_CALLSTACK_SOCKET()     \
+       POST_PROBEBLOCK_CALLSTACK()
+
+#define AFTER_ORIGINAL_SOCK_RET(RTYPE, RVAL, SIZE, FD, APITYPE, INPUTFORMAT, ...)      \
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);              \
+       POST_PROBEBLOCK_MIDDLE_SOCK(SIZE, FD, APITYPE, "");                                                             \
+       POST_PROBEBLOCK_CALLSTACK_SOCKET();                                                                                             \
+       POST_PROBEBLOCK_END()
+
+#define AFTER_ORIGINAL_NOSOCK_RET(RTYPE, RVAL, SIZE, APITYPE, INPUTFORMAT, ...)        \
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);      \
+       POST_PROBEBLOCK_MIDDLE_NOSOCK(SIZE, APITYPE, "");                                                       \
+       POST_PROBEBLOCK_CALLSTACK_SOCKET();                                                                                     \
+       POST_PROBEBLOCK_END()
+
+#define AFTER_ORIGINAL_SOCK(SIZE, FD, APITYPE, INPUTFORMAT, ...)       \
+       AFTER_ORIGINAL_SOCK_RET(VT_INT, ret, SIZE, FD, APITYPE, INPUTFORMAT, __VA_ARGS__)
+
+#define AFTER_ORIGINAL_NOSOCK(SIZE, APITYPE, INPUTFORMAT, ...) \
+       AFTER_ORIGINAL_NOSOCK_RET(VT_INT, ret, SIZE, APITYPE, INPUTFORMAT, __VA_ARGS__)
+       
+#endif // __DA_SOCKET_H__
diff --git a/probe_socket/libdasocket.c b/probe_socket/libdasocket.c
new file mode 100644 (file)
index 0000000..9d10b19
--- /dev/null
@@ -0,0 +1,1445 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <stdbool.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <ifaddrs.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dautil.h"
+#include "da_socket.h"
+
+int socket(int domain, int type, int protocol)
+{
+       static int (*socketp)(int domain, int type, int protocol);
+       
+       BEFORE_ORIGINAL_NOFILTER(socket, libc.so.6);
+
+       ret = socketp(domain, type, protocol);
+       
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, VT_INT, ret, "%d, %d, %d", domain, type, protocol);
+       POST_PROBEBLOCK_MIDDLE_SOCK(0, ret, FD_API_OPEN, "");
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+
+       return ret;
+}
+
+int socketpair(int domain, int type, int protocol,int socket_vector[2])
+{
+       static int (*socketpairp)(int domain, int type, int protocol,int socket_vector[2]);
+       
+       BEFORE_ORIGINAL_NOFILTER(socketpair, libc.so.6);
+       
+       ret = socketpairp(domain, type, protocol, socket_vector);
+       
+       POST_PROBEBLOCK_BEGIN(LC_RESOURCE, VT_INT, ret,
+                       "%d, %d, %d, %p", domain, type, protocol, socket_vector);
+       log.length += sprintf(log.data + log.length, "`,%u`,%d/%d`,%d`,%d`,0`,%s",
+                       0, socket_vector[0], socket_vector[1], FD_SOCKET, FD_API_OPEN, "");
+       APPEND_LOG_CALLSTACK();
+       POST_PROBEBLOCK_END();
+       
+       return ret;
+}
+
+int shutdown(int socket, int how)
+{
+       static int (*shutdownp)(int socket, int how);
+       
+       BEFORE_ORIGINAL_NOFILTER(shutdown, libc.so.6);
+       
+       ret = shutdownp(socket, how);
+       
+       AFTER_ORIGINAL_SOCK(0, socket, FD_API_OTHER, "%d, %d", socket, how);
+
+       return ret;
+}
+
+int bind(int socket, const struct sockaddr *address, socklen_t address_len)
+{
+       static int (*bindp)(int socket, const struct sockaddr *address, socklen_t address_len);
+       
+       BEFORE_ORIGINAL(bind, libc.so.6);
+       
+       ret = bindp(socket, address, address_len);
+
+       AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE,
+                       "%d, %p, %d", socket, address, address_len);
+       
+       return ret;
+}
+
+int listen(int socket, int backlog)
+{
+       static int (*listenp)(int socket, int backlog);
+       
+       BEFORE_ORIGINAL(listen, libc.so.6);
+       
+       ret = listenp(socket, backlog);
+       
+       AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE, "%d, %d", socket, backlog);
+
+       return ret;
+}
+
+int accept(int socket, struct sockaddr *address, socklen_t *address_len)
+{
+       static int (*acceptp)(int socket, struct sockaddr *address, socklen_t *address_len);
+       
+       BEFORE_ORIGINAL_NOFILTER(accept, libc.so.6);
+       
+       ret = acceptp(socket, address, address_len);
+       
+       AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE,
+                       "%d, %p, %p", socket, address, address_len);
+       
+       return ret;
+}
+
+int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
+{
+       static int (*accept4p)(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
+       
+       BEFORE_ORIGINAL_NOFILTER(accept4, libc.so.6);
+       
+       ret = accept4p(sockfd, addr, addrlen, flags);
+       
+       AFTER_ORIGINAL_SOCK(0, sockfd, FD_API_MANAGE,
+                       "%d, %p, %p, %d", sockfd, addr, addrlen, flags);
+
+       return ret;
+}
+
+int connect(int socket, const struct sockaddr *address, socklen_t address_len)
+{
+       static int (*connectp)(int socket, const struct sockaddr *address, socklen_t address_len);
+       
+       BEFORE_ORIGINAL(connect, libc.so.6);
+       
+       ret = connectp(socket, address, address_len);
+       
+       AFTER_ORIGINAL_SOCK(address_len, socket, FD_API_MANAGE,
+                       "%d, %p, %d", socket, address, address_len);
+       
+       return ret;
+}
+
+int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
+{
+       static int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
+       
+       BEFORE_ORIGINAL(select, libc.so.6);
+       
+       ret = selectp(nfds, readfds, writefds,exceptfds, timeout);
+       
+       AFTER_ORIGINAL_SOCK(0, nfds, FD_API_MANAGE,
+                       "%d, %p, %p, %p, %p", nfds, readfds, writefds, exceptfds, timeout);
+                       
+       return ret;
+}
+
+int pselect(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask)
+{
+       static int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask);
+
+       BEFORE_ORIGINAL(pselect, libc.so.6);
+       
+       ret = pselectp(nfds, readfds, writefds,exceptfds, ntimeout, sigmask);
+       
+       AFTER_ORIGINAL_SOCK(0, nfds, FD_API_MANAGE,     "%d, %p, %p, %p, %p, %p",
+                       nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
+       return ret;
+}
+
+ssize_t send(int socket, const void *message, size_t length, int flags)
+{
+       static ssize_t (*sendp)(int socket, const void *message, size_t length, int flags);
+       ssize_t sret;
+       BEFORE_ORIGINAL(send, libc.so.6);
+       
+       sret = sendp(socket, message, length, flags);
+       
+       AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
+                       "%d, %p, %u, %d", socket, message, length, flags);
+       
+       return sret;
+}
+
+ssize_t sendmsg(int socket, const struct msghdr *message, int flags)
+{
+       static ssize_t (*sendmsgp)(int socket, const struct msghdr *message, int flags);
+       ssize_t sret;
+       BEFORE_ORIGINAL(sendmsg, libc.so.6);
+       
+       sret = sendmsgp(socket, message, flags);
+       
+       AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
+                       "%d, %p, %d", socket, message, flags);
+       return sret;
+}
+
+ssize_t sendto(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len)
+{
+       static ssize_t (*sendtop)(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len);
+       ssize_t sret;
+       BEFORE_ORIGINAL(sendto, libc.so.6);
+       
+       sret = sendtop(socket, message, length, flags, dest_addr, dest_len);
+       
+       AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
+                       "%d, %p, %u, %d, %p, %d", socket, message, length, flags, dest_addr, dest_len);
+       return sret;
+}
+
+ssize_t recv(int socket, void *buffer, size_t length, int flags)
+{
+       static ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags);
+       ssize_t sret;
+       BEFORE_ORIGINAL(recv, libc.so.6);
+
+       sret = recvp(socket, buffer, length, flags);
+       
+       AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
+                       "%d, %p, %u, %d", socket, buffer, length, flags);
+       
+       return sret;
+}
+
+ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
+{
+       static ssize_t (*recvfromp)(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len);
+       ssize_t sret;
+
+       BEFORE_ORIGINAL(recvfrom, libc.so.6);
+       
+       sret = recvfromp(socket, buffer, length, flags, address, address_len);
+       
+       AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
+                       "%d, %p, %u, %d, %p, %p", socket, buffer, length, flags, address, address_len);
+
+       return sret;
+}
+
+ssize_t recvmsg(int socket, struct msghdr *message, int flags)
+{
+       static ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags);
+       ssize_t sret;
+       BEFORE_ORIGINAL(recvmsg, libc.so.6);
+       
+       sret = recvmsgp(socket, message, flags);
+               
+       AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
+                       "%d, %p, %d", socket, message, flags);
+
+       return sret;
+}
+
+uint32_t htonl(uint32_t hostlong)
+{
+       static uint32_t (*htonlp)(uint32_t hostlong);
+       uint32_t uret;
+       BEFORE_ORIGINAL(htonl, libc.so.6);
+       
+       uret = htonlp(hostlong);
+                       
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER, "%u", hostlong); 
+       return uret;
+}
+
+uint16_t htons(uint16_t hostshort)
+{
+       static uint16_t (*htonsp)(uint16_t hostshort);
+       uint16_t uret;
+       BEFORE_ORIGINAL(htons, libc.so.6);
+       
+       uret = htonsp(hostshort);
+                               
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", hostshort); 
+       return uret;
+}
+
+uint32_t ntohl(uint32_t netlong)
+{
+       static uint32_t (*ntohlp)(uint32_t netlong);
+       uint32_t uret;
+       BEFORE_ORIGINAL(ntohl, libc.so.6);
+       
+       uret = ntohlp(netlong);
+                               
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER, "%u", netlong); 
+
+       return uret;
+}
+
+uint16_t ntohs(uint16_t netshort)
+{
+       static uint16_t (*ntohsp)(uint16_t netshort);
+       uint16_t uret;
+       BEFORE_ORIGINAL(ntohs, libc.so.6);
+       
+       uret = ntohsp(netshort);
+                               
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", netshort); 
+
+       return uret;
+}
+
+#if 0
+uint16_t htobe16(uint16_t host_16bits)
+{
+       static uint16_t (*htobe16p)(uint16_t host_16bits);
+       uint16_t uret;
+       BEFORE_ORIGINAL(htobe16, libc.so.6);
+       
+       uret = htobe16p(host_16bits);
+                               
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", host_16bits); 
+
+       return uret;
+}
+
+uint16_t htole16(uint16_t host_16bits)
+{
+       static uint16_t (*htole16p)(uint16_t host_16bits);
+       uint16_t uret;
+       BEFORE_ORIGINAL(htole16, libc.so.6);
+       
+       uret = htole16p(host_16bits);
+                               
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", host_16bits); 
+
+       return uret;
+}
+
+uint16_t be16toh(uint16_t big_endian_16bits)
+{
+       static uint16_t (*be16tohp)(uint16_t big_endian_16bits);
+       uint16_t uret;
+       BEFORE_ORIGINAL(be16toh, libc.so.6);
+       
+       uret = be16tohp(big_endian_16bits);
+                               
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
+                       "%u", big_endian_16bits); 
+       return uret;
+}
+
+uint16_t le16toh(uint16_t little_endian_16bits)
+{
+       static uint16_t (*le16tohp)(uint16_t little_endian_16bits);
+       uint16_t uret;
+       BEFORE_ORIGINAL(le16toh, libc.so.6);
+       
+       uret = le16tohp(little_endian_16bits);
+                               
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
+                       "%u", little_endian_16bits); 
+       return uret;
+}
+
+uint32_t htobe32(uint32_t host_32bits)
+{
+       static uint32_t (*htobe32p)(uint32_t host_32bits);
+       uint32_t uret;
+       BEFORE_ORIGINAL(htobe32, libc.so.6);
+
+       uret = htobe32p(host_32bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+                       "%u", host_32bits); 
+
+       return uret;
+}
+
+uint32_t htole32(uint32_t host_32bits)
+{
+       static uint32_t (*htole32p)(uint32_t host_32bits);
+       uint32_t uret;
+       BEFORE_ORIGINAL(htole32, libc.so.6);
+
+       uret = htole32p(host_32bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+                       "%u", host_32bits); 
+
+       return uret;
+}
+
+uint32_t be32toh(uint32_t big_endian_32bits)
+{
+       static uint32_t (*be32tohp)(uint32_t big_endian_32bits);
+       uint32_t uret;
+       BEFORE_ORIGINAL(be32toh, libc.so.6);
+
+       uret = be32tohp(big_endian_32bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+                       "%u", big_endian_32bits); 
+
+       return uret;
+}
+
+uint32_t le32toh(uint32_t little_endian_32bits)
+{
+       static uint32_t (*le32tohp)(uint32_t little_endian_32bits);
+       uint32_t uret;
+       BEFORE_ORIGINAL(le32toh, libc.so.6);
+
+       uret = le32tohp(little_endian_32bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+                       "%u", little_endian_32bits); 
+
+       return uret;
+}
+
+uint64_t htobe64(uint64_t host_64bits)
+{
+       static uint64_t (*htobe64p)(uint64_t host_64bits);
+       uint64_t uret;
+
+       BEFORE_ORIGINAL(htobe64, libc.so.6);
+
+       uret = htobe64p(host_64bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+                       "%u", host_64bits); 
+
+       return uret;
+}
+
+uint64_t htole64(uint64_t host_64bits)
+{
+       static uint64_t (*htole64p)(uint64_t host_64bits);
+       uint64_t uret;
+       BEFORE_ORIGINAL(htole64, libc.so.6);
+
+       uret = htole64p(host_64bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+                       "%u", host_64bits); 
+
+       return uret;
+}
+
+uint64_t be64toh(uint64_t big_endian_64bits)
+{
+       static uint64_t (*be64tohp)(uint64_t big_endian_64bits);
+       uint64_t uret;
+       BEFORE_ORIGINAL(be64toh, libc.so.6);
+
+       uret = be64tohp(big_endian_64bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+                       "%u", big_endian_64bits); 
+
+       return uret;
+}
+
+uint64_t le64toh(uint64_t little_endian_64bits)
+{
+       static uint64_t (*le64tohp)(uint64_t little_endian_64bits);
+       uint64_t uret;
+       BEFORE_ORIGINAL(le64toh, libc.so.6);
+
+       uret = le64tohp(little_endian_64bits);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+                       "%u", little_endian_64bits); 
+
+       return uret;
+}
+#endif
+
+#if 1
+int inet_aton(const char *cp, struct in_addr *inp)
+{
+       static int (*inet_atonp)(const char *cp, struct in_addr *inp);
+
+       BEFORE_ORIGINAL(inet_aton, libc.so.6);
+       
+       ret = inet_atonp(cp,inp);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p", cp, inp);
+       return ret;
+}
+
+in_addr_t inet_addr(const char *cp)
+{
+       static in_addr_t (*inet_addrp)(const char *cp);
+       in_addr_t iret;
+       BEFORE_ORIGINAL(inet_addr, libc.so.6);
+       iret = inet_addrp(cp);
+       
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, iret, 0, FD_API_OTHER, "%p", cp);
+       
+       return iret;
+}
+
+in_addr_t inet_network(const char *cp)
+{
+       static in_addr_t (*inet_networkp)(const char *cp);
+       in_addr_t iret;
+       BEFORE_ORIGINAL(inet_network, libc.so.6);
+       iret = inet_networkp(cp);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, iret, 0, FD_API_OTHER, "%p", cp);
+
+       return iret;
+}
+
+char *inet_ntoa(struct in_addr in)
+{
+       static char * (*inet_ntoap)(struct in_addr in);
+       char* sret;
+       BEFORE_ORIGINAL(inet_ntoa, libc.so.6);
+       sret = inet_ntoap(in);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, sret, 0, FD_API_OTHER, "%u", in.s_addr);
+       return sret;
+}
+
+#if 0
+struct in_addr inet_makeaddr(int net, int host)
+{
+       static struct in_addr (*inet_makeaddrp)(int net, int host);
+       struct in_addr iret;
+       BEFORE_ORIGINAL(inet_makeaddr, libc.so.6);
+       iret = inet_makeaddrp(net,host);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret.s_addr, 0, FD_API_OTHER,
+                       "%d, %d", net, host);
+
+       return iret;
+}
+#endif
+
+in_addr_t inet_lnaof(struct in_addr in)
+{
+       static in_addr_t (*inet_lnaofp)(struct in_addr in);
+       in_addr_t iret;
+       BEFORE_ORIGINAL(inet_lnaof, libc.so.6);
+       iret = inet_lnaofp(in);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret, 0, FD_API_OTHER, "%u", in.s_addr);
+       return iret;
+}
+
+in_addr_t inet_netof(struct in_addr in)
+{
+       static in_addr_t (*inet_netofp)(struct in_addr in);
+       in_addr_t iret;
+       BEFORE_ORIGINAL(inet_netof, libc.so.6);
+       iret = inet_netofp(in);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret, 0, FD_API_OTHER, "%u", in.s_addr);
+       return iret;
+}
+
+const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
+{
+       static const char* (*inet_ntopp)(int af, const void *src, char *dst, socklen_t size);
+       const char* cret;
+       BEFORE_ORIGINAL(inet_ntop, libc.so.6);
+       cret = inet_ntopp(af, src, dst, size);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, size, FD_API_OTHER,
+                       "%d, %p, %p, %d", af, src, dst, size);
+       return cret;
+}
+
+int inet_pton(int af, const char *src, void *dst)
+{
+       static int (*inet_ptonp)(int af, const char *src, void *dst);
+       BEFORE_ORIGINAL(inet_pton, libc.so.6);
+       ret = inet_ptonp(af, src, dst);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p", af, src, dst);
+       return ret;
+}
+
+int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
+{
+       static int (*getaddrinfop)(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
+       BEFORE_ORIGINAL_NOFILTER(getaddrinfo, libc.so.6);
+       ret = getaddrinfop(node, service, hints, res);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %p", node, service, hints, res);
+
+       return ret;
+}
+
+void freeaddrinfo(struct addrinfo *res)
+{
+       static void (*freeaddrinfop)(struct addrinfo *res);
+
+       BEFORE_ORIGINAL_NOFILTER(freeaddrinfo, libc.so.6);
+       freeaddrinfop(res);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", res);
+}
+
+const char *gai_strerror(int errcode)
+{
+       static const char * (*gai_strerrorp)(int errcode);
+       const char * cret;
+       BEFORE_ORIGINAL(gai_strerror, libc.so.6);
+       cret = gai_strerrorp(errcode);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER, "%d", errcode);
+
+       return cret;
+}
+
+int gai_suspend(const struct gaicb* const list[], int nitems, const struct timespec *timeout)
+{
+       static int (*gai_suspendp)(const struct gaicb* const list[], int nitems, const struct timespec *timeout);
+
+       BEFORE_ORIGINAL(gai_suspend, libc.so.6);
+       ret = gai_suspendp(list,nitems,timeout);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p", list, nitems, timeout);
+
+       return ret;
+}
+
+int gai_error(struct gaicb *req)
+{
+       static int (*gai_errorp)(struct gaicb *req);
+       BEFORE_ORIGINAL(gai_error, libc.so.6);
+       ret = gai_errorp(req);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", req);
+       return ret;
+}
+
+int gai_cancel(struct gaicb *req)
+{
+       static int (*gai_cancelp)(struct gaicb *req);
+       BEFORE_ORIGINAL(gai_cancel, libc.so.6);
+       ret = gai_cancelp(req);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", req);
+       return ret;
+}
+
+int getaddrinfo_a(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp)
+{
+       static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp);
+       BEFORE_ORIGINAL(getaddrinfo_a, libc.so.6);
+       ret = getaddrinfo_ap(mode, list,nitems, sevp);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %d, %p", mode, list, nitems, sevp);
+       return ret;
+}
+#endif
+
+int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
+{
+       static int (*getsockoptp)(int socket, int level, int option_name, void *option_value, socklen_t *option_len);
+       BEFORE_ORIGINAL(getsockopt, libc.so.6);
+       ret = getsockoptp(socket, level, option_name, option_value, option_len);
+
+       AFTER_ORIGINAL_SOCK(0, socket, FD_API_OPTION, "%d, %d, %d, %p, %p",
+                       socket, level, option_name, option_value, option_len);
+       return ret;
+}
+
+int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
+{
+       static int (*setsockoptp)(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
+       BEFORE_ORIGINAL(setsockopt, libc.so.6);
+
+       ret = setsockoptp(socket, level, option_name, option_value, option_len);
+
+       AFTER_ORIGINAL_SOCK(option_len, socket, FD_API_OPTION, "%d, %d, %d, %p, %d",
+                       socket, level, option_name, option_value, option_len);
+
+       return ret;
+}
+
+#if 1
+int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen )
+{
+       static int (*getsocknamep)(int sockfd, struct sockaddr *addr, socklen_t *addrlen );
+       BEFORE_ORIGINAL(getsockname, libc.so.6);
+       ret = getsocknamep(sockfd, addr, addrlen);
+
+       AFTER_ORIGINAL_SOCK(0, sockfd, FD_API_OTHER, "%d, %p, %p", sockfd, addr, addrlen);
+
+       return ret;
+}
+
+int getdomainname(char *name, size_t len)
+{
+       static int (*getdomainnamep)(char *name, size_t len);
+       BEFORE_ORIGINAL(getdomainname, libc.so.6);
+       ret = getdomainnamep(name, len);
+
+       AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
+
+       return ret;
+}
+
+int setdomainname(const char *name, size_t len)
+{
+       static int (*setdomainnamep)(const char *name, size_t len);
+       BEFORE_ORIGINAL(setdomainname, libc.so.6);
+       ret = setdomainnamep(name, len);
+
+       AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
+       return ret;
+}
+
+int gethostname(char *name, size_t len)
+{
+       static int (*gethostnamep)(char *name, size_t len);
+       BEFORE_ORIGINAL(gethostname, libc.so.6);
+       ret = gethostnamep(name, len);
+
+       AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
+       return ret;
+}
+
+int sethostname(const char *name, size_t len)
+{
+       static int (*sethostnamep)(const char *name, size_t len);
+       BEFORE_ORIGINAL(sethostname, libc.so.6);
+       ret = sethostnamep(name, len);
+
+       AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
+       return ret;
+}
+
+int getpeername(int s, struct sockaddr *addr, socklen_t *len)
+{
+       static int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len);
+
+       BEFORE_ORIGINAL(getpeername, libc.so.6);
+       ret = getpeernamep(s, addr, len);
+
+       AFTER_ORIGINAL_SOCK(0, s, FD_API_OTHER, "%d, %p, %p", s, addr, len);
+       return ret;
+}
+
+int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags)
+{
+       static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags);
+       BEFORE_ORIGINAL(getnameinfo, libc.so.6);
+       ret = getnameinfop(sa, salen,host, hostlen, serv, servlen, flags);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p, %u, %p, %u, %d",
+                       sa, salen, host, hostlen, serv, servlen, flags);
+       return ret;
+}
+
+struct hostent *gethostbyname(const char *name)
+{
+       static struct hostent * (*gethostbynamep)(const char *name);
+       struct hostent* pret;
+       BEFORE_ORIGINAL(gethostbyname, libc.so.6);
+
+       pret = gethostbynamep(name);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
+
+       return pret;
+}
+
+struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type)
+{
+       static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len, int type);
+       struct hostent* pret;
+       BEFORE_ORIGINAL(gethostbyaddr, libc.so.6);
+       pret = gethostbyaddrp(addr, len, type);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER,
+                       "%p, %d, %d", addr, len, type);
+
+       return pret;
+}
+
+void sethostent(int stayopen)
+{
+       static void (*sethostentp)(int stayopen);
+
+       BEFORE_ORIGINAL(sethostent, libc.so.6);
+       sethostentp(stayopen);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
+}
+
+void endhostent(void)
+{
+       static void (*endhostentp)(void);
+
+       BEFORE_ORIGINAL(endhostent, libc.so.6);
+
+       endhostentp();
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
+}
+
+void herror(const char *s)
+{
+       static void (*herrorp)(const char *s);
+
+       BEFORE_ORIGINAL(herror, libc.so.6);
+       herrorp(s);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", s);
+}
+
+const char *hstrerror(int err)
+{
+       static const char* (*hstrerrorp)(int err);
+       const char* cret;
+       BEFORE_ORIGINAL(hstrerror, libc.so.6);
+       cret = hstrerrorp(err);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER, "%d", err);
+
+       return cret;
+}
+
+struct hostent *gethostent(void)
+{
+       static struct hostent* (*gethostentp)(void);
+       struct hostent* pret;
+       BEFORE_ORIGINAL(gethostent, libc.so.6);
+       pret = gethostentp();
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
+
+       return pret;
+}
+
+struct hostent *gethostbyname2(const char *name, int af)
+{
+       static struct hostent * (*gethostbyname2p)(const char *name, int af);
+       struct hostent* pret;
+       BEFORE_ORIGINAL(gethostbyname2, libc.so.6);
+       pret = gethostbyname2p(name, af);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p, %d", name, af);
+
+       return pret;
+}
+
+int gethostent_r(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
+{
+       static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
+       BEFORE_ORIGINAL(gethostent_r, libc.so.6);
+       
+       ret = gethostent_rp(rret, buf, buflen, result, h_errnop);
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p, %p",
+                       rret, buf, buflen, result, h_errnop);
+
+       return ret;
+}
+
+int gethostbyaddr_r(const void *addr, socklen_t len, int type, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
+{
+       static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, int type, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
+
+       BEFORE_ORIGINAL(gethostbyaddr_r, libc.so.6);
+
+       ret = gethostbyaddr_rp(addr, len, type, rret, buf, buflen, result, h_errnop);
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %d, %p, %p, %u, %p, %p",
+                       addr, len, type, rret, buf, buflen, result, h_errnop);
+
+       return ret;
+}
+
+int gethostbyname_r(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
+{
+       static int (*gethostbyname_rp)(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
+       BEFORE_ORIGINAL(gethostbyname_r, libc.so.6);
+
+       ret = gethostbyname_rp(name, rret, buf, buflen, result, h_errnop);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p, %p",
+                       name, rret, buf, buflen, result, h_errnop);
+
+       return ret;
+}
+
+int gethostbyname2_r(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
+{
+       static int (*gethostbyname2_rp)(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
+       BEFORE_ORIGINAL(gethostbyname2_r, libc.so.6);
+       ret = gethostbyname2_rp(name, af, rret, buf, buflen, result, h_errnop);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p, %p, %u, %p, %p",
+                       name, af, rret, buf, buflen, result, h_errnop);
+       return ret;
+}
+
+struct servent *getservbyname(const char *name, const char *proto)
+{
+       static struct servent * (*getservbynamep)(const char *name, const char *proto);
+       struct servent* pret;
+       BEFORE_ORIGINAL(getservbyname, libc.so.6);
+       pret = getservbynamep(name, proto);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p, %p", name, proto);
+
+       return pret;
+}
+
+void setservent(int stayopen)
+{
+       static void (*setserventp)(int stayopen);
+
+       BEFORE_ORIGINAL(setservent, libc.so.6);
+       setserventp(stayopen);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
+}
+
+void endservent(void)
+{
+       static void (*endserventp)(void);
+
+       BEFORE_ORIGINAL(endservent, libc.so.6);
+       endserventp();
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
+}
+
+struct servent *getservent(void)
+{
+       static struct servent * (*getserventp)(void);
+       struct servent* pret;
+       BEFORE_ORIGINAL(getservent, libc.so.6);
+       pret = getserventp();
+       
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
+
+       return pret;
+}
+
+struct servent *getservbyport(int port, const char *proto)
+{
+       static struct servent * (*getservbyportp)(int port, const char *proto);
+       struct servent* pret;
+       BEFORE_ORIGINAL(getservbyport, libc.so.6);
+       pret = getservbyportp(port, proto);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%d, %p", port, proto);
+
+       return pret;
+}
+
+int getservent_r(struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
+{
+       static int (*getservent_rp)(struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
+       BEFORE_ORIGINAL(getservent_r, libc.so.6);
+       ret = getservent_rp(result_buf, buf, buflen, result);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p",
+                       result_buf, buf, buflen, result);
+
+       return ret;
+}
+
+int getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
+{
+       static int (*getservbyname_rp)(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
+       BEFORE_ORIGINAL(getservbyname_r, libc.so.6);
+       ret = getservbyname_rp(name, proto, result_buf, buf, buflen, result);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %p, %u, %p",
+                       name, proto, result_buf, buf, buflen, result);
+
+       return ret;
+}
+
+int getservbyport_r(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
+{
+       static int (*getservbyport_rp)(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
+       BEFORE_ORIGINAL(getservbyport_r, libc.so.6);
+       ret = getservbyport_rp(port, proto, result_buf, buf, buflen, result);
+       
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p, %p, %u, %p",
+                       port, proto, result_buf, buf, buflen, result);
+
+       return ret;
+}
+
+struct netent* getnetent(void)
+{
+       static struct netent * (*getnetentp)(void);
+       struct netent* pret;
+       BEFORE_ORIGINAL(getnetent, libc.so.6);
+       pret = getnetentp();
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
+
+       return pret;
+}
+
+struct netent *getnetbyname(const char *name)
+{
+       static struct netent * (*getnetbynamep)(const char *name);
+       struct netent* pret;
+       BEFORE_ORIGINAL(getnetbyname, libc.so.6);
+       pret = getnetbynamep(name);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
+       return pret;
+}
+
+struct netent *getnetbyaddr(uint32_t net, int type)
+{
+       static struct netent * (*getnetbyaddrp)(uint32_t net, int type);
+       struct netent * pret;
+       BEFORE_ORIGINAL(getnetbyaddr, libc.so.6);
+
+       pret = getnetbyaddrp(net, type);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%u, %d", net, type);
+
+       return pret;
+}
+
+void setnetent(int stayopen)
+{
+       static void (*setnetentp)(int stayopen);
+
+       BEFORE_ORIGINAL(setnetent, libc.so.6);
+       setnetentp(stayopen);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
+}
+
+void endnetent(void)
+{
+       static void (*endnetentp)(void);
+
+       BEFORE_ORIGINAL(endnetent, libc.so.6);
+       endnetentp();
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
+}
+
+int getnetent_r(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
+{
+       static int (*getnetent_rp)(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
+       BEFORE_ORIGINAL(getnetent_r, libc.so.6);
+       ret = getnetent_rp(result_buf, buf, buflen, result, h_errnop);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p, %p",
+                       result_buf, buf, buflen, result, h_errnop);
+
+       return ret;
+}
+
+int getnetbyname_r(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
+{
+       static int (*getnetbyname_rp)(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
+       BEFORE_ORIGINAL(getnetbyname_r, libc.so.6);
+       ret = getnetbyname_rp(name,result_buf, buf, buflen, result, h_errnop);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p, %p",
+                       name, result_buf, buf, buflen, result, h_errnop);
+
+       return ret;
+}
+
+int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
+{
+       static int (*getnetbyaddr_rp)(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
+       BEFORE_ORIGINAL(getnetbyaddr_r, libc.so.6);
+       ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, h_errnop);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%u, %d, %p, %p, %u, %p, %p",
+                       net, type, result_buf, buf, buflen, result, h_errnop);
+
+       return ret;
+}
+
+struct protoent *getprotoent(void)
+{
+       static struct protoent * (*getprotoentp)(void);
+       struct protoent * pret;
+       BEFORE_ORIGINAL(getprotoent, libc.so.6);
+       pret = getprotoentp();
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
+       return pret;
+}
+
+struct protoent *getprotobyname(const char *name)
+{
+       static struct protoent * (*getprotobynamep)(const char *name);
+       struct protoent * pret;
+       BEFORE_ORIGINAL(getprotobyname, libc.so.6);
+       pret = getprotobynamep(name);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
+
+       return pret;
+}
+
+struct protoent *getprotobynumber(int proto)
+{
+       static struct protoent * (*getprotobynumberp)(int proto);
+       struct protoent * pret;
+       BEFORE_ORIGINAL(getprotobynumber, libc.so.6);
+       pret = getprotobynumberp(proto);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%d", proto);
+
+       return pret;
+}
+
+void setprotoent(int stayopen)
+{
+       static void (*setprotoentp)(int stayopen);
+
+       BEFORE_ORIGINAL(setprotoent, libc.so.6);
+       setprotoentp(stayopen);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
+}
+
+void endprotoent(void)
+{
+       static void (*endprotoentp)(void);
+
+       BEFORE_ORIGINAL(endprotoent, libc.so.6);
+       endprotoentp();
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
+}
+
+int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
+{
+       static int (*getprotoent_rp)(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
+       BEFORE_ORIGINAL(getprotoent_r, libc.so.6);
+       ret = getprotoent_rp(result_buf, buf, buflen, result);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p",
+                       result_buf, buf, buflen, result);
+
+       return ret;
+}
+
+int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
+{
+       static int (*getprotobyname_rp)(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
+       BEFORE_ORIGINAL(getprotobyname_r, libc.so.6);
+       ret = getprotobyname_rp(name, result_buf, buf, buflen, result);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p",
+                       name, result_buf, buf, buflen, result);
+
+       return ret;
+}
+
+int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
+{
+       static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
+       BEFORE_ORIGINAL(getprotobynumber_r, libc.so.6);
+       ret = getprotobynumber_rp(proto, result_buf, buf, buflen, result);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p, %u, %p",
+                       proto, result_buf, buf, buflen, result);
+
+       return ret;
+}
+
+unsigned int if_nametoindex (__const char *__ifname)
+{
+       static unsigned int (*if_nametoindexp)(__const char *__ifname);
+       unsigned int uret;
+       BEFORE_ORIGINAL(if_nametoindex, libc.so.6);
+       uret = if_nametoindexp(__ifname);
+
+       AFTER_ORIGINAL_NOSOCK_RET(VT_UINT, uret, 0, FD_API_OTHER, "%p", __ifname);
+       return uret;
+}
+
+char *if_indextoname (unsigned int __ifindex, char *__ifname)
+{
+       static char * (*if_indextonamep)(unsigned int __ifindex, char *__ifname);
+       char * cret;
+       
+       BEFORE_ORIGINAL(if_indextoname, libc.so.6);
+       cret = if_indextonamep(__ifindex, __ifname);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER,
+                       "%u, %p", __ifindex, __ifname);
+
+       return cret;
+}
+
+struct if_nameindex *if_nameindex (void)
+{
+       static struct if_nameindex * (*if_nameindexp)(void);
+       struct if_nameindex * pret;
+       BEFORE_ORIGINAL_NOFILTER(if_nameindex, libc.so.6);
+       
+       pret = if_nameindexp();
+       AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
+
+       return pret;
+}
+
+void if_freenameindex (struct if_nameindex *__ptr)
+{
+       static void (*if_freenameindexp)(struct if_nameindex *__ptr);
+
+       BEFORE_ORIGINAL_NOFILTER(if_freenameindex, libc.so.6);
+       if_freenameindexp(__ptr);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", __ptr);
+}
+
+int getifaddrs(struct ifaddrs **ifap)
+{
+       static int (*getifaddrsp)(struct ifaddrs **ifap);
+       BEFORE_ORIGINAL_NOFILTER(getifaddrs, libc.so.6);
+       ret = getifaddrsp(ifap);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", ifap);
+       return ret;
+}
+
+void freeifaddrs(struct ifaddrs *ifa)
+{
+       static void (*freeifaddrsp)(struct ifaddrs *ifa);
+
+       BEFORE_ORIGINAL_NOFILTER(freeifaddrs, libc.so.6);
+       freeifaddrsp(ifa);
+       AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", ifa);
+}
+
+#if 0
+int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
+{
+       static int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout);
+       BEFORE_ORIGINAL(poll, libc.so.6);
+       ret = pollp(ufds, nfds, timeout);
+
+       AFTER_ORIGINAL_NOSOCK(timeout, FD_API_OTHER, "%p, %u, %d", ufds, nfds, timeout);
+
+       return ret;
+}
+
+int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask)
+{
+       static int (*ppollp)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask);
+       BEFORE_ORIGINAL(ppoll, libc.so.6);
+       ret = ppollp(fds, nfds, timeout_ts, sigmask);
+
+       AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %lu, %p, %p",
+                       fds, nfds, timeout_ts, sigmask);
+
+       return ret;
+}
+#endif
+
+#endif
diff --git a/probe_third/libdaemon.c b/probe_third/libdaemon.c
new file mode 100644 (file)
index 0000000..a714220
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdlib.h>    // for malloc
+#include <string.h>    // for memcpy
+#include <errno.h>     // for errno
+
+#include "daprobe.h"
+#include "dahelper.h"
+
+int daemon_close_allv(const int except_fds[])
+{
+       static int (*daemon_close_allvp)(const int except_fds[]);
+       int i, saved_errno, ret;
+       int* fds;
+
+       GET_REAL_FUNCP(daemon_close_allv, libdaemon.so.0, daemon_close_allvp);
+
+       probeBlockStart();
+       // get number of fds
+       for(i = 0; ; i++)
+       {
+               if(except_fds[i] == -1)
+                       break;
+       }
+
+       // allocate memory for new except fds
+       fds = (int*)malloc((i + 2) * sizeof(int));
+
+       // copy fds
+       if(fds)
+       {
+               if(i > 0)
+                       memcpy(fds, except_fds, i * sizeof(int));
+               fds[i] = gTraceInfo.socket.daemonSock;
+               fds[i + 1] = -1;
+       }
+       else
+       {
+               // do nothing
+       }
+       probeBlockEnd();
+
+       // call original function
+       if(fds)
+       {
+               ret = daemon_close_allvp(fds);
+       }
+       else
+       {
+               ret = daemon_close_allvp(except_fds);
+       }
+
+       probeBlockStart();
+       saved_errno = errno;
+       free(fds);
+       errno = saved_errno;
+       probeBlockEnd();
+
+       return ret;
+}
+
diff --git a/probe_thread/da_sync.h b/probe_thread/da_sync.h
new file mode 100644 (file)
index 0000000..46476f2
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DA_SYNC_H__
+#define __DA_SYNC_H__
+
+#include "daprobe.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+int real_pthread_mutex_lock(pthread_mutex_t *mutex);
+int real_pthread_mutex_unlock(pthread_mutex_t *mutex);
+
+#define BEFORE_ORIGINAL_SYNC(FUNCNAME, LIBNAME)        \
+       DECLARE_VARIABLE_STANDARD;                                              \
+       GET_REAL_FUNC(FUNCNAME, LIBNAME);                               \
+       PRE_PROBEBLOCK()
+
+#define POST_PROBEBLOCK_MIDDLE_SYNCVAL(SYNCVAL, SYNCTYPE, APITYPE)     \
+       log.length += sprintf(log.data + log.length, "`,%p`,%d`,%d",    \
+                       SYNCVAL, SYNCTYPE, APITYPE)
+
+#define POST_PROBEBLOCK_MIDDLE_NOSYNCVAL(SYNCTYPE, APITYPE)                    \
+       log.length += sprintf(log.data + log.length, "`,0`,%d`,%d",             \
+                       SYNCTYPE, APITYPE)
+
+#define AFTER_ORIGINAL_SYNCVAL_RET(RTYPE, RVAL, SYNCVAL, SYNCTYPE, APITYPE, INPUTFORMAT, ...)  \
+       POST_PROBEBLOCK_BEGIN(LC_SYNC, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);                                          \
+       POST_PROBEBLOCK_MIDDLE_SYNCVAL(SYNCVAL, SYNCTYPE, APITYPE);                                                                     \
+       POST_PROBEBLOCK_CALLSTACK();                                                                                                                            \
+       POST_PROBEBLOCK_END()
+
+#define AFTER_ORIGINAL_NOSYNCVAL_RET(RTYPE, RVAL, SYNCTYPE, APITYPE, INPUTFORMAT, ...)                 \
+       POST_PROBEBLOCK_BEGIN(LC_SYNC, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);                                          \
+       POST_PROBEBLOCK_MIDDLE_NOSYNCVAL(SYNCTYPE, APITYPE);                                                                            \
+       POST_PROBEBLOCK_CALLSTACK();                                                                                                                            \
+       POST_PROBEBLOCK_END()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __DA_SYNC_H__
+
diff --git a/probe_thread/da_thread.h b/probe_thread/da_thread.h
new file mode 100644 (file)
index 0000000..71aefc8
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DA_THREAD_H__
+#define __DA_THREAD_H__
+
+#include "daprobe.h"
+
+#define DECLARE_VARIABLE_THREAD                                                \
+       DECLARE_VARIABLE_STANDARD                                               
+//     pthread_t pSelf
+
+#define BEFORE_ORIGINAL_THREAD(FUNCNAME, LIBNAME)      \
+       DECLARE_VARIABLE_THREAD;                                                \
+       GET_REAL_FUNC(FUNCNAME, LIBNAME);                               \
+       PRE_PROBEBLOCK()
+
+#define POST_PROBEBLOCK_MIDDLE_THREAD(THREADVAL, APITYPE)                      \
+       log.length += sprintf(log.data + log.length, "`,%lu`,`,%d`,%d", \
+                       THREADVAL, THREAD_PTHREAD, APITYPE)
+
+#define AFTER_ORIGINAL_THREAD_RET(RTYPE, RVAL, THREADVAL, APITYPE, INPUTFORMAT, ...)   \
+       POST_PROBEBLOCK_BEGIN(LC_THREAD, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);                        \
+       POST_PROBEBLOCK_MIDDLE_THREAD(THREADVAL, APITYPE);                                                                      \
+       POST_PROBEBLOCK_CALLSTACK();                                                                                                            \
+       POST_PROBEBLOCK_END()
+
+#endif // __DA_THREAD_H__
+
diff --git a/probe_thread/libdasync.c b/probe_thread/libdasync.c
new file mode 100644 (file)
index 0000000..9012e2d
--- /dev/null
@@ -0,0 +1,534 @@
+/*
+ *  DA probe
+ *
+ * Copyright 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <pthread.h>
+#include <time.h>
+#include <errno.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dahelper.h"
+#include "da_sync.h"
+
+int pthread_mutex_init(pthread_mutex_t *mutex, 
+               const pthread_mutexattr_t *attr) {
+       static int (*pthread_mutex_initp)(pthread_mutex_t *mutex,
+                       const pthread_mutexattr_t *attr);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutex_init, libpthread.so.0);
+
+       ret = pthread_mutex_initp(mutex, attr);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, mutex, SYNC_PTHREAD_MUTEX, 
+                       SYNC_API_OTHER, "%p,%p", mutex, attr);
+
+       return ret;
+}
+
+int pthread_mutex_destroy(pthread_mutex_t *mutex) {
+       static int (*pthread_mutex_destroyp)(pthread_mutex_t *mutex);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutex_destroy, libpthread.so.0);
+
+       ret = pthread_mutex_destroyp(mutex);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, mutex, SYNC_PTHREAD_MUTEX, 
+                       SYNC_API_OTHER, "%p", mutex);
+
+       return ret;
+}
+
+int real_pthread_mutex_lock(pthread_mutex_t *mutex) {
+       static int (*pthread_mutex_lockp)(pthread_mutex_t *mutex);
+
+       GET_REAL_FUNC(pthread_mutex_lock, libpthread.so.0);
+
+       return pthread_mutex_lockp(mutex);
+}
+
+int pthread_mutex_lock(pthread_mutex_t *mutex) {
+       static int (*pthread_mutex_lockp)(pthread_mutex_t *mutex);
+       
+       DECLARE_VARIABLE_STANDARD;
+       GET_REAL_FUNC(pthread_mutex_lock, libpthread.so.0);
+
+       PRE_PROBEBLOCK_BEGIN();
+       // send WAIT_START log
+       INIT_LOG;
+       APPEND_LOG_BASIC(LC_SYNC);
+       APPEND_LOG_INPUT("%p", mutex);
+       //ret,PCAddr,errno,InternalCall
+       log.length += sprintf(log.data + log.length, "`,`,0`,0`,%d", blockresult);
+       APPEND_LOG_CALLER();
+       log.length += sprintf(log.data + log.length, "`,%p`,%d`,%d", mutex,
+                       SYNC_PTHREAD_MUTEX, SYNC_API_ACQUIRE_WAIT_START);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_PROBEBLOCK_END();
+
+       ret = pthread_mutex_lockp(mutex);
+
+       // send WAIT_END log
+       newerrno = errno;
+       if(postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               APPEND_LOG_BASIC(LC_SYNC);
+               APPEND_LOG_INPUT("%p", mutex);
+               APPEND_LOG_RESULT(VT_INT, ret);
+               APPEND_LOG_CALLER();
+
+               POST_PROBEBLOCK_MIDDLE_SYNCVAL(mutex, SYNC_PTHREAD_MUTEX, 
+                               SYNC_API_ACQUIRE_WAIT_END);
+               POST_PROBEBLOCK_CALLSTACK();
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+
+       return ret;
+}
+
+int pthread_mutex_timedlock(pthread_mutex_t *mutex,
+               const struct timespec *abs_timeout) {
+       static int (*pthread_mutex_timedlockp)(pthread_mutex_t *mutex,
+                       const struct timespec *abs_timeout);
+
+       DECLARE_VARIABLE_STANDARD;
+       GET_REAL_FUNC(pthread_mutex_timedlock, libpthread.so.0);
+
+       PRE_PROBEBLOCK_BEGIN();
+       // send WAIT_START log
+       INIT_LOG;
+       APPEND_LOG_BASIC(LC_SYNC);
+       APPEND_LOG_INPUT("%p,%p", mutex, abs_timeout);
+       //ret,PCAddr,errno,InternalCall
+       log.length += sprintf(log.data + log.length, "`,`,0`,0`,%d", blockresult);
+       APPEND_LOG_CALLER();
+       log.length += sprintf(log.data + log.length, "`,%p`,%d`,%d", mutex,
+                       SYNC_PTHREAD_MUTEX, SYNC_API_ACQUIRE_WAIT_START);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_PROBEBLOCK_END();
+
+       ret = pthread_mutex_timedlockp(mutex, abs_timeout);
+
+       // send WAIT_END log
+       newerrno = errno;
+       if(postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               APPEND_LOG_BASIC(LC_SYNC);
+               APPEND_LOG_INPUT("%p,%p", mutex, abs_timeout);
+               APPEND_LOG_RESULT(VT_INT, ret);
+               APPEND_LOG_CALLER();
+
+               POST_PROBEBLOCK_MIDDLE_SYNCVAL(mutex, SYNC_PTHREAD_MUTEX, 
+                               SYNC_API_ACQUIRE_WAIT_END);
+               POST_PROBEBLOCK_CALLSTACK();
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       
+       return ret;
+}
+
+int pthread_mutex_trylock(pthread_mutex_t *mutex) {
+       static int (*pthread_mutex_trylockp)(pthread_mutex_t *mutex);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutex_trylock, libpthread.so.0);
+
+       ret = pthread_mutex_trylockp(mutex);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, mutex, SYNC_PTHREAD_MUTEX, 
+                       SYNC_API_TRY_ACQUIRE, "%p", mutex);
+       
+       return ret;
+}
+
+int real_pthread_mutex_unlock(pthread_mutex_t *mutex) {
+       static int (*pthread_mutex_unlockp)(pthread_mutex_t *mutex);
+
+       GET_REAL_FUNC(pthread_mutex_unlock, libpthread.so.0);
+
+       return pthread_mutex_unlockp(mutex);
+}
+
+int pthread_mutex_unlock(pthread_mutex_t *mutex) {
+       static int (*pthread_mutex_unlockp)(pthread_mutex_t *mutex);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutex_unlock, libpthread.so.0);
+
+       ret = pthread_mutex_unlockp(mutex);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, mutex, SYNC_PTHREAD_MUTEX, 
+                       SYNC_API_RELEASE, "%p", mutex);
+       
+       return ret;
+}
+
+int pthread_mutexattr_init(pthread_mutexattr_t *attr) {
+       static int (*pthread_mutexattr_initp)(pthread_mutexattr_t *attr);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_init, libpthread.so.0);
+
+       ret = pthread_mutexattr_initp(attr);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p", attr);
+
+       return ret;
+}
+
+int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) {
+       static int (*pthread_mutexattr_destroyp)(pthread_mutexattr_t *attr);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_destroy, libpthread.so.0);
+
+       ret = pthread_mutexattr_destroyp(attr);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p", attr);
+
+       return ret;
+}
+
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *attr,
+               int *prioceiling) {
+       static int (*pthread_mutexattr_getprioceilingp)(
+                       const pthread_mutexattr_t *attr, int *prioceiling);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_getprioceiling, libpthread.so.0);
+
+       ret = pthread_mutexattr_getprioceilingp(attr, prioceiling);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%p", attr, prioceiling);
+
+       return ret;
+}
+
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, 
+               int prioceiling) {
+       static int (*pthread_mutexattr_setprioceilingp)(
+                       pthread_mutexattr_t *attr, int prioceiling);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_setprioceiling, libpthread.so.0);
+
+       ret = pthread_mutexattr_setprioceilingp(attr, prioceiling);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%d", attr, prioceiling);
+
+       return ret;
+}
+
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, 
+               int *protocol) {
+       static int (*pthread_mutexattr_getprotocolp)(
+                       const pthread_mutexattr_t *attr, int *protocol);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_getprotocol, libpthread.so.0);
+
+       ret = pthread_mutexattr_getprotocolp(attr, protocol);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%p", attr, protocol);
+
+       return ret;
+}
+
+int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, 
+               int protocol) {
+       static int (*pthread_mutexattr_setprotocolp)(
+                       pthread_mutexattr_t *attr, int protocol);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_setprotocol, libpthread.so.0);
+
+       ret = pthread_mutexattr_setprotocolp(attr, protocol);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%d", attr, protocol);
+
+       return ret;
+}
+
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, 
+               int *pshared) {
+       static int (*pthread_mutexattr_getpsharedp)(
+                       const pthread_mutexattr_t *attr, int *pshared);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_getpshared, libpthread.so.0);
+
+       ret = pthread_mutexattr_getpsharedp(attr, pshared);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%p", attr, pshared);
+
+       return ret;
+}
+
+int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, 
+               int pshared) {
+       static int (*pthread_mutexattr_setpsharedp)(
+                       pthread_mutexattr_t *attr, int pshared);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_setpshared, libpthread.so.0);
+
+       ret = pthread_mutexattr_setpsharedp(attr, pshared);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%d", attr, pshared);
+
+       return ret;
+}
+
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type) {
+       static int (*pthread_mutexattr_gettypep)(
+                       const pthread_mutexattr_t *attr, int *type);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_gettype, libpthread.so.0);
+
+       ret = pthread_mutexattr_gettypep(attr, type);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%p", attr, type);
+
+       return ret;
+}
+
+int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) {
+       static int (*pthread_mutexattr_settypep)(
+                       pthread_mutexattr_t *attr, int type);
+
+       BEFORE_ORIGINAL_SYNC(pthread_mutexattr_settype, libpthread.so.0);
+
+       ret = pthread_mutexattr_settypep(attr, type);
+
+       AFTER_ORIGINAL_NOSYNCVAL_RET(VT_INT, ret, SYNC_PTHREAD_MUTEX,
+                       SYNC_API_OTHER, "%p,%d", attr, type);
+
+       return ret;
+}
+
+/*
+int pthread_mutex_getprioceiling(const pthread_mutex_t *mutex,
+               int *prioceiling);
+int pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
+               int prioceiling, int *old_ceiling);
+*/
+
+int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) {
+       static int (*pthread_cond_initp)(pthread_cond_t *cond,
+                       const pthread_condattr_t *attr);
+
+       BEFORE_ORIGINAL_SYNC(pthread_cond_init, libpthread.so.0);
+
+       ret = pthread_cond_initp(cond, attr);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, cond, SYNC_PTHREAD_COND_VARIABLE, 
+                       SYNC_API_OTHER, "%p,%p", cond, attr);
+
+       return ret;
+}
+
+int pthread_cond_destroy(pthread_cond_t *cond) {
+       static int (*pthread_cond_destroyp)(pthread_cond_t *cond);
+
+       BEFORE_ORIGINAL_SYNC(pthread_cond_destroy, libpthread.so.0);
+
+       ret = pthread_cond_destroyp(cond);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, cond, SYNC_PTHREAD_COND_VARIABLE, 
+                       SYNC_API_OTHER, "%p", cond);
+
+       return ret;
+}
+
+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) {
+       static int (*pthread_cond_waitp)(pthread_cond_t *cond,
+                       pthread_mutex_t *mutex);
+
+       DECLARE_VARIABLE_STANDARD;
+       GET_REAL_FUNC(pthread_cond_wait, libpthread.so.0);
+
+       PRE_PROBEBLOCK_BEGIN();
+       // send WAIT_START log
+       INIT_LOG;
+       APPEND_LOG_BASIC(LC_SYNC);
+       APPEND_LOG_INPUT("%p,%p", cond, mutex);
+       //ret,PCAddr,errno,InternalCall
+       log.length += sprintf(log.data + log.length, "`,`,0`,0`,%d", blockresult);
+       APPEND_LOG_CALLER();
+       log.length += sprintf(log.data + log.length, "`,%p`,%d`,%d", cond,
+                       SYNC_PTHREAD_COND_VARIABLE, SYNC_API_COND_WAIT_START);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_PROBEBLOCK_END();
+
+       ret = pthread_cond_waitp(cond, mutex);
+
+       // send WAIT_END log
+       newerrno = errno;
+       if(postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               APPEND_LOG_BASIC(LC_SYNC);
+               APPEND_LOG_INPUT("%p,%p", cond, mutex);
+               APPEND_LOG_RESULT(VT_INT, ret);
+               APPEND_LOG_CALLER();
+
+               POST_PROBEBLOCK_MIDDLE_SYNCVAL(cond, SYNC_PTHREAD_COND_VARIABLE, 
+                               SYNC_API_COND_WAIT_END);
+               POST_PROBEBLOCK_CALLSTACK();
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+
+       return ret;
+}
+
+int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
+               const struct timespec *abstime) {
+       static int (*pthread_cond_timedwaitp)(pthread_cond_t *cond,
+                               pthread_mutex_t *mutex, const struct timespec *abstime);
+
+       DECLARE_VARIABLE_STANDARD;
+       GET_REAL_FUNC(pthread_cond_timedwait, libpthread.so.0);
+
+       PRE_PROBEBLOCK_BEGIN();
+       // send WAIT_START log
+       INIT_LOG;
+       APPEND_LOG_BASIC(LC_SYNC);
+       APPEND_LOG_INPUT("%p,%p,%p", cond, mutex, abstime);
+       //ret,PCAddr,errno,InternalCall
+       log.length += sprintf(log.data + log.length, "`,`,0`,0`,%d", blockresult);
+       APPEND_LOG_CALLER();
+       log.length += sprintf(log.data + log.length, "`,%p`,%d`,%d", cond,
+                       SYNC_PTHREAD_COND_VARIABLE, SYNC_API_COND_WAIT_START);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_PROBEBLOCK_END();
+
+       ret = pthread_cond_timedwaitp(cond, mutex, abstime);
+
+       // send WAIT_END log
+       newerrno = errno;
+       if(postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               APPEND_LOG_BASIC(LC_SYNC);
+               APPEND_LOG_INPUT("%p,%p,%p", cond, mutex, abstime);
+               APPEND_LOG_RESULT(VT_INT, ret);
+               APPEND_LOG_CALLER();
+
+               POST_PROBEBLOCK_MIDDLE_SYNCVAL(cond, SYNC_PTHREAD_COND_VARIABLE, 
+                               SYNC_API_COND_WAIT_END);
+               POST_PROBEBLOCK_CALLSTACK();
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+
+       return ret;
+}
+
+int pthread_cond_signal(pthread_cond_t *cond) {
+       static int (*pthread_cond_signalp)(pthread_cond_t *cond);
+
+       BEFORE_ORIGINAL_SYNC(pthread_cond_signal, libpthread.so.0);
+
+       ret = pthread_cond_signalp(cond);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, cond, SYNC_PTHREAD_COND_VARIABLE, 
+                       SYNC_API_NOTIFY, "%p", cond);
+       
+       return ret;
+}
+
+int pthread_cond_broadcast(pthread_cond_t *cond) {
+       static int (*pthread_cond_broadcastp)(pthread_cond_t *cond);
+
+       BEFORE_ORIGINAL_SYNC(pthread_cond_broadcast, libpthread.so.0);
+
+       ret = pthread_cond_broadcastp(cond);
+
+       AFTER_ORIGINAL_SYNCVAL_RET(VT_INT, ret, cond, SYNC_PTHREAD_COND_VARIABLE, 
+                       SYNC_API_NOTIFY_ALL, "%p", cond);
+       
+       return ret;
+}
+
+/*
+int pthread_condattr_init(pthread_condattr_t *attr);
+int pthread_condattr_destroy(pthread_condattr_t *attr);
+int pthread_condattr_getclock(const pthread_condattr_t *attr,
+               clockid_t *clock_id);
+int pthread_condattr_setclock(pthread_condattr_t *attr,
+               clockid_t clock_id);
+int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared);
+int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared);
+*/
+
+/*
+int pthread_rwlock_init(pthread_rwlock_t *rwlock,
+               const pthread_rwlockattr_t *attr);
+int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
+int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock); 
+int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock,
+               const struct timespec *abs_timeout);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock,
+               const struct timespec *abs_timeout);
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock);
+int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock);
+int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
+int pthread_rwlockattr_init(pthread_rwlockattr_t *attr);
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr,
+               int *pshared);
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr,
+               int pshared);
+
+int pthread_spin_init(pthread_spinlock_t *lock, int pshared);
+int pthread_spin_destroy(pthread_spinlock_t *lock);
+int pthread_spin_lock(pthread_spinlock_t *lock);
+int pthread_spin_trylock(pthread_spinlock_t *lock);
+int pthread_spin_unlock(pthread_spinlock_t *lock);
+
+int pthread_barrier_init(pthread_barrier_t *barrier,
+               const pthread_barrierattr_t *attr, unsigned int count);
+int pthread_barrier_destroy(pthread_barrier_t *barrier);
+int pthread_barrier_wait(pthread_barrier_t *barrier);
+int pthread_barrierattr_init(pthread_barrierattr_t *attr);
+int pthread_barrierattr_destroy(pthread_barrierattr_t *attr);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, 
+               int *pshared);
+int pthread_barrierattr_setpshared(pthread_barrierattr_t, 
+               int pshared);
+*/
+
diff --git a/probe_thread/libdathread.c b/probe_thread/libdathread.c
new file mode 100644 (file)
index 0000000..c4dfb79
--- /dev/null
@@ -0,0 +1,648 @@
+/*
+ *  DA probe
+ *
+ * Copyright 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <pthread.h>
+#include <errno.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dahelper.h"
+#include "da_thread.h"
+
+typedef struct thread_routine_call_t {
+       void *(*thread_routine)(void *);
+       void *argument;
+} thread_routine_call;
+
+// called when pthread_exit, pthread_cancel is called
+void _da_cleanup_handler(void *data)
+{
+       pthread_t pSelf;
+
+       DECLARE_COMMON_VARIABLE;
+       INIT_LOG;
+       
+       PRE_UNCONDITIONAL_BLOCK_BEGIN();
+       APPEND_LOG_BASIC(LC_THREAD);
+       // input,ret,PCAddr,errno,InternalCall,CallerPCAddr
+       log.length += sprintf(log.data + log.length, "`,`,`,0`,0`,1`,0");
+       pSelf = pthread_self();
+       log.length += sprintf(log.data + log.length, "`,%lu`,`,%d`,%d",
+                       pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_STOP);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_UNCONDITIONAL_BLOCK_END();
+
+       return;
+}
+
+void *_da_ThreadProc(void *params)
+{
+       void *ret;
+       thread_routine_call *ptrc;
+       ptrc = (thread_routine_call *) params;
+       pthread_t pSelf;
+
+       DECLARE_COMMON_VARIABLE;
+
+       // send INTERNAL_START log
+       INIT_LOG;
+
+       PRE_UNCONDITIONAL_BLOCK_BEGIN();
+       APPEND_LOG_BASIC(LC_THREAD);
+       // input,ret,PCAddr,errno,InternalCall,CallerPCAddr
+       log.length += sprintf(log.data + log.length, "`,`,`,0`,0`,1`,0");
+       pSelf = pthread_self();
+       log.length += sprintf(log.data + log.length, "`,%lu`,`,%d`,%d",
+                       pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_START);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_UNCONDITIONAL_BLOCK_END();
+
+       pthread_cleanup_push(_da_cleanup_handler, NULL);
+       // call user-defined thread routine
+       ret = ptrc->thread_routine(ptrc->argument);
+       pthread_cleanup_pop(0);
+
+       // send INTERNAL_STOP log
+       INIT_LOG;
+
+       PRE_UNCONDITIONAL_BLOCK_BEGIN();
+       APPEND_LOG_BASIC(LC_THREAD);
+       // input,ret,PCAddr,errno,InternalCall,CallerPCAddr
+       log.length += sprintf(log.data + log.length, "`,`,`,0`,0`,1`,0");
+       pSelf = pthread_self();
+       log.length += sprintf(log.data + log.length, "`,%lu`,`,%d`,%d",
+                       pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_STOP);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_UNCONDITIONAL_BLOCK_END();
+       
+       free(ptrc);
+       return ret;
+}
+
+int pthread_create(pthread_t *thread, const pthread_attr_t *attr, 
+               void *(*start_routine) (void*), void *arg)
+{
+       static int (*pthread_createp)(pthread_t *thread,
+                       const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
+
+       BEFORE_ORIGINAL_THREAD(pthread_create, libpthread.so.0);
+
+       if(blockresult)
+       {
+               probeBlockStart();      
+               thread_routine_call *ptrc = 
+                       (thread_routine_call *) malloc(sizeof(thread_routine_call));
+               ptrc->thread_routine = start_routine;
+               ptrc->argument = arg;
+               probeBlockEnd();
+
+               ret = pthread_createp(thread, attr, _da_ThreadProc, (void *) ptrc);
+       }
+       else // when pthread_create is called inside probe so (ex. custom chart, sampling thread)
+       {
+               ret = pthread_createp(thread, attr, start_routine, arg);
+       }
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, *thread, THREAD_API_START, 
+                       "%p,%p,%p,%p", thread, attr, start_routine, arg);
+
+       return ret;
+}
+
+int pthread_join(pthread_t thread, void **retval)
+{
+       static int (*pthread_joinp)(pthread_t thread, void **retval);
+
+       DECLARE_VARIABLE_STANDARD;
+       GET_REAL_FUNC(pthread_join, libpthread.so.0);
+
+       PRE_PROBEBLOCK_BEGIN();
+       // send WAIT_START log
+       INIT_LOG;
+       APPEND_LOG_BASIC(LC_THREAD);
+       APPEND_LOG_INPUT("%lu,%p", thread, retval);
+       //ret,PCAddr,errno,InternalCall
+       log.length += sprintf(log.data + log.length, "`,`,0`,0`,%d", blockresult);
+       APPEND_LOG_CALLER();
+       log.length += sprintf(log.data + log.length, "`,%lu`,`,%d`,%d", thread, 
+                       THREAD_PTHREAD, THREAD_API_WAIT_START);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_PROBEBLOCK_END();
+
+       ret = pthread_joinp(thread, retval);
+
+       // send WAIT_END log
+       newerrno = errno;
+       if(postBlockBegin(blockresult)) {
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               APPEND_LOG_BASIC(LC_THREAD);
+               APPEND_LOG_INPUT("%lu,%p", thread, retval);
+               APPEND_LOG_RESULT(VT_INT, ret);
+               APPEND_LOG_CALLER();
+
+               POST_PROBEBLOCK_MIDDLE_THREAD(thread, THREAD_API_WAIT_END);
+               POST_PROBEBLOCK_CALLSTACK();
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+       
+       return ret;     
+}
+
+void pthread_exit(void *retval)
+{
+       pthread_t pSelf;
+       static void (*pthread_exitp)(void *retval) __attribute__((noreturn));
+
+       DECLARE_VARIABLE_STANDARD;
+       GET_REAL_FUNC(pthread_exit, libpthread.so.0);
+
+       PRE_PROBEBLOCK_BEGIN();
+       newerrno = 0;
+       INIT_LOG;
+       APPEND_LOG_BASIC(LC_THREAD);
+       APPEND_LOG_INPUT("%p", retval);
+       //ret,PCAddr,errno,InternalCall
+       log.length += sprintf(log.data + log.length, "`,`,0`,0`,%d", blockresult);
+       APPEND_LOG_CALLER();
+       pSelf = pthread_self();
+       log.length += sprintf(log.data + log.length, "`,%lu`,`,%d`,%d",
+                       pSelf, THREAD_PTHREAD, THREAD_API_EXIT);
+       APPEND_LOG_NULL_CALLSTACK();
+       printLog(&log, MSG_LOG);
+       PRE_PROBEBLOCK_END();
+
+       pthread_exitp(retval);
+}
+
+int pthread_cancel(pthread_t thread)
+{
+       static int (*pthread_cancelp)(pthread_t thread);
+
+       BEFORE_ORIGINAL_THREAD(pthread_cancel, libpthread.so.0);
+
+       ret = pthread_cancelp(thread);
+       
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_STOP, "%lu", thread);
+
+       return ret;
+}
+
+int pthread_detach(pthread_t thread)
+{
+       static int (*pthread_detachp)(pthread_t thread);
+
+       BEFORE_ORIGINAL_THREAD(pthread_detach, libpthread.so.0);
+
+       ret = pthread_detachp(thread);
+       
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, "%lu", thread);
+
+       return ret;
+}
+
+pthread_t pthread_self(void)
+{
+       pthread_t ret_pthr;
+       static pthread_t (*pthread_selfp)(void);
+
+       BEFORE_ORIGINAL_THREAD(pthread_self, libpthread.so.0);
+
+       ret_pthr = pthread_selfp();
+       
+       newerrno = errno;
+       if(postBlockBegin(blockresult)) {
+               INIT_LOG;
+               APPEND_LOG_BASIC(LC_THREAD);
+               log.length += sprintf(log.data + log.length, "`,");
+               APPEND_LOG_RESULT(VT_ULONG, ret_pthr);
+               APPEND_LOG_CALLER();
+
+               POST_PROBEBLOCK_MIDDLE_THREAD(ret_pthr, THREAD_API_OTHER);
+               POST_PROBEBLOCK_CALLSTACK();
+               printLog(&log, MSG_LOG);
+               postBlockEnd();
+       }
+
+       return ret_pthr;
+}
+
+int pthread_equal(pthread_t t1, pthread_t t2)
+{
+       static int (*pthread_equalp)(pthread_t t1, pthread_t t2);
+
+       BEFORE_ORIGINAL_THREAD(pthread_equal, libpthread.so.0);
+
+       ret = pthread_equalp(t1, t2);
+       
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, t1, THREAD_API_OTHER, "%lu,%lu", t1, t2);
+
+       return ret;
+}
+
+int pthread_setcancelstate(int state, int *oldstate)
+{
+       pthread_t pSelf;
+       static int (*pthread_setcancelstatep)(int state, int *oldstate);
+
+       BEFORE_ORIGINAL_THREAD(pthread_setcancelstate, libpthread.so.0);
+
+       pSelf = pthread_self();
+       ret = pthread_setcancelstatep(state, oldstate);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, pSelf, THREAD_API_OTHER, 
+                       "%d,%p", state, oldstate); 
+
+       return ret;
+}
+
+int pthread_setcanceltype(int type, int *oldtype)
+{
+       pthread_t pSelf;
+       static int (*pthread_setcanceltypep)(int type, int *oldtype);
+
+       BEFORE_ORIGINAL_THREAD(pthread_setcanceltype, libpthread.so.0);
+
+       pSelf = pthread_self();
+       ret = pthread_setcanceltypep(type, oldtype);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, pSelf, THREAD_API_OTHER, 
+                       "%d,%p", type, oldtype); 
+
+       return ret;
+}
+
+int pthread_attr_init(pthread_attr_t *attr)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_initp)(pthread_attr_t *attr);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_init, libpthread.so.0);
+
+       ret = pthread_attr_initp(attr);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, "%p", attr);
+
+       return ret;
+}
+
+int pthread_attr_destroy(pthread_attr_t *attr) 
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_destroyp)(pthread_attr_t *attr);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_destroy, libpthread.so.0);
+
+       ret = pthread_attr_destroyp(attr);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, "%p", attr);
+
+       return ret;
+}
+
+int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getdetachstatep)(const pthread_attr_t *attr,
+                       int *detachstate);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getdetachstate, libpthread.so.0);
+
+       ret = pthread_attr_getdetachstatep(attr, detachstate);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, detachstate);
+
+       return ret;
+}
+
+int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setdetachstatep)(pthread_attr_t *attr, 
+                       int detachstate);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setdetachstate, libpthread.so.0);
+
+       ret = pthread_attr_setdetachstatep(attr, detachstate);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%d", attr, detachstate);
+
+       return ret;
+}
+
+int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getstacksizep)(const pthread_attr_t *attr,
+                       size_t *stacksize);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getstacksize, libpthread.so.0);
+
+       ret = pthread_attr_getstacksizep(attr, stacksize);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, stacksize);
+
+       return ret;
+}
+
+int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setstacksizep)(pthread_attr_t *attr, 
+                       size_t stacksize);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setstacksize, libpthread.so.0);
+
+       ret = pthread_attr_setstacksizep(attr, stacksize);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%u", attr, stacksize);
+
+       return ret;
+}
+
+int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getstackaddrp)(const pthread_attr_t *attr,
+                       void **stackaddr);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getstackaddr, libpthread.so.0);
+
+       ret = pthread_attr_getstackaddrp(attr, stackaddr);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, stackaddr);
+
+       return ret;
+}
+
+int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setstackaddrp)(pthread_attr_t *attr, 
+                       void *stackaddr);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setstackaddr, libpthread.so.0);
+
+       ret = pthread_attr_setstackaddrp(attr, stackaddr);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, stackaddr);
+
+       return ret;
+}
+
+int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getinheritschedp)(const pthread_attr_t *attr,
+                       int *inheritsched);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getinheritsched, libpthread.so.0);
+
+       ret = pthread_attr_getinheritschedp(attr, inheritsched);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, inheritsched);
+
+       return ret;
+}
+
+int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setinheritschedp)(pthread_attr_t *attr, 
+                       int inheritsched);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setinheritsched, libpthread.so.0);
+
+       ret = pthread_attr_setinheritschedp(attr, inheritsched);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%d", attr, inheritsched);
+
+       return ret;
+}
+
+int pthread_attr_getschedparam(const pthread_attr_t *attr,
+               struct sched_param *param)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getschedparamp)(const pthread_attr_t *attr,
+                       struct sched_param *param);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getschedparam, libpthread.so.0);
+
+       ret = pthread_attr_getschedparamp(attr, param);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, param);
+
+       return ret;
+}
+
+int pthread_attr_setschedparam(pthread_attr_t *attr, 
+               const struct sched_param *param)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setschedparamp)(pthread_attr_t *attr,
+                       const struct sched_param *param);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setschedparam, libpthread.so.0);
+
+       ret = pthread_attr_setschedparamp(attr, param);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, param);
+
+       return ret;
+}
+
+int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getschedpolicyp)(const pthread_attr_t *attr,
+                       int *policy);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getschedpolicy, libpthread.so.0);
+
+       ret = pthread_attr_getschedpolicyp(attr, policy);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, policy);
+
+       return ret;
+}
+
+int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setschedpolicyp)(pthread_attr_t *attr, 
+                       int policy);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setschedpolicy, libpthread.so.0);
+
+       ret = pthread_attr_setschedpolicyp(attr, policy);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%d", attr, policy);
+
+       return ret;
+}
+
+int pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getguardsizep)(const pthread_attr_t *attr,
+                       size_t *guardsize);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getguardsize, libpthread.so.0);
+
+       ret = pthread_attr_getguardsizep(attr, guardsize);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, guardsize);
+
+       return ret;
+}
+
+int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setguardsizep)(pthread_attr_t *attr, 
+                       size_t guardsize);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setguardsize, libpthread.so.0);
+
+       ret = pthread_attr_setguardsizep(attr, guardsize);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%u", attr, guardsize);
+
+       return ret;
+}
+
+int pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getscopep)(const pthread_attr_t *attr,
+                       int *contentionscope);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getscope, libpthread.so.0);
+
+       ret = pthread_attr_getscopep(attr, contentionscope);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p", attr, contentionscope);
+
+       return ret;
+}
+
+int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setscopep)(pthread_attr_t *attr, 
+                       int contentionscope);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setscope, libpthread.so.0);
+
+       ret = pthread_attr_setscopep(attr, contentionscope);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%d", attr, contentionscope);
+
+       return ret;
+}
+
+int pthread_attr_getstack(const pthread_attr_t *attr, 
+               void **stackaddr, size_t *stacksize)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_getstackp)(const pthread_attr_t *attr,
+                       void **stackaddr, size_t *stacksize);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_getstack, libpthread.so.0);
+
+       ret = pthread_attr_getstackp(attr, stackaddr, stacksize);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p,%p", attr, stackaddr, stacksize);
+
+       return ret;
+}
+
+int pthread_attr_setstack(pthread_attr_t *attr,
+               void *stackaddr, size_t stacksize)
+{
+       pthread_t thread = 0;
+       static int (*pthread_attr_setstackp)(pthread_attr_t *attr,
+                       void *stackaddr, size_t stacksize);
+
+       BEFORE_ORIGINAL_THREAD(pthread_attr_setstack, libpthread.so.0);
+
+       ret = pthread_attr_setstackp(attr, stackaddr, stacksize);
+
+       AFTER_ORIGINAL_THREAD_RET(VT_INT, ret, thread, THREAD_API_OTHER, 
+                       "%p,%p,%u", attr, stackaddr, stacksize);
+
+       return ret;
+}
+
+/*
+void pthread_testcancel(void);
+
+int pthread_key_create(pthread_key_t *key, void (*destructor)(void*));
+int pthread_key_delete(pthread_key_t key);
+
+int pthread_getconcurrency(void);
+int pthread_setconcurrency(int new_level);
+int pthread_getcpuclockid(pthread_t thread_id, clockid_t *clock_id);
+int pthread_getschedparam(pthread_t thread, int *policy,
+               struct sched_param *param);
+int pthread_setschedparam(pthread_t thread, int policy,
+               const struct sched_param *param);
+int pthread_setschedprio(pthread_t thread, int prio);
+void *pthread_getspecific(pthread_key_t key);
+int pthread_setspecific(pthread_key_t key, const void *value);
+
+int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
+
+int pthread_atfork(void (*prepare)(void), void (*parent)(void),
+               void (*child)(void));
+*/
+
diff --git a/probe_tizenapi/tizen_appfw.c b/probe_tizenapi/tizen_appfw.c
new file mode 100644 (file)
index 0000000..1f7f7d0
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <app.h>
+#include "daprobe.h"
+#include "dahelper.h"
+#include "probeinfo.h"
+
+app_event_callback_s gAppCallback;
+
+#define AFTER_ORIGINAL_APPFWCYCLE(RTYPE, RVAL, FUNCNAME, INPUTFORMAT, ...)     \
+       newerrno = errno;                                                                                                               \
+       do {                                                                                                                                    \
+               if(postBlockBegin(blockresult)) {                                                                       \
+                       INIT_LOG;                                                                                                               \
+                       APPEND_LOG_BASIC_NAME(LC_LIFECYCLE, #FUNCNAME);                                 \
+                       APPEND_LOG_INPUT(INPUTFORMAT, __VA_ARGS__);                                             \
+                       APPEND_LOG_RESULT(RTYPE, RVAL);                                                                 \
+                       __appendTypeLog(&log, 1, NULL, VT_INT, 0);                                              \
+                       printLog(&log, MSG_LOG);                                                                                \
+                       postBlockEnd();                                                                                                 \
+               }                                                                                                                                       \
+       } while(0);                                                                                                                             \
+       errno = (newerrno != 0) ? newerrno : olderrno
+
+
+static bool _dalc_app_create(void* user_data)
+{
+       bool bret;
+       DECLARE_VARIABLE_STANDARD;
+
+       bfiltering = false;
+       PRE_PROBEBLOCK();
+
+       bret = gAppCallback.create(user_data);
+
+       AFTER_ORIGINAL_APPFWCYCLE(VT_INT, bret, usercallback_app_create,
+                       "%p", user_data);
+
+       return bret;
+}
+
+static void _dalc_app_terminate(void* user_data)
+{
+       DECLARE_VARIABLE_STANDARD;
+
+       bfiltering = false;
+       PRE_PROBEBLOCK();
+
+       gAppCallback.terminate(user_data);
+
+       AFTER_ORIGINAL_APPFWCYCLE(VT_NULL, NULL, usercallback_app_terminate,
+                       "%p", user_data);
+}
+
+static void _dalc_app_pause(void* user_data)
+{
+       DECLARE_VARIABLE_STANDARD;
+
+       bfiltering = false;
+       PRE_PROBEBLOCK();
+
+       gAppCallback.pause(user_data);
+
+       AFTER_ORIGINAL_APPFWCYCLE(VT_NULL, NULL, usercallback_app_pause,
+                       "%p", user_data);
+}
+
+static void _dalc_app_resume(void* user_data)
+{
+       DECLARE_VARIABLE_STANDARD;
+
+       bfiltering = false;
+       PRE_PROBEBLOCK();
+
+       gAppCallback.resume(user_data);
+
+       AFTER_ORIGINAL_APPFWCYCLE(VT_NULL, NULL, usercallback_app_resume,
+                       "%p", user_data);
+}
+
+static void _dalc_app_service(service_h service, void* user_data)
+{
+       DECLARE_VARIABLE_STANDARD;
+
+       bfiltering = false;
+       PRE_PROBEBLOCK();
+
+       gAppCallback.service(service, user_data);
+
+       AFTER_ORIGINAL_APPFWCYCLE(VT_NULL, NULL, usercallback_app_service,
+                       "%u, %p", (unsigned int)service, user_data);
+}
+
+static void _dalc_app_deviceorientationchanged(app_device_orientation_e orientation, void* user_data)
+{
+       on_orientation_changed((int)orientation, true);
+
+       if(gAppCallback.device_orientation)
+               gAppCallback.device_orientation(orientation, user_data);
+}
+
+int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *user_data)
+{
+       static int (*app_efl_mainp)(int* argc, char*** argv, app_event_callback_s* callback, void* user_data);
+       int ret;
+
+       GET_REAL_FUNC(app_efl_main, libcapi-appfw-application.so.0);
+
+       gAppCallback.create = callback->create;
+       gAppCallback.terminate = callback->terminate;
+       gAppCallback.pause = callback->pause;
+       gAppCallback.resume = callback->resume;
+       gAppCallback.service = callback->service;
+       gAppCallback.device_orientation = callback->device_orientation;
+
+       if(callback->create)
+               callback->create = _dalc_app_create;
+       if(callback->terminate)
+               callback->terminate = _dalc_app_terminate;
+       if(callback->pause)
+               callback->pause = _dalc_app_pause;
+       if(callback->resume)
+               callback->resume = _dalc_app_resume;
+       if(callback->service)
+               callback->service = _dalc_app_service;
+       callback->device_orientation = _dalc_app_deviceorientationchanged;
+
+       ret = app_efl_mainp(argc, argv, callback, user_data);
+
+       callback->create = gAppCallback.create;
+       callback->terminate = gAppCallback.terminate;
+       callback->pause = gAppCallback.pause;
+       callback->resume = gAppCallback.resume;
+       callback->service = gAppCallback.service;
+       callback->device_orientation = gAppCallback.device_orientation;
+
+       return ret;
+}
+
diff --git a/probe_ui/da_ui.h b/probe_ui/da_ui.h
new file mode 100755 (executable)
index 0000000..b11cf17
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#ifndef __DA_SNAPSHOT_H__
+#define __DA_SNAPSHOT_H__
+
+#include "daprobe.h"
+#include "dahelper.h"
+
+/********************************************************************
+ * SNAPSHOT PROBE MACRO
+ *
+ * log format
+ *             SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,Size`,FUNCTYPE`,\n
+ *             callstack_start`,callstack`,callstack_end
+ *
+ * FUNCTYPE
+ *             SNAPSHOT_API_TYPE_PAGER,
+ *             SNAPSHOT_API_TYPE_CONTROLBAR,
+ *             SNAPSHOT_API_TYPE_NAVIFRAME,
+ *             SNAPSHOT_API_TYPE_OTHER
+ *
+ **********************************************************************/
+
+#define BEFORE_ORIGINAL_SNAPSHOT(FUNCNAME, LIBNAME)            \
+       Evas_Object* ret;                                                                       \
+       GET_REAL_FUNC(FUNCNAME, LIBNAME)
+
+#define AFTER_ORIGINAL_SNAPSHOT(EVASOBJECT)                                                    \
+       do {                                                                                                                    \
+               probeBlockStart();                                                                                      \
+               evas_event_callback_add(evas_object_evas_get(EVASOBJECT),       \
+                       EVAS_CALLBACK_RENDER_FLUSH_POST,                                                \
+                       _cb_render_post, NULL);                                                                 \
+               probeBlockEnd();                                                                                        \
+       } while(0)
+
+#endif // __DA_SNAPSHOT_H__
diff --git a/probe_ui/osp_capture.cpp b/probe_ui/osp_capture.cpp
new file mode 100755 (executable)
index 0000000..f7599fa
--- /dev/null
@@ -0,0 +1,335 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <Evas.h>
+
+#include <FUi.h>
+//#include <FMedia.h>
+
+#include "daprobe.h"
+#include "dahelper.h"
+#include "dacollection.h"
+#include "daerror.h"
+//#include "da_ui.h"
+#include "osp_probe.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui;
+using namespace Tizen::Graphics;
+using namespace Tizen::Media;
+
+/*
+#define LIBUTILX       "libutilX.so.1"
+
+typedef void* (*utilx_create_screen_shot_type)(Display* dpy, int width, int height);
+typedef void (*utilx_release_screen_shot_type)(void);
+
+static Tizen::Graphics::Bitmap* sysutil_capture_screen()
+{
+       static utilx_create_screen_shot_type utilx_create_screen_shotp;
+       static utilx_release_screen_shot_type utilx_release_screen_shotp;
+       result r;
+       Bitmap* pBitmap = NULL;
+
+       if(unlikely(utilx_create_screen_shotp == NULL))
+       {
+               void* lib_handle = dlopen(LIBUTILX, RTLD_LAZY);
+               if(lib_handle == NULL) {
+                       SetLastResult(ERR_DLOPEN);
+                       return NULL;
+               }
+               utilx_create_screen_shotp = (utilx_create_screen_shot_type)dlsym(lib_handle, "utilx_create_screen_shot");
+               if(utilx_create_screen_shotp == NULL || dlerror() != NULL) {
+                       SetLastResult(ERR_DLSYM);
+                       return NULL;
+               }
+       }
+
+       if(unlikely(utilx_release_screen_shotp == NULL))
+       {
+               void* lib_handle = dlopen(LIBUTILX, RTLD_LAZY);
+               if(lib_handle == NULL) {
+                       SetLastResult(ERR_DLOPEN);
+                       return NULL;
+               }
+               utilx_release_screen_shotp = (utilx_release_screen_shot_type)dlsym(lib_handle, "utilx_release_screen_shot");
+               if(utilx_release_screen_shotp == NULL || dlerror() != NULL) {
+                       SetLastResult(ERR_DLSYM);
+                       return NULL;
+               }
+       }
+
+       Display* pDpy = XOpenDisplay(NULL);
+       if(pDpy == NULL)
+       {
+               SetLastResult(ERR_USER - 1);
+               return NULL;
+       }
+
+       int width = DisplayWidth(pDpy, DefaultScreen(pDpy));
+       int height = DisplayHeight(pDpy, DefaultScreen(pDpy));
+
+       void* pDump = utilx_create_screen_shotp(pDpy, width, height);
+       if(likely(pDump != NULL))
+       {
+               ByteBuffer buffer;
+               r = buffer.Construct(static_cast<byte*>(pDump), 0, width*height*4, width*height*4);\
+               if(likely(r == E_SUCCESS))
+               {
+                       Tizen::Graphics::Dimension dim(width, height);
+                       Bitmap* pBitmap  = new Bitmap();
+                       if(likely(pBitmap != NULL))
+                       {
+                               r = pBitmap->Construct(buffer, dim, BITMAP_PIXEL_FORMAT_ARGB8888);
+                               if(unlikely(r != E_SUCCESS))
+                               {
+                                       SetLastResult(r);
+                                       delete pBitmap;
+                                       pBitmap = NULL;
+                               }
+                               else { SetLastResult(E_SUCCESS); }
+                       }
+                       else { SetLastResult(ERR_OUTOFMEMORY); }
+               }
+               else { SetLastResult(r); }
+       }
+       else { SetLastResult(ERR_USER - 2); }
+
+       utilx_release_screen_shotp();
+
+       return pBitmap;
+}
+
+static Bitmap* getBitmapFromBuffer(void* pDump, int width, int height)
+{
+       result r;
+       ByteBuffer buffer;
+       Bitmap* pBitmap = NULL;
+
+       r = buffer.Construct(static_cast<byte*>(pDump), 0, width*height*4, width*height*4);
+       if(likely(r == E_SUCCESS))
+       {
+               Tizen::Graphics::Dimension dim(width, height);
+               pBitmap  = new Bitmap();
+               if(likely(pBitmap != NULL))
+               {
+                       r = pBitmap->Construct(buffer, dim, BITMAP_PIXEL_FORMAT_ARGB8888);
+                       if(unlikely(r != E_SUCCESS))
+                       {
+                               SetLastResult(r);
+                               delete pBitmap;
+                               pBitmap = NULL;
+                       }
+                       else { SetLastResult(E_SUCCESS); }
+               }
+               else { SetLastResult(ERR_OUTOFMEMORY); }
+       }
+       else { SetLastResult(r); }
+
+       return pBitmap;
+}
+
+// return 0 if succeed
+// return -1 if failed to capture
+int captureScreen()
+{
+       Image img;
+       Bitmap* bitmap;
+       DECLARE_COMMON_VARIABLE;
+       result r;
+       int ret = 0, width, height;
+       char* capbuf;
+
+       probeBlockStart();
+
+       capbuf = captureScreenShotX(&width, &height);
+       if(capbuf != NULL)
+       {
+               bitmap = getBitmapFromBuffer((void*)capbuf, width, height);
+               if(bitmap != NULL)
+               {
+                       String dstPath;
+                       setProbePoint(&probeInfo);
+
+                       dstPath.Format(MAX_PATH_LENGTH, L"/tmp/da/%d.jpg", probeInfo.eventIndex);
+                       img.Construct();
+                       r = img.EncodeToFile(*bitmap, IMG_FORMAT_JPG, dstPath, true);
+                       if(r == E_SUCCESS)
+                       {
+                               INIT_LOG;
+                               APPEND_LOG_BASIC_NAME(LC_SNAPSHOT, "captureScreen");
+                               APPEND_LOG_COMMON_NONE(0);
+                               log.length += sprintf(log.data + log.length, "`,%S", dstPath.GetPointer());
+                               printLog(&log, MSG_LOG);
+                       }
+                       else
+                       {
+                               ret = -1;
+                       }
+
+                       delete bitmap;
+               }
+               else
+               {
+                       char buf[128];
+                       r = GetLastResult();
+                       sprintf(buf, "bitmap is null (%p, %d, %s)\n", capbuf, (int)r, GetErrorMessage(r));
+                       PRINTMSG(buf);
+                       ret = -1;
+               }
+       }
+       else
+       {
+               ret = -1;
+       }
+
+       releaseScreenShotX();
+       probeBlockEnd();
+
+       return ret;
+}
+*/
+
+namespace Tizen { namespace Ui {
+/*
+class _EcoreEvas
+{
+public:
+       Evas* GetEvas(void) const;
+};
+
+class _EcoreEvasMgr
+{
+       void SetEcoreEvas(const _EcoreEvas& ecoreevas);
+};
+
+
+void _EcoreEvasMgr::SetEcoreEvas(const _EcoreEvas& ecoreevas)
+{
+       typedef void (_EcoreEvasMgr::*methodType)(const _EcoreEvas& ecoreevas);
+       static methodType _ecoreevasmgr_setecoreevasp;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui13_EcoreEvasMgr12SetEcoreEvasERKNS0_10_EcoreEvasE,
+                       libosp-uifw.so, _ecoreevasmgr_setecoreevasp);
+
+       probeBlockStart();
+       evas_event_callback_add(ecoreevas.GetEvas(),
+               EVAS_CALLBACK_RENDER_FLUSH_POST, _cb_render_post, NULL);
+       probeBlockEnd();
+
+       (this->*_ecoreevasmgr_setecoreevasp)(ecoreevas);
+}
+*/
+
+result Control::SetShowState(bool state)
+{
+       typedef result (Control::*methodType)(bool state);
+       static methodType control_setshowstatep;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui7Control12SetShowStateEb,
+                       libosp-uifw.so, control_setshowstatep);
+
+       ret = (this->*control_setshowstatep)(state);
+
+       probeBlockStart();
+       {
+               char *type, *classname;
+               if(find_object_hash((void*)this, &type, &classname) == 1)
+               {
+                       if(strcmp(type, "Panel") == 0 || strcmp(type, "OverlayPanel") == 0 || strcmp(type, "ScrollPanel") == 0)
+                       {
+                               SCREENSHOT_SET();
+//                             SCREENSHOT_DONE();
+                       }
+                       else
+                       {
+                               // do nothing
+                       }
+               }
+               else
+               {
+                       // never happened
+               }
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
+namespace Controls {
+
+result Frame::SetCurrentForm(const Form& form)
+{
+       typedef result (Frame::*methodType)(const Form& form);
+       static methodType frame_setcurrentformp;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui8Controls5Frame14SetCurrentFormERKNS1_4FormE,
+                       libosp-uifw.so, frame_setcurrentformp);
+
+       ret = (this->*frame_setcurrentformp)(form);
+
+       probeBlockStart();
+       SCREENSHOT_SET();
+//     SCREENSHOT_DONE();
+       probeBlockEnd();
+
+       return ret;
+}
+
+}              // end of namespace Tizen::Ui::Controls
+
+namespace Animations {
+
+result FrameAnimator::SetCurrentForm(const Tizen::Ui::Controls::Form& form)
+{
+       typedef result (FrameAnimator::*methodType)(const Tizen::Ui::Controls::Form& form);
+       static methodType frameanimator_setcurrentformp;
+       result ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui10Animations13FrameAnimator14SetCurrentFormERKNS0_8Controls4FormE,
+                       libosp-uifw.so, frameanimator_setcurrentformp);
+
+       ret = (this->*frameanimator_setcurrentformp)(form);
+
+       probeBlockStart();
+       SCREENSHOT_SET();
+//     SCREENSHOT_DONE();
+       probeBlockEnd();
+
+       return ret;
+}
+
+}              // end of namespace Tizen::Ui::Animations
+
+} }            // end of namespace Tizen::Ui
+
+
diff --git a/probe_ui/osp_display.cpp b/probe_ui/osp_display.cpp
new file mode 100644 (file)
index 0000000..a87a1e7
--- /dev/null
@@ -0,0 +1,118 @@
+#include <FUi.h>
+
+#include "daprobe.h"
+#include "dahelper.h"
+#include "osp_probe.h"
+
+namespace Tizen { namespace Ui { namespace Animations {
+
+class _RootVisualElement
+{
+};
+
+class _DisplayManager
+{
+//     bool RenderAll(bool check);
+//     bool Render(_RootVisualElement& root, bool check);
+       result PostRender(_RootVisualElement& root);
+//     result Flush(void);
+//     bool UpdateScene(bool force);
+};
+/*
+bool _DisplayManager::RenderAll(bool check)
+{
+       typedef bool (_DisplayManager::*methodtype)(bool check);
+       static methodtype mp;
+       bool ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui10Animations15_DisplayManager9RenderAllEb, libosp-uifw.so, mp);
+       probeBlockStart();
+       PRINTMSG("Before RenderAll");
+       probeBlockEnd();
+
+       ret = (this->*mp)(check);
+
+       probeBlockStart();
+       PRINTMSG("After RenderAll");
+       probeBlockEnd();
+
+       return ret;
+}
+
+bool _DisplayManager::Render(_RootVisualElement& root, bool check)
+{
+       typedef bool (_DisplayManager::*methodtype)(_RootVisualElement& root, bool check);
+       static methodtype mp;
+       bool ret;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui10Animations15_DisplayManager6RenderERNS1_18_RootVisualElementEb, libosp-uifw.so, mp);
+       probeBlockStart();
+       PRINTMSG("Before Render");
+       probeBlockEnd();
+       ret = (this->*mp)(root, check);
+       probeBlockStart();
+       PRINTMSG("After Render");
+       probeBlockEnd();
+
+       return ret;
+}
+*/
+result _DisplayManager::PostRender(_RootVisualElement& root)
+{
+       typedef result (_DisplayManager::*methodtype)(_RootVisualElement& root);
+       static methodtype mp;
+       result ret;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui10Animations15_DisplayManager10PostRenderERNS1_18_RootVisualElementE, libosp-uifw.so, mp);
+       probeBlockStart();
+//     PRINTMSG("Before PostRender");
+       probeBlockEnd();
+
+       ret = (this->*mp)(root);
+
+       probeBlockStart();
+       SCREENSHOT_DONE();
+//     PRINTMSG("After PostRender");
+       probeBlockEnd();
+
+       return ret;
+}
+/*
+result _DisplayManager::Flush(void)
+{
+       typedef result (_DisplayManager::*methodtype)(void);
+       static methodtype mp;
+       result ret;
+       
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui10Animations15_DisplayManager5FlushEv, libosp-uifw.so, mp);
+       probeBlockStart();
+       PRINTMSG("Before Flush");
+       probeBlockEnd();
+       ret = (this->*mp)();
+       probeBlockStart();
+       PRINTMSG("After Flush");
+       probeBlockEnd();
+
+       return ret;
+}
+
+bool _DisplayManager::UpdateScene(bool force)
+{
+       typedef bool (_DisplayManager::*methodtype)(bool force);
+       static methodtype mp;
+       bool ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui10Animations15_DisplayManager11UpdateSceneEb, libosp-uifw.so, mp);
+       probeBlockStart();
+       PRINTMSG("Before UpdateScene");
+       probeBlockEnd();
+       ret = (this->*mp)(force);
+       probeBlockStart();
+       PRINTMSG("After UpdateScene");
+       probeBlockEnd();
+
+       return ret;
+}
+*/
+
+} } }  // end of namespace
diff --git a/probe_ui/osp_frameani.cpp b/probe_ui/osp_frameani.cpp
new file mode 100644 (file)
index 0000000..a18926d
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include "daprobe.h"
+#include "dahelper.h"
+#include "osp_frameani.h"
+
+DAFrameAnimationEventListener DAFrameAnimationEventListener::rInstance;
+
+DAFrameAnimationEventListener::DAFrameAnimationEventListener()
+{
+}
+
+DAFrameAnimationEventListener::~DAFrameAnimationEventListener()
+{
+}
+
+void DAFrameAnimationEventListener::OnFormTransitionAnimationFinished(FrameAnimator &source, Frame &frame, Form &form1, Form &form2)
+{
+       probeBlockStart();
+       SCREENSHOT_SET();
+//     SCREENSHOT_DONE();
+       probeBlockEnd();
+}
+
+void DAFrameAnimationEventListener::OnFormTransitionAnimationStarted(FrameAnimator &source, Frame &frame, Form &form1, Form &form2)
+{
+       probeBlockStart();
+       SCREENSHOT_UNSET();
+       probeBlockEnd();
+}
+
+void DAFrameAnimationEventListener::OnFormTransitionAnimationStopped(FrameAnimator &source, Frame &frame, Form &form1, Form &form2)
+{
+       probeBlockStart();
+       SCREENSHOT_SET();
+//     SCREENSHOT_DONE();
+       probeBlockEnd();
+}
+
+DAFrameAnimationEventListener& DAFrameAnimationEventListener::GetInstance(void)
+{
+       return rInstance;
+}
+
+IFrameAnimatorEventListener& GetFrameAnimatorEventListener()
+{
+       DAFrameAnimationEventListener& listener = DAFrameAnimationEventListener::GetInstance();
+       return static_cast<IFrameAnimatorEventListener&>(listener);
+}
+
diff --git a/probe_ui/osp_frameani.h b/probe_ui/osp_frameani.h
new file mode 100644 (file)
index 0000000..6f8186d
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef __OSP_FRAMEANI_H__
+#define __OSP_FRAMEANI_H__
+
+#include <FUi.h>
+
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Ui::Controls;
+
+class DAFrameAnimationEventListener :
+               public IFrameAnimatorEventListener
+{
+public:
+       DAFrameAnimationEventListener();
+       virtual ~DAFrameAnimationEventListener();
+
+       virtual void    OnFormTransitionAnimationFinished (FrameAnimator &source, Frame &frame, Form &form1, Form &form2);
+       virtual void    OnFormTransitionAnimationStarted (FrameAnimator &source, Frame &frame, Form &form1, Form &form2);
+       virtual void    OnFormTransitionAnimationStopped (FrameAnimator &source, Frame &frame, Form &form1, Form &form2);
+
+       static DAFrameAnimationEventListener& GetInstance(void);
+
+private:
+       static DAFrameAnimationEventListener rInstance;
+};
+
+
+#endif // __OSP_FRAMEANI_H__
+
diff --git a/probe_ui/osp_scenemanager.cpp b/probe_ui/osp_scenemanager.cpp
new file mode 100755 (executable)
index 0000000..6aa5b7e
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <assert.h>
+#include <FBase.h>
+#include <FUi.h>
+
+#include "daprobe.h"
+#include "dacollection.h"      // for find_object_hash
+#include "dahelper.h"          // for captureScreen
+#include "osp_probe.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+#define APPEND_SCENE_ELEM(_ID, _CONTROL)                                                                       \
+       do {                                                                                                                                    \
+               if(_CONTROL != NULL) {                                                                                          \
+                       char *name = NULL, *type = NULL;                                                                \
+                       if(find_object_hash((void*)(_CONTROL), &type, &name) == 1) {    \
+                               log.length += sprintf(log.data + log.length, "`,%S`,%s",        \
+                                               const_cast<wchar_t*>((_ID).GetPointer()), name);        \
+                       } else {                                                                                                                \
+                               log.length += sprintf(log.data + log.length, "`,%S`,",          \
+                                               const_cast<wchar_t*>((_ID).GetPointer()));                      \
+                       }                                                                                                                               \
+               } else {                                                                                                                        \
+                       log.length += sprintf(log.data + log.length, "`,`,");                   \
+               }                                                                                                                                       \
+       } while(0)
+
+int SceneManagerUsed = 0;
+
+class SceneManagerEventListener : public ISceneManagerEventListener
+{
+public:
+       virtual void OnSceneTransitionCompleted(const SceneId &previousSceneId, const SceneId &currentSceneId);
+       virtual void OnSceneTransitionStarted(const SceneId &currentSceneId, const SceneId &nextSceneId);
+       static SceneManagerEventListener& GetInstance();
+private:
+       static SceneManagerEventListener rInstance;
+       unsigned long startTime;
+};
+
+SceneManagerEventListener SceneManagerEventListener::rInstance;
+
+void SceneManagerEventListener::OnSceneTransitionCompleted(const SceneId &previousSceneId, const SceneId &currentSceneId)
+{
+       probeBlockStart();
+       {
+               SceneManager* scenemanager = SceneManager::GetInstance();
+
+               if(scenemanager->GetCurrentSceneId() == currentSceneId)
+               {
+                       DECLARE_COMMON_VARIABLE;
+                       Scene* scene;
+                       String sceneid, formid, panelid;
+                       Form* pform;
+                       Panel* ppanel;
+                       unsigned long transition, user = 0;
+
+                       setProbePoint(&probeInfo);
+                       INIT_LOG;
+
+                       scene = scenemanager->GetCurrentScene();
+                       sceneid = scene->GetSceneId();
+                       formid = scene->GetFormId();
+                       panelid = scene->GetPanelId();
+                       pform = scene->GetForm();
+                       ppanel = scene->GetPanel();
+
+                       transition = (probeInfo.currentTime - startTime);
+
+                       APPEND_LOG_BASIC_NAME(LC_SCENE, "OnSceneTransitionCompleted");
+                       APPEND_LOG_COMMON_NONE(0);
+                       log.length += sprintf(log.data + log.length, "`,%S",
+                                       const_cast<wchar_t*>(sceneid.GetPointer()));
+                       APPEND_SCENE_ELEM(formid, pform);
+                       APPEND_SCENE_ELEM(panelid, ppanel);
+                       log.length += sprintf(log.data + log.length, "`,%lu`,%lu`,", transition, user);
+
+                       printLog(&log, MSG_LOG);
+               }
+               else
+               {
+                       // never happened
+                       assert(false);
+               }
+
+               SCREENSHOT_SET();
+//             SCREENSHOT_DONE();
+       }
+
+       SceneManagerUsed = 0;
+       probeBlockEnd();
+}
+
+void SceneManagerEventListener::OnSceneTransitionStarted(const SceneId &currentSceneId, const SceneId &nextSceneId)
+{
+       probeBlockStart();
+       SceneManagerUsed = 1;
+       startTime = getCurrentTime();
+       probeBlockEnd();
+}
+
+SceneManagerEventListener& SceneManagerEventListener::GetInstance()
+{
+       return rInstance;
+}
+
+
+namespace Tizen { namespace Ui { namespace Scenes {
+
+SceneManager* SceneManager::GetInstance(void)
+{
+       typedef SceneManager* (*methodType)(void);
+       static methodType scenemanager_getinstancep;
+       static int initialized = 0;
+       SceneManager* ret;
+
+       GET_REAL_FUNC_OSP(_ZN5Tizen2Ui6Scenes12SceneManager11GetInstanceEv, libosp-uifw.so, scenemanager_getinstancep);
+
+       ret = scenemanager_getinstancep();
+
+       probeBlockStart();
+       if(unlikely(initialized == 0))
+       {
+               if(likely(ret != NULL))
+               {
+                       ret->AddSceneManagerEventListener(SceneManagerEventListener::GetInstance());
+                       initialized = 1;
+               }
+       }
+       probeBlockEnd();
+
+       return ret;
+}
+
+
+} } }  // end of namespace
diff --git a/probe_ui/tizen_capture.c b/probe_ui/tizen_capture.c
new file mode 100755 (executable)
index 0000000..5d450b7
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+//#include <stdio.h>
+//#include <stdlib.h>
+//#include <string.h>
+//#include <dlfcn.h>
+//#include <stdbool.h>
+//#include <memory.h>
+//#include <errno.h>
+
+#include <Evas.h>
+#include <Elementary.h>
+//#include <app.h>
+
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "da_ui.h"
+
+Evas_Object *elm_win_add(Evas_Object *parent, const char* name, Elm_Win_Type type)
+{
+       static Evas_Object * (*elm_win_addp)(Evas_Object *parent, const char* name, Elm_Win_Type type);
+
+       BEFORE_ORIGINAL_SNAPSHOT(elm_win_add, libelementary.so);
+       
+       ret = elm_win_addp(parent, name, type);
+       
+       AFTER_ORIGINAL_SNAPSHOT(ret);
+       
+       return ret;
+}
+
+Evas_Object *  elm_controlbar_add (Evas_Object *parent)
+{
+       static Evas_Object * (*elm_controlbar_addp)(Evas_Object *parent);
+
+       BEFORE_ORIGINAL_SNAPSHOT(elm_controlbar_add, libelementary.so);
+
+       ret = elm_controlbar_addp(parent);
+       
+       AFTER_ORIGINAL_SNAPSHOT(ret);
+
+       return ret;
+       
+//     ecore_evas_callback_post_render_set(ecore_evas_ecore_evas_get(evas_object_evas_get(parent)), _cbecore);
+}
+
+Evas_Object *elm_naviframe_add(Evas_Object *parent)
+{
+       static Evas_Object * (*elm_naviframe_addp)(Evas_Object *parent);
+
+       BEFORE_ORIGINAL_SNAPSHOT(elm_naviframe_add, libelementary.so);
+
+       ret = elm_naviframe_addp(parent);
+       
+       AFTER_ORIGINAL_SNAPSHOT(ret);
+
+       return ret;
+}
+
+Evas_Object *elm_pager_add(Evas_Object *parent)
+{
+       static Evas_Object * (*elm_pager_addp)(Evas_Object *parent);
+
+       BEFORE_ORIGINAL_SNAPSHOT(elm_pager_add, libelementary.so);
+
+       ret = elm_pager_addp(parent);
+       
+       AFTER_ORIGINAL_SNAPSHOT(ret);
+
+       return ret;
+}
diff --git a/probe_userfunc/libdauserfunc.c b/probe_userfunc/libdauserfunc.c
new file mode 100755 (executable)
index 0000000..80fdbb1
--- /dev/null
@@ -0,0 +1,555 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Woojin Jung <woojin2.jung@samsung.com>
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <time.h>
+#include <execinfo.h>
+#include <unistd.h>
+#include <pthread.h>
+#include "daprobe.h"
+#include "probeinfo.h"
+#include "dautil.h"
+#include "dahelper.h"
+#include "da_sync.h"
+
+//#define USING_BACKTRACE
+
+#define RETURN_ADDRESS(nr) \
+       __builtin_extract_return_addr (__builtin_return_address(nr))
+
+#if defined(__i386__)
+#define GET_PC(ctx)    ((void *) ctx.eip)
+#elif defined (__arm__)
+#define GET_PC(ctx)    ((void *) (ctx)->uc_mcontext.arm_pc)
+#endif
+
+#define USERFUNCTION_MAX_DEPTH                         32
+#define PROFIL_LOG_SENDING_INTERVAL_USEC       100000 // 100 milliseconds
+#define SAMPLE_MAX_IN_INTERVAL                         50
+#define        PROFIL_TRIM_STACK_DEPTH                         2
+
+#define IS_FULL_SAMPLE_ARRAY   ((((sample_write_index + 1) % SAMPLE_MAX_IN_INTERVAL) == sample_read_index) ? 1 : 0)
+#define IS_EMPTY_SAMPLE_ARRAY  ((sample_write_index == sample_read_index) ? 1 : 0)
+
+#define CUSTOM_CB_FUNC_NAME            "_chart_timerThread"
+
+void *custom_cb_addr = (void*)-1;
+
+extern __thread unsigned long gSTrace;
+
+volatile int profil_turned_on = 0;
+u_long low_pc, high_pc;
+
+typedef struct elapsed_time_t {
+       struct timeval startTime;
+       struct timeval endTime;
+       struct timeval resultTime;
+       void *self;
+} elapsed_time;
+
+__thread elapsed_time elapsed_time_array[USERFUNCTION_MAX_DEPTH];
+__thread int elapsed_time_index;
+
+pthread_t profil_log_thread;
+pthread_mutex_t profil_log_mutex;
+
+typedef struct sample_info_t {
+       unsigned long time;
+       void *pc;
+       int bt_size;
+       void *bt_array[MAX_STACK_DEPTH];
+} sample_info;
+
+int sample_seq = 0;
+int sample_read_index = 0;
+int sample_write_index = 0;
+sample_info sample_info_array[SAMPLE_MAX_IN_INTERVAL];
+
+int __profile_frequency();
+
+static unsigned long long getElapsedTime(struct timeval eTime)
+{
+       return ((unsigned long long) eTime.tv_sec) * 1000000 + eTime.tv_usec;
+}
+
+static unsigned long getTime()
+{
+       struct timespec ts;
+       clock_gettime(CLOCK_REALTIME, &ts);
+
+       return (unsigned long)(ts.tv_sec * 10000 + (ts.tv_nsec/100000));
+}
+
+#ifdef USING_BACKTRACE
+int profil_backtrace_symbols(log_t *log, int bufsize, int index)
+{
+       char **strings = NULL;
+       size_t i;
+       int initsize;
+       int stringlen;
+
+       if(log == NULL)
+               return 0;
+
+       initsize = log->length;
+       log->data[log->length] = '\0';  // is this necessary ?
+       if(likely(sample_info_array[index].bt_size > PROFIL_TRIM_STACK_DEPTH))
+       {
+               strings = BACKTRACE_SYMBOLS(sample_info_array[index].bt_array + PROFIL_TRIM_STACK_DEPTH,
+                               sample_info_array[index].bt_size - PROFIL_TRIM_STACK_DEPTH);
+
+               if(likely(strings != NULL))
+               {
+                       for(i = PROFIL_TRIM_STACK_DEPTH; i < sample_info_array[index].bt_size; i++)
+                       {
+                               stringlen = strlen(strings[i - PROFIL_TRIM_STACK_DEPTH]) + 14;
+                               if(log->length + stringlen >= bufsize + initsize)       
+                                       break;
+
+                               log->length += sprintf(log->data + log->length, "%010u`,%s`,",
+                                               (unsigned int)(sample_info_array[index].bt_array[i]),
+                                               strings[i - PROFIL_TRIM_STACK_DEPTH]);
+                       }
+                       log->data[log->length-2] = '\0';
+                       log->length -= 2;
+                       free(strings);
+               }
+               else
+               {
+                       for(i = PROFIL_TRIM_STACK_DEPTH; i < sample_info_array[index].bt_size; i++)
+                       {
+                               stringlen = 23;
+                               if(log->length + stringlen >= bufsize + initsize)
+                                       break;
+
+                               log->length += sprintf(log->data + log->length, "%010u`,(unknown)`,",
+                                               (unsigned int)(sample_info_array[index].bt_array[i]));
+                       }
+                       log->data[log->length-2] = '\0';
+                       log->length -= 2;
+               }
+               return (int)(sample_info_array[index].bt_size - PROFIL_TRIM_STACK_DEPTH);
+       }
+       else
+       {
+               return 0;
+       }
+}
+#else
+int profil_backtrace_symbols(log_t *log, int bufsize, int index)
+{
+       char **strings = NULL;
+       size_t i;
+       int initsize;
+       int stringlen;
+
+       if(log == NULL)
+               return 0;
+
+       initsize = log->length;
+       log->data[log->length] = '\0';  // is this necessary ?
+       strings = BACKTRACE_SYMBOLS(sample_info_array[index].bt_array,
+                       sample_info_array[index].bt_size);
+
+       if(likely(strings != NULL))
+       {
+               for(i = 0; i < sample_info_array[index].bt_size; i++)
+               {
+                       stringlen = strlen(strings[i]) + 14;
+                       if(log->length + stringlen >= bufsize + initsize)       
+                               break;
+
+                       log->length += sprintf(log->data + log->length, "%010u`,%s`,",
+                                       (unsigned int)(sample_info_array[index].bt_array[i]),
+                                       strings[i]);
+               }
+               log->data[log->length-2] = '\0';
+               log->length -= 2;
+               free(strings);
+       }
+       else
+       {
+               for(i = 0; i < sample_info_array[index].bt_size; i++)
+               {
+                       stringlen = 23;
+                       if(log->length + stringlen >= bufsize + initsize)
+                               break;
+
+                       log->length += sprintf(log->data + log->length, "%010u`,(unknown)`,",
+                                       (unsigned int)(sample_info_array[index].bt_array[i]));
+               }
+               log->data[log->length-2] = '\0';
+               log->length -= 2;
+       }
+       return (int)(sample_info_array[index].bt_size);
+}
+#endif
+
+void *profil_log_func(void *data)
+{
+       log_t log;
+       
+       TRACE_STATE_SET(TS_PROFIL_THREAD);
+       
+       sigset_t profsigmask;
+       sigemptyset(&profsigmask);
+       sigaddset(&profsigmask, SIGPROF);
+       pthread_sigmask(SIG_BLOCK, &profsigmask, NULL);
+
+       INIT_LOG;
+
+       while(profil_turned_on)
+       {
+               while(!IS_EMPTY_SAMPLE_ARRAY)
+               {
+                       log.length = sprintf(log.data, "%d`,%d`,%lu`,%u`,\ncallstackstart`,", 
+                                       LC_SAMPLE, sample_seq++, sample_info_array[sample_read_index].time,
+                                       (unsigned int)sample_info_array[sample_read_index].pc);
+                       profil_backtrace_symbols(&log, DA_LOG_MAX - log.length - 17, sample_read_index);                                
+                       log.length += sprintf(log.data + log.length, "`,callstack_end");        
+                       printLog(&log, MSG_LOG);
+                       sample_read_index = (sample_read_index + 1) % SAMPLE_MAX_IN_INTERVAL;
+               }
+               usleep(PROFIL_LOG_SENDING_INTERVAL_USEC);
+       }
+       TRACE_STATE_UNSET(TS_PROFIL_THREAD);
+
+       return NULL;
+}
+
+void __cyg_profile_func_enter(void *this, void *callsite)
+{
+       probeInfo_t probeInfo;
+       log_t           log;
+
+       sigset_t profsigmask, oldsigmask;
+       sigemptyset(&profsigmask);
+       sigaddset(&profsigmask, SIGPROF);
+       pthread_sigmask(SIG_BLOCK, &profsigmask, &oldsigmask);
+
+       probeBlockStart();
+       do {
+               // remove custom chart callback function
+               if(gTraceInfo.custom_chart_callback_count > 0)
+               {
+                       if(custom_cb_addr == (void*)-1)
+                       {
+                               char **strings = BACKTRACE_SYMBOLS(&callsite, 1);
+                               if(likely(strings != NULL))
+                               {
+                                       printf("%s\n\n", strings[0]);
+                                       if(strstr(strings[0], CUSTOM_CB_FUNC_NAME) != NULL)
+                                       {
+                                               custom_cb_addr = callsite;
+                                               free(strings);
+                                               break;
+                                       }
+                                       free(strings);
+                               }
+                       }
+                       else
+                       {
+                               if(callsite == custom_cb_addr)
+                                       break;
+                       }
+               }
+
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               log.length = sprintf(log.data, "%d`,%d`,`,%lu`,%d`,%d`,`,`,%u`,`,0`,%u`,%lu`,%lu`,%d`,0",
+                               LC_USERFUNC, probeInfo.eventIndex, probeInfo.currentTime, probeInfo.pID, probeInfo.tID, 
+                               (unsigned int) this, (unsigned int) callsite, low_pc, high_pc, USERFUNC_ENTER);
+               APPEND_LOG_CALLSTACK();
+               printLog(&log, MSG_LOG);
+
+               gettimeofday(&(elapsed_time_array[elapsed_time_index].startTime), NULL);
+               elapsed_time_array[elapsed_time_index].self = this;
+               elapsed_time_index++;
+
+       } while(0); 
+       probeBlockEnd();
+
+       pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
+       return;
+}
+
+void __cyg_profile_func_exit(void *this, void *callsite)
+{
+       probeInfo_t probeInfo;
+       log_t log;
+
+       sigset_t profsigmask, oldsigmask;
+       sigemptyset(&profsigmask);
+       sigaddset(&profsigmask, SIGPROF);
+       pthread_sigmask(SIG_BLOCK, &profsigmask, &oldsigmask);
+
+       probeBlockStart();
+       do {
+               // remove custom chart callback function
+               if(gTraceInfo.custom_chart_callback_count > 0)
+               {
+                       if(custom_cb_addr == (void*)-1)
+                       {
+                               char **strings = BACKTRACE_SYMBOLS(&callsite, 1);
+                               if(likely(strings != NULL))
+                               {
+                                       printf("%s\n\n", strings[0]);
+                                       if(strstr(strings[0], CUSTOM_CB_FUNC_NAME) != NULL)
+                                       {
+                                               custom_cb_addr = callsite;
+                                               free(strings);
+                                               break;
+                                       }
+                                       free(strings);
+                               }
+                       }
+                       else
+                       {
+                               if(callsite == custom_cb_addr)
+                                       break;
+                       }
+               }
+
+               elapsed_time_index--;
+
+               if(this != elapsed_time_array[elapsed_time_index].self)
+               { // this should never happen
+                       PRINTMSG("function exit: enter/exit function matching failed!!\n");
+               }
+
+               gettimeofday(&(elapsed_time_array[elapsed_time_index].endTime), NULL);
+               timersub(&(elapsed_time_array[elapsed_time_index].endTime),
+                               &(elapsed_time_array[elapsed_time_index].startTime),
+                               &(elapsed_time_array[elapsed_time_index].resultTime));
+
+               setProbePoint(&probeInfo);
+               INIT_LOG;
+               log.length = sprintf(log.data, "%d`,%d`,`,%lu`,%d`,%d`,`,`,%u`,`,0`,%u`,%lu`,%lu`,%d`,%llu",
+                               LC_USERFUNC, probeInfo.eventIndex, probeInfo.currentTime, probeInfo.pID, probeInfo.tID, 
+                               (unsigned int) this, (unsigned int) callsite, low_pc, high_pc, USERFUNC_EXIT,
+                               getElapsedTime(elapsed_time_array[elapsed_time_index].resultTime));
+               APPEND_LOG_CALLSTACK();
+               printLog(&log, MSG_LOG);
+       } while(0);
+       probeBlockEnd();
+
+       pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
+       return;
+}
+
+#if defined(__i386__)
+void mcount(void)
+{
+       return;
+}
+
+#elif defined(__arm__)
+void mcount_internal(u_long frompc, u_long selfpc)
+{
+       return;
+}
+
+void __attribute__((__naked__)) __gnu_mcount_nc(void)
+{
+       asm(
+                       "push {r0, r1, r2, r3, lr}\n\t"
+                       "bic r1, lr, #1\n\t"
+                       "ldr r0, [sp, #20]\n\t"
+                       "bl mcount_internal\n\t"
+                       "pop {r0, r1, r2, r3, ip, lr}\n\t"
+                       "bx ip");
+}
+#endif
+
+static inline void profil_count(void *pc)
+{
+#if defined(__arm__)
+       /* This is a hack to prevent profil_count function from being called
+          inside of __gnu_mcount_nc. DO NOT put any other function between
+          __gnu_mcount_nc and profil_count. */
+       if((pc >= (void*)(&profil_count - 0x18)) && (pc <= (void*)(&profil_count)))
+               return;
+#endif
+       if(gSTrace != 0)
+               return;
+
+       TRACE_STATE_SET(TS_PROFIL_COUNT);
+
+       real_pthread_mutex_lock(&profil_log_mutex);
+       do {
+               if(IS_FULL_SAMPLE_ARRAY)
+               {       // when this happens, array size should be increased
+                       PRINTMSG("profil log: sample info array is full\n");
+                       break;
+               }
+               sample_info_array[sample_write_index].time = getTime();
+               sample_info_array[sample_write_index].pc = pc;
+#ifdef USING_BACKTRACE
+               sample_info_array[sample_write_index].bt_size
+                       = backtrace(sample_info_array[sample_write_index].bt_array, MAX_STACK_DEPTH);
+//#if defined(__i386__)
+// restore frame clobbered by signal handler
+               sample_info_array[sample_write_index].bt_array[2] = pc;
+//#endif
+#else
+               sample_info_array[sample_write_index].bt_array[0] = pc;
+               {
+                       int i;
+                       for(i = 0; i < elapsed_time_index; i++)
+                       {
+                               sample_info_array[sample_write_index].bt_array[i + 1] 
+                                       = elapsed_time_array[i].self;
+                       }
+                       sample_info_array[sample_write_index].bt_size = elapsed_time_index + 1;
+               }
+#endif
+               sample_write_index = (sample_write_index + 1) % SAMPLE_MAX_IN_INTERVAL;
+       } while(0);
+       real_pthread_mutex_unlock(&profil_log_mutex);
+
+       TRACE_STATE_UNSET(TS_PROFIL_COUNT);
+}
+
+#if defined(__i386__)
+static void profil_counter(int signo, const struct sigcontext scp)
+{
+       profil_count((void *) GET_PC(scp));
+
+       /* This is a hack to prevent the compiler from implementing the
+          above function call as a sibcall. The sibcall would overwrite
+          the signal context */
+       asm volatile("");
+}
+#elif defined(__arm__)
+static void profil_counter(int signr, siginfo_t *si, struct ucontext *uctx)
+{
+       profil_count((void *) GET_PC(uctx));
+       /* This is a hack to prevent the compiler from implementing the
+          above function call as a sibcall. The sibcall would overwrite
+          the signal context */
+       asm volatile("");
+}
+#endif
+
+#if 0
+// this function can cause floating point exception.
+int __profile_frequency(void)
+{
+       /*
+        * Discover the tick frequency of the machine if something goes wrong,
+        * we return 0, an impossible hertz.
+        */
+       struct itimerval tim;
+
+       tim.it_interval.tv_sec = 0;
+       tim.it_interval.tv_usec = 1;
+       tim.it_value.tv_sec = 0;
+       tim.it_value.tv_usec = 0;
+       setitimer(ITIMER_REAL, &tim, 0);
+       setitimer(ITIMER_REAL, 0, &tim);
+       if (tim.it_interval.tv_usec < 2)
+               return 0;
+       return (1000000 / tim.it_interval.tv_usec);
+}
+#endif
+
+int __profil(int mode)
+{
+       struct sigaction act;
+       struct itimerval timer;
+
+       static struct sigaction oact;
+       static struct itimerval otimer;
+
+       if(mode == 0)
+       {
+               if(profil_turned_on == 0)
+               {
+                       return 0;
+               }
+
+               if(setitimer(ITIMER_PROF, &otimer, NULL) < 0)
+                       return -1;
+               profil_turned_on = 0;
+               return sigaction(SIGPROF, &oact, NULL);
+       }
+       if(profil_turned_on == 1)
+       {
+               if(setitimer(ITIMER_PROF, &otimer, NULL) < 0
+                               || sigaction(SIGPROF, &oact, NULL) < 0)
+               {
+                       return -1;
+               }
+
+       }
+       profil_turned_on = 1;
+
+       act.sa_handler = (sighandler_t) &profil_counter;
+#if defined(__i386__)
+       act.sa_flags = SA_RESTART;
+#elif defined(__arm__)
+       act.sa_flags = SA_RESTART | SA_SIGINFO;
+#endif
+       sigfillset(&act.sa_mask);
+       if(sigaction(SIGPROF, &act, &oact) < 0)
+               return -1;
+
+       timer.it_value.tv_sec = 0;
+       timer.it_value.tv_usec = 1000000 / __profile_frequency();
+       timer.it_interval = timer.it_value;
+       return setitimer(ITIMER_PROF, &timer, &otimer);
+}
+
+void __monstartup(u_long lowpc, u_long highpc)
+{
+       low_pc = lowpc;
+       high_pc = highpc;
+
+       pthread_mutex_init(&profil_log_mutex, NULL);
+       __profil(1);
+       probeBlockStart();
+       if(pthread_create(&profil_log_thread, NULL, &profil_log_func, NULL) < 0)
+       {
+               perror("Fail to create profil_log thread");
+       }
+       probeBlockEnd();
+       return;
+}
+
+void _mcleanup(void)
+{
+       __profil(0);
+       return;
+}
+