Following code is pretty boiler plate code that runs fine as is, but when run in gdb crashes. As such I won\'t care about that, but this is reduced version of my bigger prog
This was indeed what technomage had suggested in the comments. The gdb crash was a red herring because of jvm throwing SIGSEGV which was meant to be handled by jvm.
Once I tell gdb "handle SIGSEGV nostop", it works just fine and I was able to debug my larger program.