Updated Android gdb and gdbutils

I took some time today to update both the Fennec Android gdb (aka 'jimdb') and gdbutils. Build instructions should be the same. You can also grab the pre-built Linux tarball. Note that the pre-built binaries require libpython2.7.

gdb

The updated gdb is faster when setting up remote debugging. Sometimes it can get pretty frustrating when you have to debug a lot of sessions, and you have to wait half a minute each time just to get started. This update will hopefully make it a little better. (This is not an issue if you have an intern at your disposal ;)

gdbutils

gdbutils is a set of Python scripts that works with Android gdb. The updated gdbutils includes the following modules:

feninit

feninit automatically sets up the debug environment. The updated version adds support for B2G (see gdbinit for details; thanks ThinkerYzu!) and various bug fixes.

tracebt

tracebt is a stack unwinder that works by tracing assembly. The updated version adds a sanity check to stop unwinding before the script gets stuck somewhere and becomes depressed.

fastload

fastload is a new module that automatically pulls system libraries from the device in the background. This way you don't have to wait minutes just to download system libraries when debugging on a new device.

adblog

adblog is a new module that redirects the output of 'adb logcat' to the gdb terminal when Fennec is running. It also colorizes the logs according to the order they arrived, their priority, or the threads that generated them, like this:

adblog example

You can find additional documentation for gdbutils in the README. Feel free to ping me on IRC (jchen) or file issues on github! Thanks!


Also follow me on twitter! :D

2^n programmable gain amplifier

I was trying to design a circuit for conditioning a signal from a photodiode. I needed an amplifier to buffer and amplify the signal before sampling it with an ADC. However, the signal from a photodiode can have a high dynamic range, and I wasn't sure if the ADC can cover that. Instead of using a higher resolution ADC, I read about the programmable gain amplifier.

A programmable gain amplifier can be useful when sampling a signal that has a higher dynamic range than the resolution of the ADC allows. It's similar to setting the exposure of a camera when taking a picture; even though the scene can have a higher dynamic range than the camera can capture, the exposure can be set so that the camera does capture the most interesting part. Essentially, the dynamic range of the ADC is “shifted” to cover the full range of the signal.

There are several PGA ICs available, such as Linear LTC6910, Maxim MAX9939, Microchip MCP6S21, and TI PGA112. I figured I could also build one using an ordinary op-amp. Here's an article I found with two reference designs.

I also came up with an alternative arrangement that is capable of 1x to 128x gain in 2^n steps:

2^n PGA schematic

Unlike the circuits in the article above, this PGA design only requires 3 digital signals for gain control, and it only requires three different resistor values. Also, instead of requiring analog switches, this PGA uses only MOSFETs. On the downside, this circuit has a fairly poor bandwidth when the gain is low, due to MOSFET parasitic capacitances.

startSectionEdit: $data "plugin_wrap_start" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "plugin_wrap_end" is NOT an array! One of your plugins needs an update.

Fatal error: Uncaught Error: Call to undefined function ereg() in /home/public/lib/plugins/math/phpmathpublisher/mathpublisher.php:1606 Stack trace: #0 /home/public/lib/plugins/math/phpmathpublisher/mathpublisher.php(1627): detectimg('9665ed53a6b78d4...') #1 /home/public/lib/plugins/math/syntax.php(145): mathimage('1024^x=2*1000^x', 12, 'https://www.jnc...') #2 /home/public/inc/parser/renderer.php(117): syntax_plugin_math->render('xhtml', Object(Doku_Renderer_xhtml), Array) #3 /home/public/inc/parserutils.php(673): Doku_Renderer->plugin('math', Array, 3, '>1024^x=2*1000^...') #4 /home/public/lib/plugins/blogtng/helper/entry.php(829): p_render('xhtml', Array, Array) #5 /home/public/lib/plugins/blogtng/helper/entry.php(455): helper_plugin_blogtng_entry->get_entrycontent('syntax', false, false) #6 /home/public/lib/plugins/blogtng/tpl/jnchen/list.php(15): helper_plugin_blogtng_entry->tpl_entry(true, 'syntax', false) #7 /home/public/lib/plugins/blogtng/helper/entry.php(441): include('/home/public/li...') #8 /home/public/lib/pl in /home/public/lib/plugins/math/phpmathpublisher/mathpublisher.php on line 1606