Sergio Durigan Junior | 1 Jun 2012 06:41
Picon
Favicon

[PATCH/obvious] Little optimization on symbol_demangled_name

Hi,

While working on something else, I noticed this little spot for
optimization.  Regtested on Fedora 16 x86_64, no regressions.  I believe
it's pretty obvious, but decided to check.  OK?

-- 
Sergio

2012-06-01  Sergio Durigan Junior  <sergiodj <at> redhat.com>

	* symtab.c (symbol_demangled_name): New variable `dem_name'.  Use
	it to optimize resolution of demangled name.

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 85ddd1d..6313372 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
 <at>  <at>  -850,6 +850,8  <at>  <at>  symbol_natural_name (const struct general_symbol_info *gsymbol)
 const char *
 symbol_demangled_name (const struct general_symbol_info *gsymbol)
 {
+  const char *dem_name = NULL;
+
   switch (gsymbol->language)
     {
     case language_cplus:
 <at>  <at>  -858,19 +860,19  <at>  <at>  symbol_demangled_name (const struct general_symbol_info *gsymbol)
     case language_java:
     case language_objc:
(Continue reading)

Metzger, Markus T | 1 Jun 2012 10:38
Picon
Favicon

RE: [PATCH 13/16] xml, btrace: define btrace xml document style

> -----Original Message-----
> From: Jan Kratochvil [mailto:jan.kratochvil <at> redhat.com]
> Sent: Wednesday, May 30, 2012 10:44 PM

Thanks for your review!

[...]

> > +*attributes) {
> > +  const char *version = xml_find_attribute (attributes,
> > +"version")->value;
> 
> Empty line.

Fixed.

[...]

> > +const struct gdb_xml_attribute block_attributes[] = {
> 
> It can be static.  The same in other cases.

Fixed.

[...]

> > +#if defined(HAVE_LIBEXPAT)
> > +  cleanup = make_cleanup (xfree, btrace);
> 
> Use VEC_cleanup, not xfree.
(Continue reading)

Metzger, Markus T | 1 Jun 2012 10:48
Picon
Favicon

RE: [PATCH 14/16] remote, btrace: add branch trace remote ops

> -----Original Message-----
> From: gdb-patches-owner <at> sourceware.org [mailto:gdb-patches-
> owner <at> sourceware.org] On Behalf Of Jan Kratochvil
> Sent: Wednesday, May 30, 2012 10:44 PM

Thanks for your review!

[...]

> > +  if (packet->support != PACKET_ENABLE)
> > +    {
> > +      errno = ENOSYS;
> 
> errno is not used for intra-GDB/gdbserver communication.  Everywhere.

I'll look into error handling.

> > +      return NULL;
> > +    }
> > +
> > +  buf += xsnprintf (buf, endbuf - buf, "%s", packet->name);  buf +=
> > + xsnprintf (buf, endbuf - buf, ":on:");  buf = write_ptid (buf,
> > + endbuf, ptid);  putpkt (rs->buf);  getpkt (&rs->buf, &rs->buf_size,
> > + 0);
> > +
> > +  switch (packet_ok (rs->buf, packet))
> > +    {
> > +    case PACKET_OK:
> > +      tinfo = xzalloc (sizeof (*tinfo));
> > +      if (tinfo)
(Continue reading)

Vladimir Prus | 1 Jun 2012 12:09
Picon
Favicon

Re: [PATCH v2] Add the "-info-os" command to MI

On 23/05/12 18:38, Stan Shebs wrote:
>  <at> {width="10",alignment="-1",col_name="col1",colhdr="Description" <at> }],
> +body=[item= <at> {col0="processes",col1="Listing of all processes" <at> },
> +      item= <at> {col0="procgroups",col1="Listing of all process groups" <at> },
> +      item= <at> {col0="threads",col1="Listing of all threads" <at> },
> +      item= <at> {col0="files",col1="Listing of all file descriptors" <at> },
> +      item= <at> {col0="sockets",col1="Listing of all internet-domain sockets" <at> },
> +      item= <at> {col0="shm",col1="Listing of all shared-memory regions" <at> },
> +      item= <at> {col0="semaphores",col1="Listing of all semaphores" <at> },
> +      item= <at> {col0="msg",col1="Listing of all message queues" <at> },
> +      item= <at> {col0="modules",col1="Listing of all loaded kernel

Stan,

I am afraid this output is not really good enough. From MI consumer standpoint, we need a clear
and concise labels for each resource type. Unfortunately, "shm" is not acceptable at all.
"Listing of all shared-memory regions" is unacceptably long. Besides, this would make a good title
for a table with output, but not really good title for a menu used to specify what to show. For
the record, here's the labels I have to use in actual UI code:

	ResourceClassContributionItem_0=Processes
	ResourceClassContributionItem_10=Shared memory regions
	ResourceClassContributionItem_12=Semaphores
	ResourceClassContributionItem_14=Message queues
	ResourceClassContributionItem_16=Kernel modules
	ResourceClassContributionItem_2=Process groups
	ResourceClassContributionItem_4=Threads
	ResourceClassContributionItem_6=Files
	ResourceClassContributionItem_8=Sockets

(Continue reading)

Metzger, Markus T | 1 Jun 2012 13:37
Picon
Favicon

RE: [PATCH 11/16] test, btrace: add branch trace tests

> -----Original Message-----
> From: Jan Kratochvil [mailto:jan.kratochvil <at> redhat.com]
> Sent: Wednesday, May 30, 2012 10:44 PM

Thanks for your review!

> >  *.log
> >  *.sum
> > +
> > +gdb/testsuite/gdb.btrace/list.x
>
> This is excessive.

Removed.

[...]

> > +++ b/gdb/testsuite/gdb.btrace/dec.c
> >  <at>  <at>  -0,0 +1,4  <at>  <at> 
>
> Missing copyright header.

Fixed.

> > +++ b/gdb/testsuite/gdb.btrace/list.s
>
> It should end with .S as it is used in GDB.  It should have i386 in its name 
> as it
> is x86-specific file.

(Continue reading)

Yao Qi | 1 Jun 2012 14:43
Gravatar

[testsuite] Check 'info proc' supported earlier

I saw the following fail when testing tic6x-elf gdb,

 info proc
 Not supported on this target.
 (gdb) FAIL: gdb.base/info-proc.exp: info proc without a process

looks like test case should check whether `info proc' is supported
earlier.  This patch is obvious, and I'll commit it in two or three
days if no comments.

