The code running on the Arduino is designed for that specific Arduino. There is no need to be able to determine the board type at run time, so, no, there is no function to get that.
That information is built into the sketch at compile time, so you could pretend to have gotten it at run time, by simply having the compile process store some useful information in the sketch.
The Arduino does not have a way of dealing with exceptions, so the whole concept of a stack trace is a non-starter. Once the Arduino has crashed, the single process could not tell you anything about what any other processes might have done (since there aren’t any).
You seem to be trying to make a mountain out of a flat plane.