Pservice.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * This enables libproc to be used in conjunction with libc_db and 2N/A * librtld_db. As most of these facilities are already provided by 2N/A * (more elegant) interfaces in <libproc.h>, we can just call those. 2N/A * NOTE: We explicitly do *not* implement the functions ps_kill() and 2N/A * ps_lrolltoaddr() in this library. The very existence of these functions 2N/A * causes libc_db to create an "agent thread" in the target process. 2N/A * The only way to turn off this behavior is to omit these functions. 2N/A * libc_db calls matched pairs of ps_pstop()/ps_pcontinue() 2N/A * in the belief that the client may have left the process 2N/A * running while calling in to the libc_db interfaces. 2N/A * We interpret the meaning of these functions to be an inquiry 2N/A * as to whether the process is stopped, not an action to be 2N/A * performed to make it stopped. For similar reasons, we also 2N/A * return PS_OK for core files in order to allow libc_db to 2N/A * operate on these as well. 2N/A * ps_lstop() and ps_lcontinue() are not called by any code in libc_db 2N/A * or librtld_db. We make them behave like ps_pstop() and ps_pcontinue(). 2N/A * In x86 we return PS_NOXREGS when AVX 2N/A * extension is not found. 2N/A * In x86 we return PS_NOXREGS when AVX extension is not found. 2N/A /* LINTED - alignment */ 2N/A /* LINTED - alignment */ 2N/A/* Extended CPU registers support */ 2N/A /*LINTED ALIGNMENT*/ 2N/A /*LINTED ALIGNMENT*/ 2N/A * We need to get the ldt entry that matches the 2N/A * value in the lwp's GS register. 2N/A#
endif /* __i386 || __amd64 */ 2N/A * Libthread_db doesn't use this function currently, but librtld_db uses 2N/A * it for its debugging output. We turn this on via rd_log if our debugging 2N/A * switch is on, and then echo the messages sent to ps_plog to stderr. 2N/A * Store a pointer to our internal copy of the aux vector at the address 2N/A * specified by the caller. It should not hold on to this data for too long. 2N/A * Search for a symbol by name and return the corresponding address. 2N/A * Search for a symbol by name and return the corresponding symbol 2N/A * information. If we're compiled _LP64, we just call Plookup_by_name 2N/A * and return because ps_sym_t is defined to be an Elf64_Sym, which 2N/A * is the same as a GElf_Sym. In the _ILP32 case, we have to convert 2N/A * Plookup_by_name's result back to a ps_sym_t (which is an Elf32_Sym).