gdb/sol2-tdep.c - gdb

Functions defined

Source code

  1. /* Target-dependent code for Solaris.

  2.    Copyright (C) 2006-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #include "defs.h"
  15. #include "frame.h"
  16. #include "symtab.h"
  17. #include "inferior.h"
  18. #include "objfiles.h"

  19. #include "sol2-tdep.h"

  20. CORE_ADDR
  21. sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
  22. {
  23.   struct bound_minimal_symbol msym;

  24.   msym = lookup_minimal_symbol("elf_bndr", NULL, NULL);
  25.   if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc)
  26.     return frame_unwind_caller_pc (get_current_frame ());

  27.   return 0;
  28. }

  29. /* This is how we want PTIDs from Solaris core files to be
  30.    printed.  */

  31. char *
  32. sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
  33. {
  34.   static char buf[80];
  35.   struct inferior *inf;
  36.   int pid;

  37.   /* Check whether we're printing an LWP (gdb thread) or a
  38.      process.  */
  39.   pid = ptid_get_lwp (ptid);
  40.   if (pid != 0)
  41.     {
  42.       /* A thread.  */
  43.       xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid));
  44.       return buf;
  45.     }

  46.   /* GDB didn't use to put a NT_PSTATUS note in Solaris cores.  If
  47.      that's missing, then we're dealing with a fake PID corelow.c made
  48.      up.  */
  49.   inf = find_inferior_ptid (ptid);
  50.   if (inf == NULL || inf->fake_pid_p)
  51.     {
  52.       xsnprintf (buf, sizeof buf, "<core>");
  53.       return buf;
  54.     }

  55.   /* Not fake; print as usual.  */
  56.   return normal_pid_to_str (ptid);
  57. }