How to run record instruction-history and function-call-history in GDB?

It seems that there is no other solution except a CPU that supports it. More precisely, your kernel has to support Intel Processor Tracing (Intel PT). This can be checked in Linux with: grep intel_pt /proc/cpuinfo See also: https://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean The commands only works in record btrace mode. In the GDB source commit beab5d9, it is … Read more

Redirect Trace output to Console

You can add the following to your exe’s .config file. <?xml version=”1.0″?> <configuration> <system.diagnostics> <trace autoflush=”true”> <listeners> <add name=”logListener” type=”System.Diagnostics.TextWriterTraceListener” initializeData=”cat.log” /> <add name=”consoleListener” type=”System.Diagnostics.ConsoleTraceListener”/> </listeners> </trace> </system.diagnostics> </configuration> I included the TextWriter as well, in case you’re interested in logging to a file.

Trace listener to write to a text box (WPF application)

I use this for C# winforms, should be easily adjustable to wpf public class MyTraceListener : TraceListener { private TextBoxBase output; public MyTraceListener(TextBoxBase output) { this.Name = “Trace”; this.output = output; } public override void Write(string message) { Action append = delegate() { output.AppendText(string.Format(“[{0}] “, DateTime.Now.ToString())); output.AppendText(message); }; if (output.InvokeRequired) { output.BeginInvoke(append); } else { … Read more

Does java have any mechanism for a VM to trace method calls on itself, without using javaagent, etc?

There is no such API provided by the JVM— even for agents started with -javaagent. The JVM TI is a native interface provided for native agents started with the -agent option or for debuggers. Java agents might use the Instrumentation API which provides the lowlevel feature of class instrumentation but no direct profiling capability. There … Read more

Trace Python imports

Start the python interpreter with -v: $ python -v -m /usr/lib/python2.6/timeit.py # installing zipimport hook import zipimport # builtin # installed zipimport hook # /usr/lib/python2.6/site.pyc matches /usr/lib/python2.6/site.py import site # precompiled from /usr/lib/python2.6/site.pyc # /usr/lib/python2.6/os.pyc matches /usr/lib/python2.6/os.py import os # precompiled from /usr/lib/python2.6/os.pyc import errno # builtin import posix # builtin # /usr/lib/python2.6/posixpath.pyc matches /usr/lib/python2.6/posixpath.py … Read more