Gget_proc_info.c revision 0f27732d35ef19932410f448cf0aba3df2720de1
17f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* libunwind - a platform-independent unwind library 27f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project Copyright (C) 2004 Hewlett-Packard Co 37f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 47f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 57f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectThis file is part of libunwind. 67f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 77f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectPermission is hereby granted, free of charge, to any person obtaining 87f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projecta copy of this software and associated documentation files (the 97f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project"Software"), to deal in the Software without restriction, including 107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectwithout limitation the rights to use, copy, modify, merge, publish, 117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectdistribute, sublicense, and/or sell copies of the Software, and to 127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectpermit persons to whom the Software is furnished to do so, subject to 137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectthe following conditions: 147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectThe above copyright notice and this permission notice shall be 167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectincluded in all copies or substantial portions of the Software. 177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "unwind_i.h" 277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source ProjectPROTECTED int 297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectunw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) 307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct cursor *c = (struct cursor *) cursor; 327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if (dwarf_make_proc_info (&c->dwarf) < 0) 347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* On hppa, some key routines such as _start() and _dl_start() 367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project are missing DWARF unwind info. We don't want to fail in that 377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project case, because those frames are uninteresting and just mark 387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project the end of the frame-chain anyhow. */ 397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memset (pi, 0, sizeof (*pi)); 407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project pi->start_ip = c->dwarf.ip; 417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project pi->end_ip = c->dwarf.ip + 4; 427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return 0; 437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *pi = c->dwarf.pi; 457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return 0; 467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project