Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@codesourcery.com>
To: Pedro Alves <pedro_alves@portugalmail.pt>
Cc: gdb-patches@sourceware.org
Subject: Re: COMMIT: addrmap changes
Date: Thu, 06 Dec 2007 21:41:00 -0000	[thread overview]
Message-ID: <m34pevhh00.fsf@codesourcery.com> (raw)
In-Reply-To: <47572BDD.2090803@portugalmail.pt> (Pedro Alves's message of "Wed, 05 Dec 2007 22:53:17 +0000")

Pedro Alves <pedro_alves at portugalmail.pt> writes:
> From the thread you've posted this first, I understood this
> was work in progress, so most likelly you're already addressing
> a few of these issues, but in case they slip through:
>
>  - GDB sources are now GPL v3
>  - I believe we're not allowed to use c99 features yet
>    (designated initializers in addrmap_fixed_funcs).
>
> and being picky:
>  - suspicious call to abort, should be gdb_assert, or
>    internal_error ?
>  - #if 1

Thanks very much for pointing these out.  I've committed the below;
I'll address the '#if 1' in a separate patch, since doing it right has
some consequences.

gdb/ChangeLog:
2007-12-05  Jim Blandy  <jimb@codesourcery.com>

2007-12-06  Jim Blandy  <jimb@codesourcery.com>

	* addrmap.c, addrmap.h: Update to GPLv3.

	* addrmap.c (struct addrmap): Make the referenced function table
	const.
	(addrmap_fixed_funcs, addrmap_mutable_funcs): Declare const.
	Don't use designated initializers.

	* addrmap.c (addrmap_fixed_create_fixed, addrmap_mutable_find)
	(addrmap_mutable_relocate): Use internal_error, not abort.

diff -r eb149f472ad0 gdb/addrmap.c
--- a/gdb/addrmap.c	Thu Dec 06 09:06:14 2007 -0800
+++ b/gdb/addrmap.c	Thu Dec 06 09:23:18 2007 -0800
@@ -6,7 +6,7 @@
 
    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,
@@ -15,9 +15,7 @@
    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 the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 
@@ -48,7 +46,7 @@ struct addrmap_funcs
 
 struct addrmap
 {
-  struct addrmap_funcs *funcs;
+  const struct addrmap_funcs *funcs;
 };
 
 
@@ -160,7 +158,9 @@ static struct addrmap *
 static struct addrmap *
 addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
 {
-  abort ();
+  internal_error (__FILE__, __LINE__,
+                  _("addrmap_create_fixed is not implemented yet "
+                    "for fixed addrmaps"));
 }
 
 
@@ -175,12 +175,12 @@ addrmap_fixed_relocate (struct addrmap *
 }
 
 
-static struct addrmap_funcs addrmap_fixed_funcs =
-{
-  .set_empty    = addrmap_fixed_set_empty,
-  .find         = addrmap_fixed_find,
-  .create_fixed = addrmap_fixed_create_fixed,
-  .relocate     = addrmap_fixed_relocate
+static const struct addrmap_funcs addrmap_fixed_funcs =
+{
+  addrmap_fixed_set_empty,
+  addrmap_fixed_find,
+  addrmap_fixed_create_fixed,
+  addrmap_fixed_relocate
 };
 
 
@@ -358,7 +358,9 @@ addrmap_mutable_find (struct addrmap *th
 addrmap_mutable_find (struct addrmap *this, CORE_ADDR addr)
 {
   /* Not needed yet.  */
-  abort ();
+  internal_error (__FILE__, __LINE__,
+                  _("addrmap_find is not implemented yet "
+                    "for mutable addrmaps"));
 }
 
 
@@ -429,16 +431,18 @@ addrmap_mutable_relocate (struct addrmap
 addrmap_mutable_relocate (struct addrmap *this, CORE_ADDR offset)
 {
   /* Not needed yet.  */
-  abort ();
-}
-
-
-static struct addrmap_funcs addrmap_mutable_funcs =
-{
-  .set_empty    = addrmap_mutable_set_empty,
-  .find         = addrmap_mutable_find,
-  .create_fixed = addrmap_mutable_create_fixed,
-  .relocate     = addrmap_mutable_relocate
+  internal_error (__FILE__, __LINE__,
+                  _("addrmap_relocate is not implemented yet "
+                    "for mutable addrmaps"));
+}
+
+
+static const struct addrmap_funcs addrmap_mutable_funcs =
+{
+  addrmap_mutable_set_empty,
+  addrmap_mutable_find,
+  addrmap_mutable_create_fixed,
+  addrmap_mutable_relocate
 };
 
 
diff -r eb149f472ad0 gdb/addrmap.h
--- a/gdb/addrmap.h	Thu Dec 06 09:06:14 2007 -0800
+++ b/gdb/addrmap.h	Thu Dec 06 09:23:18 2007 -0800
@@ -6,7 +6,7 @@
 
    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,
@@ -15,9 +15,7 @@
    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 the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef ADDRMAP_H
 #define ADDRMAP_H


      reply	other threads:[~2007-12-06 17:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 23:44 Jim Blandy
2007-12-05  1:41 ` Daniel Jacobowitz
2007-12-05 21:34   ` Jim Blandy
2007-12-06  4:35     ` Eli Zaretskii
2007-12-06 17:26       ` Jim Blandy
2007-12-05 22:55 ` Pedro Alves
2007-12-06 21:41   ` Jim Blandy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m34pevhh00.fsf@codesourcery.com \
    --to=jimb@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro_alves@portugalmail.pt \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox