From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, Phil Muldoon <pmuldoon@redhat.com>
Subject: [commit#2] [PATCH v5 6/7] compile: New 'compile print'
Date: Sat, 16 May 2015 13:39:00 -0000 [thread overview]
Message-ID: <20150516133924.GA3421@host1.jankratochvil.net> (raw)
In-Reply-To: <20150516125814.GE9862@host1.jankratochvil.net>
[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]
On Sat, 16 May 2015 14:58:14 +0200, Jan Kratochvil wrote:
> On Fri, 15 May 2015 19:04:03 +0200, Pedro Alves wrote:
> > On 05/13/2015 09:17 PM, Jan Kratochvil wrote:
> > > + if (TYPE_CODE (gdb_type) != TYPE_CODE_PTR)
> > > + error (_("Invalid type code %d of symbol \"%s\" "
> > > + "in compiled module \"%s\"."),
> > > + TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_VAL,
> > > + objfile_name (objfile));
> > > +
> > > + switch (TYPE_CODE (gdb_type_from_ptr))
> > > + {
> > > + case TYPE_CODE_ARRAY:
> > > + retval = gdb_type_from_ptr;
> > > + gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_type_from_ptr);
> > > + break;
> > > + case TYPE_CODE_FUNC:
> > > + retval = gdb_type_from_ptr;
> >
> > AFAIC, retval is always gdb_type_from_ptr, and could be
> > moved out of the switch.
>
> It was written this way as it has semantical logic - how the type is
> determined depends on TYPE_CODE_* of that object. Just accidentally in this
> case it is the same. I do not do performance micro-optimizations which
> compiler will do anyway. But I have changed it.
I see I made a thinko in that optimization, therefore checked-in this fix-up:
4d18dfad9edf822df205edc2c1fe3fe9f1e467b8
Jan
[-- Attachment #2: Type: message/rfc822, Size: 2046 bytes --]
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: [PATCH] compile: Fix detected inferior type
Date: Sat, 16 May 2015 15:36:33 +0200
gdb/ChangeLog
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-load.c (get_out_value_type): Fix returned type.
---
gdb/ChangeLog | 4 ++++
gdb/compile/compile-object-load.c | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3868599..e5de834 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,8 @@
2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * compile/compile-object-load.c (get_out_value_type): Fix returned type.
+
+2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Phil Muldoon <pmuldoon@redhat.com>
* NEWS (Changes since GDB 7.9): Add compile print.
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index ed5ef88..e2d8f2f 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -372,7 +372,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
enum compile_i_scope_types scope)
{
struct symbol *gdb_ptr_type_sym, *gdb_val_sym;
- struct type *gdb_ptr_type, *gdb_type_from_ptr, *gdb_type;
+ struct type *gdb_ptr_type, *gdb_type_from_ptr, *gdb_type, *retval;
const struct block *block;
const struct blockvector *bv;
int nblocks = 0;
@@ -440,6 +440,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_VAL,
objfile_name (objfile));
+ retval = gdb_type_from_ptr;
switch (TYPE_CODE (gdb_type_from_ptr))
{
case TYPE_CODE_ARRAY:
@@ -461,7 +462,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
objfile_name (objfile));
if (scope == COMPILE_I_PRINT_ADDRESS_SCOPE)
return NULL;
- return gdb_type_from_ptr;
+ return retval;
}
/* Fetch the type of first parameter of FUNC_SYM.
--
2.1.0
next prev parent reply other threads:[~2015-05-16 13:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 20:16 [PATCH v5 0/7] compile: compile print (&unmap) Jan Kratochvil
2015-05-13 20:16 ` [PATCH v5 1/7] compile: Add one debug message Jan Kratochvil
2015-05-15 16:49 ` Pedro Alves
2015-05-16 12:19 ` [commit] " Jan Kratochvil
2015-05-16 13:09 ` [patch] compile: gdb_stdout -> gdb_stdlog [compile: Add one debug message] Jan Kratochvil
2015-05-19 11:47 ` Pedro Alves
2015-05-19 12:28 ` [commit] " Jan Kratochvil
2015-05-13 20:16 ` [PATCH v5 4/7] compile: Use -Wall, not -w Jan Kratochvil
2015-05-15 16:49 ` Pedro Alves
2015-05-16 12:43 ` [commit] " Jan Kratochvil
2015-05-13 20:16 ` [PATCH v5 3/7] compile: Distribute scope, add scope_data Jan Kratochvil
2015-05-15 16:49 ` Pedro Alves
2015-05-16 12:39 ` [commit] " Jan Kratochvil
2015-05-13 20:16 ` [PATCH v5 2/7] Code cleanup: Make parts of print_command_1 public Jan Kratochvil
2015-05-16 12:27 ` [commit] " Jan Kratochvil
2015-05-13 20:17 ` [PATCH v5 6/7] compile: New 'compile print' Jan Kratochvil
2015-05-15 17:04 ` Pedro Alves
2015-05-16 12:58 ` [commit] " Jan Kratochvil
2015-05-16 13:39 ` Jan Kratochvil [this message]
2015-05-16 14:25 ` Patrick Palka
2015-05-16 14:39 ` [obv] " Jan Kratochvil
2015-05-13 20:17 ` [PATCH v5 7/7] RFC only: compile: Use also inferior munmap Jan Kratochvil
2015-05-13 20:17 ` [PATCH v5 5/7] Code cleanup: compile: func_addr -> func_sym Jan Kratochvil
2015-05-15 16:51 ` Pedro Alves
2015-05-16 12:45 ` [commit] " Jan Kratochvil
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=20150516133924.GA3421@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=pmuldoon@redhat.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