How does breakpoints work in debuggers?

debugIt’s been a while, I have got a chance to blog about low-level stuff. In this article, I am going to explain how breakpoints work in debuggers. I am assuming the reader is already familiar with “what a breakpoint is?” and how to set it in your debugger of choice. The goal of this post is to explain the interplay between Debugger, Debuggee, Operating System and the CPU.
Read on →

A newbie’s introduction to compilers and reverse engineering

gccegg-65Compilers are surely the complex programs of all times. Even today, writing a compiler with minimum set of tools is considered to be challenging. This tutorial scratches the surface of different compiler phases involved in translating a given source code to executable and also shows how this information is useful in context of reverse engineering. I tried my best not to confuse the reader with too much of jargon, and help any newbie to get up to the speed.
Read on →

How to get started in hacking OpenJDK?

openjdk logoThis blog post is not about internals of JDK(Java Development Kit), But a mere documentation for people who want to get started. JDK is open sourced a long time ago. The reference implementation of Java is now based on OpenJDK. So any one interested in it can get the source code and play with it. Here on, when I refer to JDK it means all the components including Java class libraries/JVM(Hotspot)/Java Compiler. In this post, I will walk you in getting and building the latest JDK 9 sources.

Read on →

What does it take to write an emulator in Java?

I am proud, This weekend I did some productive work. I was able to code Chip 8 emulator in Java over a night 😉 I have always been fascinated by them and finally I was able to get the damn thing to work! For those of you who are not familiar with software emulator, It is a software which can emulate the functionality of other hardware or software components. Notable examples are video game emulators(Dosbox/NES Emulator), general purpose software emulators(QEmu)

Read on →

Java’s Type Erasure + Compiler black magic = Bridge methods

This time we will look at an extreme consequence of Java’s Type Erasure. This example shows what can happen to the semantics of Java language by Type Erasure without some compiler massage. Unlike other articles, It makes more sense to explain the behavior along side of the code. So I keep the abstract of the article simple. Below we have a class called Number<T> which has a protected field number of type T and with methods setNumber(T) and T getNumber(). Based on this class, I have created a new subclass called NumberString which extends from Number<String> and provides a method setNumber(String).
Read on →

The rationale behind Java Lambda/Closures

courtesy of blog.takipi.com

In this article I would like to talk about the design choices behind Java’s most awaited language feature Lambdas/Closures. Its no secret that Java 8 now provides the support for lambda functions more precisely closures. But interestingly the implementation and usage of Java closures differs significantly compare to other modern programming languages. There is already a ton of information written on the this subject. So in particular, I would like to provide some thoughts on
Read on →