All that 100% means is it's hung, and it's not doing I/O.
You're saying the program hangs when you run it with gprof
, but not if you don't?
That's weird, but I wouldn't bother trying to figure it out.
As I've said over and over, I would just grab several stack samples manually. Then the percent of time used by any routine is just the fraction of samples it appears on, more or less. If you think you need high-precision measurements, try a stack-sampler like Zoom or OProfile.