equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
44 } lib_info; |
44 } lib_info; |
45 |
45 |
46 // list of threads |
46 // list of threads |
47 typedef struct thread_info { |
47 typedef struct thread_info { |
48 lwpid_t lwp_id; |
48 lwpid_t lwp_id; |
49 pthread_t pthread_id; // not used cores, always -1 |
|
50 struct user_regs_struct regs; // not for process, core uses for caching regset |
49 struct user_regs_struct regs; // not for process, core uses for caching regset |
51 struct thread_info* next; |
50 struct thread_info* next; |
52 } thread_info; |
51 } thread_info; |
53 |
52 |
54 // list of virtual memory maps |
53 // list of virtual memory maps |
106 |
105 |
107 void print_debug(const char* format,...); |
106 void print_debug(const char* format,...); |
108 void print_error(const char* format,...); |
107 void print_error(const char* format,...); |
109 bool is_debug(); |
108 bool is_debug(); |
110 |
109 |
111 typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid); |
|
112 |
|
113 // reads thread info using libthread_db and calls above callback for each thread |
|
114 bool read_thread_info(struct ps_prochandle* ph, thread_info_callback cb); |
|
115 |
|
116 // deletes a thread from the thread list |
110 // deletes a thread from the thread list |
117 void delete_thread_info(struct ps_prochandle* ph, thread_info* thr); |
111 void delete_thread_info(struct ps_prochandle* ph, thread_info* thr); |
118 |
112 |
119 // adds a new shared object to lib list, returns NULL on failure |
113 // adds a new shared object to lib list, returns NULL on failure |
120 lib_info* add_lib_info(struct ps_prochandle* ph, const char* libname, uintptr_t base); |
114 lib_info* add_lib_info(struct ps_prochandle* ph, const char* libname, uintptr_t base); |
122 // adds a new shared object to lib list, supply open lib file descriptor as well |
116 // adds a new shared object to lib list, supply open lib file descriptor as well |
123 lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd, |
117 lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd, |
124 uintptr_t base); |
118 uintptr_t base); |
125 |
119 |
126 // adds a new thread to threads list, returns NULL on failure |
120 // adds a new thread to threads list, returns NULL on failure |
127 thread_info* add_thread_info(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id); |
121 thread_info* add_thread_info(struct ps_prochandle* ph, lwpid_t lwp_id); |
128 |
122 |
129 // a test for ELF signature without using libelf |
123 // a test for ELF signature without using libelf |
130 bool is_elf_file(int fd); |
124 bool is_elf_file(int fd); |
131 |
125 |
132 #endif //_LIBPROC_IMPL_H_ |
126 #endif //_LIBPROC_IMPL_H_ |