22. stack trace problem - WebKit porting to Mona OS

I'm trying an application which uses libwebcore. As we expected, it crashes. We want to know exact where it crashes. So enabled stack trace function on Mona which was introduced by Mr.A.
The stack trace function uses a map file which is generated by linker. The map file contains a pair of an address and symbol name.
After enabled it and run the application, the application crashes on a different point.

The problem is

  • The map file is relatively bigger which have about 130,000 lines.
  • Each [address, symbol] is stored on a naive binary search tree which is not balanced.
  • Adrresses are inserted in-order. So the tree becomes unbalanced.
  • The implementation of find/insert is written in recursive way.
  • It takes a long time to insert/find, and also causes kernel stack overflow.

Since the stack trace function is important, we have to solve this problem. I think there are two options.
One is to find and use balanced-tree library. The other is to write it myself.

At first I've tried to use std::map inside the kernel. Using some stub header and functions, kernel is built with std::map.
But kernel crashes. <- Now here.