public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/9884] New: Inefficient code in function default_print_registers_info
@ 2009-02-23 16:40 richard dot stuckey at arc dot com
2009-03-08 6:05 ` [Bug gdb/9884] " bauermann at sourceware dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: richard dot stuckey at arc dot com @ 2009-02-23 16:40 UTC (permalink / raw)
To: gdb-prs
In the function default_print_registers_info in the file infcmd.c, there is the code
/* If the register name is empty, it is undefined for this
processor, so don't display anything. */
if (gdbarch_register_name (gdbarch, i) == NULL
|| *(gdbarch_register_name (gdbarch, i)) == '\0')
continue;
fputs_filtered (gdbarch_register_name (gdbarch, i), file);
print_spaces_filtered (15 - strlen (gdbarch_register_name
(gdbarch, i)), file);
i.e. the function gdbarch_register_name may be called up to four times for each
register; it would be better to replace this code with
{
const char* name = gdbarch_register_name (gdbarch, i);
/* If the register name is empty, it is undefined for this
processor, so don't display anything. */
if (name == NULL || *name == '\0')
continue;
fputs_filtered (name, file);
print_spaces_filtered (15 - strlen (name), file);
}
--
Summary: Inefficient code in function
default_print_registers_info
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: gdb
AssignedTo: unassigned at sourceware dot org
ReportedBy: richard dot stuckey at arc dot com
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=9884
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/9884] Inefficient code in function default_print_registers_info
2009-02-23 16:40 [Bug gdb/9884] New: Inefficient code in function default_print_registers_info richard dot stuckey at arc dot com
@ 2009-03-08 6:05 ` bauermann at sourceware dot org
2009-03-08 6:05 ` bauermann at sourceware dot org
2009-03-09 11:14 ` richard dot stuckey at arc dot com
2 siblings, 0 replies; 4+ messages in thread
From: bauermann at sourceware dot org @ 2009-03-08 6:05 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From bauermann at sourceware dot org 2009-03-08 06:05 -------
I just had a look at the implementation of gdbarch_register_name for some
architectures, and the function is quite efficient, normaly just a few compares
and an array access. Perhaps it's a bit more complex for arches which use a
target description XML, I didn't look much into it. But even then it doesn't
seem to me it would be a problem.
Are you having actual performance issues in GDB because of this? If not, I'd
like to just close this. Not that it would be difficult to apply the code
snippet you mention, but I wouldn't like to start a trend of having bugzillas
opened for cosmetic issues in the source code...
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9884
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/9884] Inefficient code in function default_print_registers_info
2009-02-23 16:40 [Bug gdb/9884] New: Inefficient code in function default_print_registers_info richard dot stuckey at arc dot com
2009-03-08 6:05 ` [Bug gdb/9884] " bauermann at sourceware dot org
@ 2009-03-08 6:05 ` bauermann at sourceware dot org
2009-03-09 11:14 ` richard dot stuckey at arc dot com
2 siblings, 0 replies; 4+ messages in thread
From: bauermann at sourceware dot org @ 2009-03-08 6:05 UTC (permalink / raw)
To: gdb-prs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at sourceware dot|bauermann at sourceware dot
|org |org
Status|UNCONFIRMED |ASSIGNED
http://sourceware.org/bugzilla/show_bug.cgi?id=9884
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/9884] Inefficient code in function default_print_registers_info
2009-02-23 16:40 [Bug gdb/9884] New: Inefficient code in function default_print_registers_info richard dot stuckey at arc dot com
2009-03-08 6:05 ` [Bug gdb/9884] " bauermann at sourceware dot org
2009-03-08 6:05 ` bauermann at sourceware dot org
@ 2009-03-09 11:14 ` richard dot stuckey at arc dot com
2 siblings, 0 replies; 4+ messages in thread
From: richard dot stuckey at arc dot com @ 2009-03-09 11:14 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From richard dot stuckey at arc dot com 2009-03-09 11:14 -------
No, no performance issue seen, the code just struck me as inelegant: computing
the same quantity four times instead of once.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9884
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-09 11:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-23 16:40 [Bug gdb/9884] New: Inefficient code in function default_print_registers_info richard dot stuckey at arc dot com
2009-03-08 6:05 ` [Bug gdb/9884] " bauermann at sourceware dot org
2009-03-08 6:05 ` bauermann at sourceware dot org
2009-03-09 11:14 ` richard dot stuckey at arc dot com
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).