instrumentation

Instrumenting C/C++ code using LLVM

安稳与你 提交于 2019-12-31 10:43:11
问题 I want to write a LLVM pass to instrument every memory access. Here is what I am trying to do. Given any C/C++ program (like the one given below), I am trying to insert calls to some function, before and after every instruction that reads/writes to/from memory. For example consider the below C++ program (Account.cpp) #include <stdio.h> class Account { int balance; public: Account(int b) { balance = b; } ~Account(){ } int read() { int r; r = balance; return r; } void deposit(int n) { balance =

Instrumentation test for Android - How to receive new Activity after orientation change?

…衆ロ難τιáo~ 提交于 2019-12-30 06:48:34
问题 I'm trying to test, if newly created Activity (after orientation change) is properly reinitialized. The code below shows that activity returned from getActivity() is the one constructed in setUp(), not the newly created one. Test: public class MyActivityTest extends ActivityInstrumentationTestCase2<MyActivity>{ private static final String TAG = "RAMPS"; private MyActivity mActivity; public MyActivityTest() { super("com.ramps", MyActivity.class); } protected void setUp() throws Exception {

Instrumentation test for Android - How to receive new Activity after orientation change?

梦想与她 提交于 2019-12-30 06:48:08
问题 I'm trying to test, if newly created Activity (after orientation change) is properly reinitialized. The code below shows that activity returned from getActivity() is the one constructed in setUp(), not the newly created one. Test: public class MyActivityTest extends ActivityInstrumentationTestCase2<MyActivity>{ private static final String TAG = "RAMPS"; private MyActivity mActivity; public MyActivityTest() { super("com.ramps", MyActivity.class); } protected void setUp() throws Exception {

How can I use java.lang.instrument in an Eclipse RCP application?

孤者浪人 提交于 2019-12-29 07:52:12
问题 In order to use the instrumentation features introduced in JDK 5, you can use the -javaagent flag passed to the JVM. This will inject an instance of an Instrumentation class into the static premain method. For example in a class like this: public class MyClass { public static Instrumentation inst; public static void premain(String options, Instrumentation inst) { MyClass.inst = inst; } } With an appropriate manifest file, you can run this as follows: java -javaagent:myfiles.jar SomeClass This

How to instrument java methods?

流过昼夜 提交于 2019-12-28 13:57:05
问题 I want to write a simple java agent which can print the name of a method called by the java program instrumented. For example, my java program I want to instrument is: public class TestInstr { public static void sayHello() { System.out.println("Hello !"); } public static void main(String args[]) { sayHello(); sayHello(); sayHello(); } } I would like to display something like this : method sayHello has been called Hello ! method sayHello has been called Hello ! method sayHello has been called

How to instrument java methods?

不羁的心 提交于 2019-12-28 13:56:33
问题 I want to write a simple java agent which can print the name of a method called by the java program instrumented. For example, my java program I want to instrument is: public class TestInstr { public static void sayHello() { System.out.println("Hello !"); } public static void main(String args[]) { sayHello(); sayHello(); sayHello(); } } I would like to display something like this : method sayHello has been called Hello ! method sayHello has been called Hello ! method sayHello has been called

Can a PIN tool instrument a bash script that contains code to run other commands?

心不动则不痛 提交于 2019-12-25 03:36:14
问题 I wrote a PIN tool that can inject some code before and after a certain function in a binary image. It is working for a single binary image. Now , my objective is to instrument Xserver in Linux with that tool. I tried to instrument "startx" by the PIN tool and it did not work. Later, I found that startx is only a shell script that runs other commands. What steps I need to follow if I want to instrument xserver using PIN? Is it possible to instrument a shell script somehow using PIN? 回答1: If

SQL Client Profiler?

霸气de小男生 提交于 2019-12-25 03:08:09
问题 I am aware of " SQL Server Profiler ", But is there any tools or methods available to monitor the issued sql queries from the client machine? Some of the things currently in my mind are: 1) The SysInternals ProcMon can log and tell when the executable process on client machine connects to sql server. Any similar but more advanced tools available to tell more data? 2) Any debug version or instrumented version of client libraries and APIs available for client machine to allow such operation?

Java count individual bytecode instructions executed

China☆狼群 提交于 2019-12-24 10:56:44
问题 I am trying to use ASM to count the individual bytecode instructions executed within a single function to build a histogram. I see there is a tool ByCounter that can do a similar task--but I do not have access to the source code. My understanding is the Java asm bytecode library can instrument classes, fields, methods, but examples for instrumenting an individual bytecode instruction are not to be found (though from ByCounter--it is found to be possible). If a tool like the JVMTI is better

Implementing a selective ClassLoader

穿精又带淫゛_ 提交于 2019-12-24 10:15:11
问题 I want to instrument the bytecode of some classes on the classpath at loading time. Since these are 3rd party libraries, I know exactly when they are loaded. The problem is that I need to do the instrumentation selectively, i.e. instrument only some classes. Now if I do not load a class with my classloader but with its parent, this parent gets set as the classes classloader and all succinct classes are loaded by that parent, effectively putting my classloader out of use. So I need to