public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: Luis Machado <lgustavo@codesourcery.com>,  Doug Evans <xdje42@gmail.com>
Cc: GDB Patches <gdb-patches@sourceware.org>,
	 Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH] Replace the block_found global with explicit data-flow
Date: Sat, 01 Aug 2015 16:25:00 -0000	[thread overview]
Message-ID: <55BCF2E7.9000800@adacore.com> (raw)
In-Reply-To: <55BCEDF1.2070806@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

On 08/01/2015 06:04 PM, Luis Machado wrote:
>> +    sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN,
>> +                 0).symbol;
>>       }
>
> It is probably a matter of personal taste, but i find it easier and
> cleaner to get the result of lookup_symbol (...) assigned to a variable
> and then have the code access its 'symbol' field as opposed to chaining
> things like the above.
>
> The current codebase doesn't show many occurrences like the above.

Understood: here's an updated patch introducing a temporary to do this. 
Thank you!

-- 
Pierre-Marie de Rodat

[-- Attachment #2: 0001-Complete-the-previous-commit-block_found-refactoring.patch --]
[-- Type: text/x-patch, Size: 4403 bytes --]

From 426cecfa72c713442341a77a68b853c4a97e60d7 Mon Sep 17 00:00:00 2001
From: Pierre-Marie de Rodat <derodat@adacore.com>
Date: Sat, 1 Aug 2015 11:25:44 +0200
Subject: [PATCH] Complete the previous commit (block_found refactoring)

The previous commit (Replace the block_found global with explicit
data-flow) lacks updates in a couple of files because it was not tested
building GDB with --enable-targets=all... but buildbots did.  This adds
the appropriate simple updates to fix buildbots.

gdb/

	* alpha-mdebug-tdep.c (find_proc_desc): Update call to
	lookup_symbol.
	* ft32-tdep.c (ft32_skip_prologue): Likewise.
	* moxie-tdep.c (moxie_skip_prologue): Likewise.
	* mt-tdep.c (mt_skip_prologue): Likewise.
	* xstormy16-tdep.c (xstormy16_skip_prologue): Likewise.
---
 gdb/ChangeLog           | 9 +++++++++
 gdb/alpha-mdebug-tdep.c | 7 ++++++-
 gdb/ft32-tdep.c         | 2 +-
 gdb/moxie-tdep.c        | 2 +-
 gdb/mt-tdep.c           | 2 +-
 gdb/xstormy16-tdep.c    | 2 +-
 6 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e8c04c0..a62415f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
 2015-08-01  Pierre-Marie de Rodat  <derodat@adacore.com>
 
+	* alpha-mdebug-tdep.c (find_proc_desc): Update call to
+	lookup_symbol.
+	* ft32-tdep.c (ft32_skip_prologue): Likewise.
+	* moxie-tdep.c (moxie_skip_prologue): Likewise.
+	* mt-tdep.c (mt_skip_prologue): Likewise.
+	* xstormy16-tdep.c (xstormy16_skip_prologue): Likewise.
+
+2015-08-01  Pierre-Marie de Rodat  <derodat@adacore.com>
+
 	* ada-exp.y (write_object_renaming): Replace struct
 	ada_symbol_info with struct block_symbol.  Update field
 	references accordingly.
diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
index 2f58c64..acde3e6 100644
--- a/gdb/alpha-mdebug-tdep.c
+++ b/gdb/alpha-mdebug-tdep.c
@@ -107,7 +107,12 @@ find_proc_desc (CORE_ADDR pc)
 	   symbol reading.  */
 	sym = NULL;
       else
-	sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0);
+	{
+	  struct block_symbol bsym
+	    = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0);
+
+	  sym = bsym.symbol;
+	}
     }
 
   if (sym)
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index e7f4d1a..2e5deca 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -250,7 +250,7 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 	  plg_end = ft32_analyze_prologue (func_addr,
 					   func_end, &cache, gdbarch);
 	  /* Found a function.  */
-	  sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
+	  sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
 	  /* Don't use line number debug info for assembly source files.  */
 	  if ((sym != NULL) && SYMBOL_LANGUAGE (sym) != language_asm)
 	    {
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 555151d..9496314 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -241,7 +241,7 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 	  plg_end = moxie_analyze_prologue (func_addr, 
 					    func_end, &cache, gdbarch);
 	  /* Found a function.  */
-	  sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
+	  sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
 	  /* Don't use line number debug info for assembly source
 	     files.  */
 	  if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index 74d54a7..a9c1fbb 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -415,7 +415,7 @@ mt_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
       struct symbol *sym;
 
       /* Found a function.  */
-      sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
+      sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
       if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
 	{
 	  /* Don't use this trick for assembly source files.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 4faad2e..05b3039 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -433,7 +433,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
         return plg_end;
 
       /* Found a function.  */
-      sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
+      sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
       /* Don't use line number debug info for assembly source files.  */
       if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
 	{
-- 
2.4.6


  reply	other threads:[~2015-08-01 16:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 16:37 Pierre-Marie de Rodat
2015-07-21 18:49 ` Pierre-Marie de Rodat
2015-07-22 14:15   ` Doug Evans
2015-07-22 15:07     ` Pierre-Marie de Rodat
2015-07-22 15:48     ` Iain Buclaw
2015-07-30 13:44       ` Pierre-Marie de Rodat
2015-07-25 21:24   ` Doug Evans
2015-07-30 13:42     ` Pierre-Marie de Rodat
2015-08-01  8:57       ` Pierre-Marie de Rodat
2015-08-01  9:09         ` Pierre-Marie de Rodat
2015-08-01  9:35           ` Pierre-Marie de Rodat
2015-08-01 16:04             ` Luis Machado
2015-08-01 16:25               ` Pierre-Marie de Rodat [this message]
2015-08-01 18:24                 ` Luis Machado
2015-08-01 19:36                   ` Pierre-Marie de Rodat
2015-08-01 23:19                     ` Luis Machado
2015-08-02 18:17             ` Pedro Alves
2015-08-03  7:44               ` Pierre-Marie de Rodat
2015-08-03 16:39           ` Steve Ellcey
2015-08-03 17:12             ` Ulrich Weigand
2015-08-04  8:13               ` Pierre-Marie de Rodat
2015-08-03 17:12             ` Pedro Alves
2015-08-02 17:42         ` Doug Evans
2015-08-03  7:43           ` Pierre-Marie de Rodat

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=55BCF2E7.9000800@adacore.com \
    --to=derodat@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=palves@redhat.com \
    --cc=xdje42@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).