From d9e100753f5694ebb14769048373e8171f336127 Mon Sep 17 00:00:00 2001 From: "hp.com!davidm" Date: Fri, 20 May 2005 09:48:08 +0000 Subject: [PATCH] Include "libunwind_i.h" instead of "tdep.h". (Logical change 1.294) --- src/dwarf/Gexpr.c | 4 +- src/dwarf/Gpe.c | 4 +- src/dwarf/Gstep.c | 4 +- src/mi/Gget_accessors.c | 4 +- src/mi/Gget_fpreg.c | 34 +++++++++++++ src/mi/Gget_proc_name.c | 4 +- src/mi/Gget_reg.c | 4 +- src/mi/Gset_caching_policy.c | 4 +- src/mi/Gset_fpreg.c | 34 +++++++++++++ src/mi/Gset_reg.c | 4 +- src/setjmp/siglongjmp.c | 94 ++++++++++++++++++++++++++++++++++++ src/x86/is_fpreg.c | 4 +- src/x86_64/is_fpreg.c | 4 +- 13 files changed, 182 insertions(+), 20 deletions(-) diff --git a/src/dwarf/Gexpr.c b/src/dwarf/Gexpr.c index 3fff2cc0..5bc6eb99 100644 --- a/src/dwarf/Gexpr.c +++ b/src/dwarf/Gexpr.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (c) 2003 Hewlett-Packard Development Company, L.P. + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. Contributed by David Mosberger-Tang This file is part of libunwind. @@ -24,7 +24,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" -#include "tdep.h" +#include "libunwind_i.h" /* The "pick" operator provides an index range of 0..255 indicating that the stack could at least have a depth of up to 256 elements, diff --git a/src/dwarf/Gpe.c b/src/dwarf/Gpe.c index 45612907..4ca0d649 100644 --- a/src/dwarf/Gpe.c +++ b/src/dwarf/Gpe.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (c) 2003 Hewlett-Packard Development Company, L.P. + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. Contributed by David Mosberger-Tang This file is part of libunwind. @@ -24,7 +24,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" -#include "tdep.h" +#include "libunwind_i.h" HIDDEN int dwarf_read_encoded_pointer (unw_addr_space_t as, unw_accessors_t *a, diff --git a/src/dwarf/Gstep.c b/src/dwarf/Gstep.c index 62aead0b..739bca21 100644 --- a/src/dwarf/Gstep.c +++ b/src/dwarf/Gstep.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. + Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. Contributed by David Mosberger-Tang This file is part of libunwind. @@ -24,7 +24,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf.h" -#include "tdep.h" +#include "libunwind_i.h" static int update_frame_state (struct dwarf_cursor *c, unw_word_t prev_cfa) diff --git a/src/mi/Gget_accessors.c b/src/mi/Gget_accessors.c index 1a95ff95..fb256d70 100644 --- a/src/mi/Gget_accessors.c +++ b/src/mi/Gget_accessors.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (C) 2002, 2004 Hewlett-Packard Co + Copyright (C) 2002, 2004-2005 Hewlett-Packard Co Contributed by David Mosberger-Tang This file is part of libunwind. @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "tdep.h" +#include "libunwind_i.h" PROTECTED unw_accessors_t * unw_get_accessors (unw_addr_space_t as) diff --git a/src/mi/Gget_fpreg.c b/src/mi/Gget_fpreg.c index e69de29b..a9ae9bf6 100644 --- a/src/mi/Gget_fpreg.c +++ b/src/mi/Gget_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_get_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t *valp) +{ + struct cursor *c = (struct cursor *) cursor; + + return tdep_access_fpreg (c, regnum, valp, 0); +} diff --git a/src/mi/Gget_proc_name.c b/src/mi/Gget_proc_name.c index c1f3929d..7251c591 100644 --- a/src/mi/Gget_proc_name.c +++ b/src/mi/Gget_proc_name.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (C) 2001-2004 Hewlett-Packard Co + Copyright (C) 2001-2005 Hewlett-Packard Co Contributed by David Mosberger-Tang This file is part of libunwind. @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "tdep.h" +#include "libunwind_i.h" #include "remote.h" static inline int diff --git a/src/mi/Gget_reg.c b/src/mi/Gget_reg.c index cb95dd61..23b72bec 100644 --- a/src/mi/Gget_reg.c +++ b/src/mi/Gget_reg.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (C) 2002 Hewlett-Packard Co + Copyright (C) 2002, 2005 Hewlett-Packard Co Contributed by David Mosberger-Tang This file is part of libunwind. @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "tdep.h" +#include "libunwind_i.h" PROTECTED int unw_get_reg (unw_cursor_t *cursor, int regnum, unw_word_t *valp) diff --git a/src/mi/Gset_caching_policy.c b/src/mi/Gset_caching_policy.c index 2da2d8bf..52fc7e54 100644 --- a/src/mi/Gset_caching_policy.c +++ b/src/mi/Gset_caching_policy.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (C) 2002 Hewlett-Packard Co + Copyright (C) 2002, 2005 Hewlett-Packard Co Contributed by David Mosberger-Tang This file is part of libunwind. @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "tdep.h" +#include "libunwind_i.h" PROTECTED int unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy) diff --git a/src/mi/Gset_fpreg.c b/src/mi/Gset_fpreg.c index e69de29b..d3b202de 100644 --- a/src/mi/Gset_fpreg.c +++ b/src/mi/Gset_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_set_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t val) +{ + struct cursor *c = (struct cursor *) cursor; + + return tdep_access_fpreg (c, regnum, &val, 1); +} diff --git a/src/mi/Gset_reg.c b/src/mi/Gset_reg.c index d9564ab1..09fa09a3 100644 --- a/src/mi/Gset_reg.c +++ b/src/mi/Gset_reg.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (C) 2002 Hewlett-Packard Co + Copyright (C) 2002, 2005 Hewlett-Packard Co Contributed by David Mosberger-Tang This file is part of libunwind. @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "tdep.h" +#include "libunwind_i.h" PROTECTED int unw_set_reg (unw_cursor_t *cursor, int regnum, unw_word_t valp) diff --git a/src/setjmp/siglongjmp.c b/src/setjmp/siglongjmp.c index e69de29b..42570825 100644 --- a/src/setjmp/siglongjmp.c +++ b/src/setjmp/siglongjmp.c @@ -0,0 +1,94 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define UNW_LOCAL_ONLY + +#include + +#include "libunwind_i.h" +#include "jmpbuf.h" +#include "setjmp_i.h" + +void +siglongjmp (sigjmp_buf env, int val) +{ + unw_word_t *wp = (unw_word_t *) env; + extern int _UI_siglongjmp_cont; + extern int _UI_longjmp_cont; + unw_context_t uc; + unw_cursor_t c; + unw_word_t sp; + int *cont; + + if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0) + abort (); + + do + { + if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) + abort (); + if (sp != wp[JB_SP]) + continue; + + if (!bsp_match (&c, wp)) + continue; + + /* found the right frame: */ + + /* default to resuming without restoring signal-mask */ + cont = &_UI_longjmp_cont; + + /* Order of evaluation is important here: if unw_resume() + restores signal mask, we must set it up appropriately, even + if wp[JB_MASK_SAVED] is FALSE. */ + if (!resume_restores_sigmask (&c, wp) && wp[JB_MASK_SAVED]) + { + /* sigmask was saved */ + if (UNW_NUM_EH_REGS < 4 || _NSIG >= 16 * sizeof (unw_word_t)) + /* signal mask doesn't fit into EH arguments and we can't + put it on the stack without overwriting something + else... */ + abort (); + else + if (unw_set_reg (&c, UNW_REG_EH + 2, wp[JB_MASK]) < 0 + || (_NSIG > 8 * sizeof (unw_word_t) + && unw_set_reg (&c, UNW_REG_EH + 3, wp[JB_MASK + 1]) < 0)) + abort (); + cont = &_UI_siglongjmp_cont; + } + + if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0 + || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 + || unw_set_reg (&c, UNW_REG_IP, (unw_word_t) cont)) + abort (); + + unw_resume (&c); + + abort (); + } + while (unw_step (&c) >= 0); + + abort (); +} diff --git a/src/x86/is_fpreg.c b/src/x86/is_fpreg.c index a7f81f52..6dc56402 100644 --- a/src/x86/is_fpreg.c +++ b/src/x86/is_fpreg.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. Contributed by David Mosberger-Tang This file is part of libunwind. @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "tdep.h" +#include "libunwind_i.h" PROTECTED int unw_is_fpreg (int regnum) diff --git a/src/x86_64/is_fpreg.c b/src/x86_64/is_fpreg.c index 3c6e9f00..030dd712 100644 --- a/src/x86_64/is_fpreg.c +++ b/src/x86_64/is_fpreg.c @@ -1,5 +1,5 @@ /* libunwind - a platform-independent unwind library - Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -25,7 +25,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "tdep.h" +#include "libunwind_i.h" PROTECTED int unw_is_fpreg (int regnum)