This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/2211: Cannot Share GDB variables with 'set env' or 'shell' commands


>Number:         2211
>Category:       gdb
>Synopsis:       Cannot Share GDB variables with 'set env' or 'shell' commands
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 04 18:08:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     M. Bytnar
>Release:        gdb-6.4
>Organization:
>Environment:
Fedora Core
>Description:
There is no means to evaluate a GDB expression in the 'set env' or 'shell' commands.
Please correct me if I am wrong, since the documentation and use of GDB has not revealed a way to do so.

Benefits of implementing this feature:
* A means to display a date variable in human readable by using the shell's "date" command.
* A means to customize program arguments for automation from within gdb.

Granted, setting variables is a first step. A second future step/suggestion might allow one to import shell variables into GDB variables. ie. 

  set env CURDATE=`date +%s`
  p shell_eval($CURDATE)

where "shell_eval(expression)" evaluates the given expression using the shell or 'set env' environment variables.
>How-To-Repeat:
Ideally, I would like to display the date (stored as seconds since the Unix Epoch) in my currently executing program (or from a core dump) to a human readable form using the 'date -d' shell command:

shell date -d '1970-01-01 gdb_eval(MyProgram::CurDate.secondsSinceEpoch) sec'

Where 'gdb_eval(expression)' is a means to evaluate an expression within the gdb 'shell' or 'set env' commands.

Currently, attempts to store a GDB variable using 'set env' or 'shell' both fail, because GDB forwards the string without performing evaluation.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]