]> sourceware.org Git - glibc.git/blame - nptl_db/td_symbol_list.c
stdlib: Avoid undefined behavior in stdlib/tst-labs
[glibc.git] / nptl_db / td_symbol_list.c
CommitLineData
76a50749 1/* Return list of symbols the library can request.
6d7e8eda 2 Copyright (C) 2001-2023 Free Software Foundation, Inc.
76a50749 3 This file is part of the GNU C Library.
76a50749
UD
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
76a50749
UD
18
19#include <assert.h>
76a50749
UD
20#include "thread_dbP.h"
21
76a50749
UD
22static const char *symbol_list_arr[] =
23{
665b0c30
RM
24# define DB_LOOKUP_NAME(idx, name) [idx] = STRINGIFY (name),
25# define DB_LOOKUP_NAME_TH_UNIQUE(idx, name) [idx] = STRINGIFY (name),
e965d514
RM
26# include "db-symbols.h"
27# undef DB_LOOKUP_NAME
28# undef DB_LOOKUP_NAME_TH_UNIQUE
7f08f55a 29
76a50749
UD
30 [SYM_NUM_MESSAGES] = NULL
31};
32
33
34const char **
35td_symbol_list (void)
36{
37 return symbol_list_arr;
38}
39
40
7f08f55a 41ps_err_e
f8aeae34
AO
42td_mod_lookup (struct ps_prochandle *ps, const char *mod,
43 int idx, psaddr_t *sym_addr)
76a50749 44{
d43147cd 45 ps_err_e result;
76a50749 46 assert (idx >= 0 && idx < SYM_NUM_MESSAGES);
f8aeae34 47 result = ps_pglobal_lookup (ps, mod, symbol_list_arr[idx], sym_addr);
d43147cd 48
d43147cd 49 return result;
76a50749 50}
This page took 0.443251 seconds and 5 git commands to generate.