cli-script.c: Simplify using std::string, eliminate cleanups
[deliverable/binutils-gdb.git] / gdb / prologue-value.c
index d95588a3dcabbfca65ec3ee8e3a381fb623b8c69..8fa2475834a22dcd1816e8f900e04ce531215cf5 100644 (file)
@@ -1,11 +1,11 @@
 /* Prologue value handling for GDB.
-   Copyright 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to:
-
-        Free Software Foundation, Inc.
-        51 Franklin St - Fifth Floor
-        Boston, MA 02110-1301
-        USA */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "gdb_string.h"
-#include "gdb_assert.h"
 #include "prologue-value.h"
 #include "regcache.h"
 
@@ -207,7 +200,7 @@ pv_is_identical (pv_t a, pv_t b)
     case pvk_register:
       return (a.reg == b.reg && a.k == b.k);
     default:
-      gdb_assert (0);
+      gdb_assert_not_reached ("unexpected prologue value kind");
     }
 }
 
@@ -319,9 +312,9 @@ struct pv_area
 
 
 struct pv_area *
-make_pv_area (int base_reg)
+make_pv_area (int base_reg, int addr_bit)
 {
-  struct pv_area *a = (struct pv_area *) xmalloc (sizeof (*a));
+  struct pv_area *a = XNEW (struct pv_area);
 
   memset (a, 0, sizeof (*a));
 
@@ -330,7 +323,7 @@ make_pv_area (int base_reg)
 
   /* Remember that shift amounts equal to the type's width are
      undefined.  */
-  a->addr_mask = ((((CORE_ADDR) 1 << (TARGET_ADDR_BIT - 1)) - 1) << 1) | 1;
+  a->addr_mask = ((((CORE_ADDR) 1 << (addr_bit - 1)) - 1) << 1) | 1;
 
   return a;
 }
@@ -350,6 +343,7 @@ clear_entries (struct pv_area *area)
       do
         {
           struct area_entry *next = e->next;
+
           xfree (e);
           e = next;
         }
@@ -402,7 +396,7 @@ pv_area_store_would_trash (struct pv_area *area, pv_t addr)
    This may return zero, if AREA has no entries.
 
    And since the entries are a ring, this may return an entry that
-   entirely preceeds OFFSET.  This is the correct behavior: depending
+   entirely precedes OFFSET.  This is the correct behavior: depending
    on the sizes involved, we could still overlap such an area, with
    wrap-around.  */
 static struct area_entry *
@@ -472,6 +466,7 @@ pv_area_store (struct pv_area *area,
       while (e && overlaps (area, e, offset, size))
         {
           struct area_entry *next = (e->next == e) ? 0 : e->next;
+
           e->prev->next = e->next;
           e->next->prev = e->prev;
 
@@ -495,7 +490,8 @@ pv_area_store (struct pv_area *area,
   else
     {
       CORE_ADDR offset = addr.k;
-      struct area_entry *e = (struct area_entry *) xmalloc (sizeof (*e));
+      struct area_entry *e = XNEW (struct area_entry);
+
       e->offset = offset;
       e->size = size;
       e->value = value;
This page took 0.024513 seconds and 4 git commands to generate.