Imported Upstream version 1.1
[platform/upstream/libunwind.git] / tests / test-static-link-gen.c
1 /* libunwind - a platform-independent unwind library
2    Copyright (C) 2004 Hewlett-Packard Co
3         Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4
5 This file is part of libunwind.
6
7 Copyright (c) 2003 Hewlett-Packard Co.
8
9 Permission is hereby granted, free of charge, to any person obtaining
10 a copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16
17 The above copyright notice and this permission notice shall be
18 included in all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
27
28 #include <stdio.h>
29
30 #include <libunwind.h>
31
32 extern int verbose;
33
34 static void *funcs[] =
35   {
36     (void *) &unw_get_reg,
37     (void *) &unw_get_fpreg,
38     (void *) &unw_set_reg,
39     (void *) &unw_set_fpreg,
40     (void *) &unw_resume,
41     (void *) &unw_create_addr_space,
42     (void *) &unw_destroy_addr_space,
43     (void *) &unw_get_accessors,
44     (void *) &unw_flush_cache,
45     (void *) &unw_set_caching_policy,
46     (void *) &unw_regname,
47     (void *) &unw_get_proc_info,
48     (void *) &unw_get_save_loc,
49     (void *) &unw_is_signal_frame,
50     (void *) &unw_get_proc_name
51   };
52
53 int
54 test_generic (void)
55 {
56   if (verbose)
57     printf (__FILE__": funcs[0]=%p\n", funcs[0]);
58
59 #ifndef UNW_REMOTE_ONLY
60   {
61     unw_context_t uc;
62     unw_cursor_t c;
63
64     unw_getcontext (&uc);
65     unw_init_local (&c, &uc);
66     unw_init_remote (&c, unw_local_addr_space, &uc);
67
68     return unw_step (&c);
69   }
70 #else
71   return 0;
72 #endif
73 }