public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/16196] New: lazy string vs "print elements"
@ 2013-11-20 21:28 dje at google dot com
  2013-11-20 21:29 ` [Bug python/16196] " dje at google dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dje at google dot com @ 2013-11-20 21:28 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16196

            Bug ID: 16196
           Summary: lazy string vs "print elements"
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

Bug 10633 says this is fixed, and the printing may be, but there's an
optimization to be had here.
read_string doesn't obey fetchlimit if len != -1.
So if one is printing an uninitialized string, or just a very long string,
gdb will read the whole thing, even if "print elements" is much smaller.

Plus I found another issue:
- long -> int conversion in the extracted lazy string length loses precision
  [which while one wouldn't expect to have 4G strings, pretty printing an
uninitialized object should have more consistent behaviour]

Repro:
create long c++ string, set target debug 1, and print the string.
How many bytes are read from the target?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug python/16196] lazy string vs "print elements"
  2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
@ 2013-11-20 21:29 ` dje at google dot com
  2013-11-22 20:32 ` dje at google dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dje at google dot com @ 2013-11-20 21:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16196

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |saugustine at google dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug python/16196] lazy string vs "print elements"
  2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
  2013-11-20 21:29 ` [Bug python/16196] " dje at google dot com
@ 2013-11-22 20:32 ` dje at google dot com
  2013-11-22 22:01 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dje at google dot com @ 2013-11-22 20:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16196

--- Comment #1 from dje at google dot com ---
If partial_memory_read fails, it will fall back to a byte at a time.
This can be really painful on remote targets.
Maybe it would make sense to at least read 8 bytes at a time (that's what
read_string does), until that fails or len < 8, and then read a byte at a time.
[One could even try larger chunks first, but I think it would be ok to at least
start with 8 bytes at a time.]

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug python/16196] lazy string vs "print elements"
  2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
  2013-11-20 21:29 ` [Bug python/16196] " dje at google dot com
  2013-11-22 20:32 ` dje at google dot com
@ 2013-11-22 22:01 ` cvs-commit at gcc dot gnu.org
  2013-11-22 22:25 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-11-22 22:01 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=16196

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  f380848e84613364a17008f04e91bfef09eaf158 (commit)
      from  c0621699ffdbeea387ea37a90258939540b26424 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f380848e84613364a17008f04e91bfef09eaf158

commit f380848e84613364a17008f04e91bfef09eaf158
Author: Sterling Augustine <saugustine@google.com>
Date:   Fri Nov 22 13:55:32 2013 -0800

    2013-11-22  Sterling Augustine  <saugustine@google.com>

         PR gdb/16196:
         * valprint.c (read_string): Set new variable fetchlen based on
         fetchlimit and size.  Use it in call to partial_memory_read.
         Update comment.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog  |    7 +++++++
 gdb/valprint.c |   18 +++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug python/16196] lazy string vs "print elements"
  2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
                   ` (2 preceding siblings ...)
  2013-11-22 22:01 ` cvs-commit at gcc dot gnu.org
@ 2013-11-22 22:25 ` cvs-commit at gcc dot gnu.org
  2013-11-23  7:20 ` asmwarrior at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-11-22 22:25 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=16196

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  38e1f2a7d503d8abd788456782287383e0a0cfe8 (commit)
      from  f380848e84613364a17008f04e91bfef09eaf158 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=38e1f2a7d503d8abd788456782287383e0a0cfe8

commit 38e1f2a7d503d8abd788456782287383e0a0cfe8
Author: Sterling Augustine <saugustine@google.com>
Date:   Fri Nov 22 13:55:32 2013 -0800

    2013-11-22  Sterling Augustine  <saugustine@google.com>

         PR gdb/16196:
         * valprint.c (read_string): Set new variable fetchlen based on
         fetchlimit and size.  Use it in call to partial_memory_read.
         Update comment.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug python/16196] lazy string vs "print elements"
  2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
                   ` (3 preceding siblings ...)
  2013-11-22 22:25 ` cvs-commit at gcc dot gnu.org