gdb/testsuite:

2012-06-01  Yao Qi  <yao <at> codesourcery.com>

	* gdb.base/info-proc.exp: Return if target doesn't support
	'info proc'.
---
 gdb/testsuite/gdb.base/info-proc.exp |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp
index 14bd1ee..1cefb6d 100644
--- a/gdb/testsuite/gdb.base/info-proc.exp
+++ b/gdb/testsuite/gdb.base/info-proc.exp
 <at>  <at>  -47,25 +47,24  <at>  <at>  gdb_load ${binfile}

 gdb_test "help info proc" "Show /proc process information about .*"

-gdb_test "info proc" "No current process.*" "info proc without a process"
-
(Continue reading)

Yao Qi | 1 Jun 2012 14:48
Gravatar

[testsuite] Really ensure printf/fprintf are available in dprintf.exp

I noticed some fails of gdb.base/dprintf.exp on tic6x-elf-gdb testing.

 FAIL: gdb.base/dprintf.exp: 1st dprintf, call
 FAIL: gdb.base/dprintf.exp: 2nd dprintf, call

caused by unable to find symbol "printf" and "malloc",

 (gdb) continue
 Continuing.
 kickoff
 also to stderr
 No symbol "printf" in current context.

If printf/fprintf only prints constant string, compiler will replace
them to puts/fwrite respectively, and actual printf/fprintf is not
linked into executable.  This problem should affect other ELF gdb.

This patch simply add extra parameter in printf/fprintf to make sure
they are linked, instead of puts/fwrite.

I'll apply it in two or three days if no comments.

gdb/testsuite:

2012-06-01  Yao Qi  <yao <at> codesourcery.com>

	* gdb.base/dprintf.c (main): Add extra parameter.
	(bar): New function.  It is a dead function, but to ensure
	'malloc' is linked explicitly.
---
(Continue reading)

Pierre Muller | 1 Jun 2012 15:02
Picon

RE: [testsuite] Really ensure printf/fprintf are available in dprintf.exp

> +#include <stdlib.h>
> +/* Make sure function 'malloc' is linked into program.  One some
bare-mental
> +   port, if we don't use 'malloc', it will not be linked in program.
'malloc'
 Hi Yao,

I was just wondering if this is an expression that I do not know, or if 
you simply meant 'bare-metal'?

 Also, about the addition of 
+#include <stdlib.h>
in the middle of the source, I also had the impression that
traditionally, C sources group all include's at the top of the source,
but remember that I only program in C for GDB and I am a pascal code
developer otherwise...

Pierre Muller

Yao Qi | 1 Jun 2012 15:13
Gravatar

Re: [testsuite] Really ensure printf/fprintf are available in dprintf.exp

On 06/01/2012 09:02 PM, Pierre Muller wrote:
> I was just wondering if this is an expression that I do not know, or if 
> you simply meant 'bare-metal'?
> 

Hi Pierre,
I meant 'bare-metal'.  It was a typo.

>  Also, about the addition of 
> +#include <stdlib.h>
> in the middle of the source, I also had the impression that
> traditionally, C sources group all include's at the top of the source,
> but remember that I only program in C for GDB and I am a pascal code
> developer otherwise...

Usually, if I include a header for a small piece of code, I prefer to
place the include near by my code.  Otherwise, I'd like to put include
at the top of source.  It is just my personal habit.  Generally, either
should be OK.

--

-- 
Yao (齐尧)

Joakim Tjernlund | 1 Jun 2012 15:36
Picon

[PATCH] remote: Avoid unwanted shlib internal BPs When debugging Linux kernel or u-boot with Abatron BDI emulator an error occurs:

..
(gdb) tar remote bdi:2001
Remote debugging using bdi:2001
0xeff80050 in ?? ()
(gdb) mon reset
(gdb) cont
Continuing.
Warning:
Cannot insert breakpoint -1.
Error accessing memory address 0xc0000000: Unknown error 4294967295.

(gdb) maintenance info breakpoints
Num     Type           Disp Enb Address    What
-1      shlib events   keep y   0xc0000000 <_stext> inf 1

gdb mistakenly inserts a special shared library BP even though
there area no such libs in either linux or u-boot.

Fix this by explicitly informing remote_add_inferior() that
the remote is attached.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund <at> transmode.se>
---
 remote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/remote.c b/remote.c
index 04b818f..f06c119 100644
--- a/remote.c
+++ b/remote.c
(Continue reading)


Gmane