public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/13098] New: printf "%s","": evaluation of this expression requires the target program to be active
@ 2011-08-16 15:41 jan.kratochvil at redhat dot com
  2011-08-17 14:53 ` [Bug exp/13098] " teawater at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-08-16 15:41 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 13098
           Summary: printf "%s","": evaluation of this expression requires
                    the target program to be active
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: exp
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jan.kratochvil@redhat.com
    Classification: Unclassified
              Host: x86_64-unknown-linux-gnu
            Target: x86_64-unknown-linux-gnu


$ gdb -nx -ex 'printf "%s",""' -ex q
evaluation of this expression requires the target program to be active

#0  throw_verror (error=GENERIC_ERROR, fmt=0xe92190 "evaluation of this
expression requires the target program to be active", ap=0x7fffffffd228) at
exceptions.c:400
#1  in error (string=0xe92190 "evaluation of this expression requires the
target program to be active") at utils.c:780
#2  in find_function_in_inferior (name=0xe92224 "malloc",
objf_p=0x7fffffffd360) at valops.c:178
#3  in value_allocate_space_in_inferior (len=1) at valops.c:196
#4  in allocate_space_in_inferior (len=1) at valops.c:216
#5  in value_coerce_to_target (val=0x1ff6910) at valops.c:1608
#6  in value_coerce_array (arg1=0x1ff6910) at valops.c:1644
#7  in coerce_array (arg=0x1ff6910) at value.c:3099
#8  in value_as_address (val=0x1ff6910) at value.c:2200
#9  in ui_printf (arg=0x7fffffffdf0b "\"%s\",\"\"", stream=0x1fc6c40) at
./printcmd.c:2351
#10 in printf_command (arg=0x7fffffffdf0b "\"%s\",\"\"", from_tty=1) at
./printcmd.c:2701

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug exp/13098] printf "%s","": evaluation of this expression requires the target program to be active
  2011-08-16 15:41 [Bug exp/13098] New: printf "%s","": evaluation of this expression requires the target program to be active jan.kratochvil at redhat dot com
@ 2011-08-17 14:53 ` teawater at gmail dot com
  2023-04-28 17:45 ` cvs-commit at gcc dot gnu.org
  2023-04-28 17:48 ` keiths at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: teawater at gmail dot com @ 2011-08-17 14:53 UTC (permalink / raw)
  To: gdb-prs

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

teawater <teawater at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |teawater at gmail dot com

--- Comment #1 from teawater <teawater at gmail dot com> 2011-08-16 15:40:17 UTC ---
http://sourceware.org/ml/gdb-patches/2011-08/msg00320.html

I am working on this issue.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug exp/13098] printf "%s","": evaluation of this expression requires the target program to be active
  2011-08-16 15:41 [Bug exp/13098] New: printf "%s","": evaluation of this expression requires the target program to be active jan.kratochvil at redhat dot com
  2011-08-17 14:53 ` [Bug exp/13098] " teawater at gmail dot com
@ 2023-04-28 17:45 ` cvs-commit at gcc dot gnu.org
  2023-04-28 17:48 ` keiths at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-28 17:45 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Keith Seitz <kseitz@sourceware.org>:

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

commit 1956da78cf450543343d58e5da9dc3cc6846dfff
Author: Keith Seitz <keiths@redhat.com>
Date:   Fri Apr 28 10:43:20 2023 -0700

    Allow strings with printf/eval

    PR 13098 explains that if a user attempts to use a string with either
    `printf' (or `eval'), gdb returns an error (inferior not running):

    (gdb) printf "%s\n", "hello"
    evaluation of this expression requires the target program to be active

    However, the parser can certainly handle this case:

    (gdb) p "hello"
    $1 = "hello"

    This discrepancy occurs because printf_c_string does not handle
    this specific case.  The passed-in value that we are attempting to print
    as a string is TYPE_CODE_ARRAY but it's lval type is not_lval.

    printf_c_string will only attempt to print a string from the value's
    contents when !TYPE_CODE_PTR, lval is lval_internalvar, and the value's
    type is considered a string type:

      if (value->type ()->code () != TYPE_CODE_PTR
          && value->lval () == lval_internalvar
          && c_is_string_type_p (value->type ()))
        {
          ...
        }

    Otherwise, it attempts to read the value of the string from the target's
    memory (which is what actually generates the "evaluation of this ..."
    error message).

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

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

* [Bug exp/13098] printf "%s","": evaluation of this expression requires the target program to be active
  2011-08-16 15:41 [Bug exp/13098] New: printf "%s","": evaluation of this expression requires the target program to be active jan.kratochvil at redhat dot com
  2011-08-17 14:53 ` [Bug exp/13098] " teawater at gmail dot com
  2023-04-28 17:45 ` cvs-commit at gcc dot gnu.org
@ 2023-04-28 17:48 ` keiths at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: keiths at redhat dot com @ 2023-04-28 17:48 UTC (permalink / raw)
  To: gdb-prs

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

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |keiths at redhat dot com
                 CC|                            |keiths at redhat dot com
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Keith Seitz <keiths at redhat dot com> ---
Patch accepted and pushed to master.

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

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

end of thread, other threads:[~2023-04-28 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-16 15:41 [Bug exp/13098] New: printf "%s","": evaluation of this expression requires the target program to be active jan.kratochvil at redhat dot com
2011-08-17 14:53 ` [Bug exp/13098] " teawater at gmail dot com
2023-04-28 17:45 ` cvs-commit at gcc dot gnu.org
2023-04-28 17:48 ` keiths at redhat 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).