@ 2013-11-23  7:20 ` asmwarrior at gmail dot com
  2013-11-24  7:33 ` asmwarrior at gmail dot com
  2023-12-09 13:04 ` ssbssa at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: asmwarrior at gmail dot com @ 2013-11-23  7:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16196

asmwarrior <asmwarrior at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asmwarrior at gmail dot com

--- Comment #4 from asmwarrior <asmwarrior at gmail dot com> ---
I'm not sure this bug is related to the bug I reported long time ago:
https://sourceware.org/bugzilla/show_bug.cgi?id=12127

In the bug #12127, I see GDB crash because xmalloc failed if we pass a large
random value as its argument, this mostly happens on GDB try to show an
un-initiliazed local variable (like std::vector), I have a crash backtrace in
https://sourceware.org/bugzilla/attachment.cgi?id=7017, my workaround is a
hard-coded patch here: https://sourceware.org/bugzilla/show_bug.cgi?id=12127#c5

Thanks.
Yuanhui Zhang

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug python/16196] lazy string vs "print elements"
  2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
                   ` (4 preceding siblings ...)
  2013-11-23  7:20 ` asmwarrior at gmail dot com
@ 2013-11-24  7:33 ` asmwarrior at gmail dot com
  2023-12-09 13:04 ` ssbssa at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: asmwarrior at gmail dot com @ 2013-11-24  7:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16196

--- Comment #5 from asmwarrior <asmwarrior at gmail dot com> ---
I add some comments in Bug #12127, see
(https://sourceware.org/bugzilla/show_bug.cgi?id=12127#c6), I think the fix in
this bug also fix Bug #12127.

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug python/16196] lazy string vs "print elements"
  2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
                   ` (5 preceding siblings ...)
  2013-11-24  7:33 ` asmwarrior at gmail dot com
@ 2023-12-09 13:04 ` ssbssa at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: ssbssa at sourceware dot org @ 2023-12-09 13:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16196

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #6 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Sourceware Commits from comment #2)
> This is an automated email from the git hooks/post-receive script. It was
> generated because a ref change was pushed to the repository containing
> the project "gdb and binutils".
> 
> The branch, master has been updated
>        via  f380848e84613364a17008f04e91bfef09eaf158 (commit)
>       from  c0621699ffdbeea387ea37a90258939540b26424 (commit)
> 
> Those revisions listed above that are new to this repository have
> not appeared on any other notification email; so we list those
> revisions in full, below.
> 
> - Log -----------------------------------------------------------------
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
> h=f380848e84613364a17008f04e91bfef09eaf158
> 
> commit f380848e84613364a17008f04e91bfef09eaf158
> Author: Sterling Augustine <saugustine@google.com>
> Date:   Fri Nov 22 13:55:32 2013 -0800
> 
>     2013-11-22  Sterling Augustine  <saugustine@google.com>
>     
>          PR gdb/16196:
>          * valprint.c (read_string): Set new variable fetchlen based on
>          fetchlimit and size.  Use it in call to partial_memory_read.
>          Update comment.
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  gdb/ChangeLog  |    7 +++++++
>  gdb/valprint.c |   18 +++++++++++-------
>  2 files changed, 18 insertions(+), 7 deletions(-)

Is there still something to do here after this commit?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-09 13:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 21:28 [Bug python/16196] New: lazy string vs "print elements" dje at google dot com
2013-11-20 21:29 ` [Bug python/16196] " dje at google dot com
2013-11-22 20:32 ` dje at google dot com
2013-11-22 22:01 ` cvs-commit at gcc dot gnu.org
2013-11-22 22:25 ` cvs-commit at gcc dot gnu.org
2013-11-23  7:20 ` asmwarrior at gmail dot com
2013-11-24  7:33 ` asmwarrior at gmail dot com
2023-12-09 13:04 ` ssbssa at sourceware dot org

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).