Gis_signal_frame.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* libunwind - a platform-independent unwind library
  2. Copyright (C) 2001-2002 Hewlett-Packard Co
  3. Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
  4. This file is part of libunwind.
  5. Permission is hereby granted, free of charge, to any person obtaining
  6. a copy of this software and associated documentation files (the
  7. "Software"), to deal in the Software without restriction, including
  8. without limitation the rights to use, copy, modify, merge, publish,
  9. distribute, sublicense, and/or sell copies of the Software, and to
  10. permit persons to whom the Software is furnished to do so, subject to
  11. the following conditions:
  12. The above copyright notice and this permission notice shall be
  13. included in all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  21. #include "unwind_i.h"
  22. PROTECTED int
  23. unw_is_signal_frame (unw_cursor_t *cursor)
  24. {
  25. struct cursor *c = (struct cursor *) cursor;
  26. struct ia64_state_record sr;
  27. int ret;
  28. /* Crude and slow, but we need to peek ahead into the unwind
  29. descriptors to find out if the current IP is inside the signal
  30. trampoline. */
  31. ret = ia64_fetch_proc_info (c, c->ip, 1);
  32. if (ret < 0)
  33. return ret;
  34. ret = ia64_create_state_record (c, &sr);
  35. if (ret < 0)
  36. return ret;
  37. /* For now, we assume that any non-zero abi marker implies a signal frame.
  38. This should get us pretty far. */
  39. ret = (sr.abi_marker != 0);
  40. ia64_free_state_record (&sr);
  41. Debug (1, "(cursor=%p, ip=0x%016lx) -> %d\n", c, c->ip, ret);
  42. return ret;
  43. }