c++ - What kind of stack unwinding libraries do exist and what's the difference? -


trying build own non-gnu cross-platform c++ environment, have faced fact don't understand basics of stack unwinding. environment build follows:

libc++libc++abilibunwind (or other unwinder).

i've found libc++abi contains kind of libunwind, doesn't use on linux. comments understood, it's special libunwind: llvm stack unwinder supports darwin , arm not x86_64 - , it's confusing. how come cpu architecture affects stack unwinding process?

also know following stack unwinders:

  1. glibc built-in.
  2. libc++abi llvm libunwind.
  3. gnu libunwind (from savanna).

questions:

  1. how platform or cpu architecture affects stack unwinding process?
  2. why have many stack unwinders - , not single one?
  3. what kind of unwinders exist , difference between them?

expectations answer:

i expect answer covers topic whole, not separate points on each question.

fundamentally, stack layout compiler. can lay out stack in whatever way thinks best. language standard says nothing how stack laid out.

in practice, different compilers lay stack out differently , same compiler can lay out differently when run different options. stack layout depend on size of types on target platform (especially size of pointer types), compiler options such gcc's -fomit-frame-pointer, abi requirements of platform (eg x64 has defined abi x86 not). how interpret stack depend on how compiler stores relevant information. in turn partly depends on executable format (probably either elf or coff these days, actually, long os can load executable , find entry point, else pretty grabs) , partly on debug information format - again specific compiler/debugger combination in use. in end, possible write inline assembler manipulates stack , program flow in way no unwinder able follow. compilers allow customise function prologue , epilogue, giving opportunity confuse unwinding algorithm.

the net effect of is not possible write single stack-unwinding algorithm work everywhere. unwinding algorithm has match compiler, os and, more basic information, debugger. best can write simple stack-unwinding interface , implement differently each compiler/os/debugger combination support.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -