~ubuntu-branches/debian/jessie/gdb/jessie

« back to all changes in this revision

Viewing changes to gdb/frame.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Jacobowitz
  • Date: 2010-03-20 01:21:29 UTC
  • mfrom: (1.3.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100320012129-t7h25y8zgr8c2369
Tags: 7.1-1
* New upstream release, including:
  - PIE support (Closes: #346409).
  - C++ improvements, including static_cast<> et al, namespace imports,
    and bug fixes in printing virtual base classes.
  - Multi-program debugging.  One GDB can now debug multiple programs
    at the same time.
  - Python scripting improvements, including gdb.parse_and_eval.
  - Updated MIPS Linux signal frame layout (Closes: #570875).
  - No internal error stepping over _dl_debug_state (Closes: #569551).
* Update to Standards-Version: 3.8.4 (no changes required).
* Include more relevant (and smaller) docs in the gdbserver package
  (Closes: #571132).
* Do not duplicate documentation in gdb64, gdb-source, and libgdb-dev.
* Fix crash when switching into TUI mode (Closes: #568489).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Cache and manage frames for GDB, the GNU debugger.
2
2
 
3
3
   Copyright (C) 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000, 2001,
4
 
   2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
4
   2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5
5
 
6
6
   This file is part of GDB.
7
7
 
70
70
     moment leave this as speculation.  */
71
71
  int level;
72
72
 
 
73
  /* The frame's program space.  */
 
74
  struct program_space *pspace;
 
75
 
 
76
  /* The frame's address space.  */
 
77
  struct address_space *aspace;
 
78
 
73
79
  /* The frame's low-level unwinder and corresponding cache.  The
74
80
     low-level unwinder is responsible for unwinding register values
75
81
     for the previous frame.  The low-level unwind methods are
633
639
      this_frame->prev_pc.p = 1;
634
640
      if (frame_debug)
635
641
        fprintf_unfiltered (gdb_stdlog,
636
 
                            "{ frame_unwind_caller_pc (this_frame=%d) -> 0x%s }\n",
 
642
                            "{ frame_unwind_caller_pc (this_frame=%d) -> %s }\n",
637
643
                            this_frame->level,
638
644
                            hex_string (this_frame->prev_pc.value));
639
645
    }
676
682
struct regcache *
677
683
frame_save_as_regcache (struct frame_info *this_frame)
678
684
{
679
 
  struct regcache *regcache = regcache_xmalloc (get_frame_arch (this_frame));
 
685
  struct address_space *aspace = get_frame_address_space (this_frame);
 
686
  struct regcache *regcache = regcache_xmalloc (get_frame_arch (this_frame),
 
687
                                                aspace);
680
688
  struct cleanup *cleanups = make_cleanup_regcache_xfree (regcache);
681
689
  regcache_save (regcache, do_frame_register_read, this_frame);
682
690
  discard_cleanups (cleanups);
1059
1067
/* Create a sentinel frame.  */
1060
1068
 
1061
1069
static struct frame_info *
1062
 
create_sentinel_frame (struct regcache *regcache)
 
1070
create_sentinel_frame (struct program_space *pspace, struct regcache *regcache)
1063
1071
{
1064
1072
  struct frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
1065
1073
  frame->level = -1;
 
1074
  frame->pspace = pspace;
 
1075
  frame->aspace = get_regcache_aspace (regcache);
1066
1076
  /* Explicitly initialize the sentinel frame's cache.  Provide it
1067
1077
     with the underlying regcache.  In the future additional
1068
1078
     information, such as the frame's thread will be added.  */
1144
1154
  if (current_frame == NULL)
1145
1155
    {
1146
1156
      struct frame_info *sentinel_frame =
1147
 
        create_sentinel_frame (get_current_regcache ());
 
1157
        create_sentinel_frame (current_program_space, get_current_regcache ());
1148
1158
      if (catch_exceptions (uiout, unwind_to_current_frame, sentinel_frame,
1149
1159
                            RETURN_MASK_ERROR) != 0)
1150
1160
        {
1275
1285
 
1276
1286
  fi = FRAME_OBSTACK_ZALLOC (struct frame_info);
1277
1287
 
1278
 
  fi->next = create_sentinel_frame (get_current_regcache ());
 
1288
  fi->next = create_sentinel_frame (current_program_space, get_current_regcache ());
1279
1289
 
1280
1290
  /* Set/update this frame's cached PC value, found in the next frame.
1281
1291
     Do this before looking for this frame's unwinder.  A sniffer is
1284
1294
  fi->next->prev_pc.value = pc;
1285
1295
  fi->next->prev_pc.p = 1;
1286
1296
 
 
1297
  /* We currently assume that frame chain's can't cross spaces.  */
 
1298
  fi->pspace = fi->next->pspace;
 
1299
  fi->aspace = fi->next->aspace;
 
1300
 
1287
1301
  /* Select/initialize both the unwind function and the frame's type
1288
1302
     based on the PC.  */
1289
1303
  fi->unwind = frame_unwind_find_by_frame (fi, &fi->prologue_cache);
1557
1571
  prev_frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
1558
1572
  prev_frame->level = this_frame->level + 1;
1559
1573
 
 
1574
  /* For now, assume we don't have frame chains crossing address
 
1575
     spaces.  */
 
1576
  prev_frame->pspace = this_frame->pspace;
 
1577
  prev_frame->aspace = this_frame->aspace;
 
1578
 
1560
1579
  /* Don't yet compute ->unwind (and hence ->type).  It is computed
1561
1580
     on-demand in get_frame_type, frame_register_unwind, and
1562
1581
     get_frame_id.  */
1633
1652
static int
1634
1653
inside_entry_func (struct frame_info *this_frame)
1635
1654
{
1636
 
  return (get_frame_func (this_frame) == entry_point_address ());
 
1655
  CORE_ADDR entry_point;
 
1656
 
 
1657
  if (!entry_point_address_query (&entry_point))
 
1658
    return 0;
 
1659
 
 
1660
  return get_frame_func (this_frame) == entry_point;
1637
1661
}
1638
1662
 
1639
1663
/* Return a structure containing various interesting information about
1939
1963
  return frame->unwind->type;
1940
1964
}
1941
1965
 
 
1966
struct program_space *
 
1967
get_frame_program_space (struct frame_info *frame)
 
1968
{
 
1969
  return frame->pspace;
 
1970
}
 
1971
 
 
1972
struct program_space *
 
1973
frame_unwind_program_space (struct frame_info *this_frame)
 
1974
{
 
1975
  gdb_assert (this_frame);
 
1976
 
 
1977
  /* This is really a placeholder to keep the API consistent --- we
 
1978
     assume for now that we don't have frame chains crossing
 
1979
     spaces.  */
 
1980
  return this_frame->pspace;
 
1981
}
 
1982
 
 
1983
struct address_space *
 
1984
get_frame_address_space (struct frame_info *frame)
 
1985
{
 
1986
  return frame->aspace;
 
1987
}
 
1988
 
1942
1989
/* Memory access methods.  */
1943
1990
 
1944
1991
void