www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/10/12:39:43

Date: Thu, 10 Apr 1997 12:27:23 -0400 (EDT)
From: "art s. kagel IFMX x2697" <kagel AT dg1 DOT bloomberg DOT com>
To: "Nihat M. Gurmen" <gurmen AT eng DOT usf DOT edu>
Cc: djgpp AT delorie DOT com
Subject: Re: A fortran question regarding gdb
In-Reply-To: <334BD392.741D@eng.usf.edu>
Message-Id: <Pine.D-G.3.91.970410121220.14655A-100000@dg1>
Mime-Version: 1.0

In dbx you can:

print /d 0x1a3cd321

In gdb you can use either:

print {long}0x1a3cd321

-OR-

x /d 0x1a3cd321

Here is the GDB help:
(gdb) help print
Print value of expression EXP.
Variables accessible are those of the lexical environment of the selected
stack frame, plus all those whose scope is global or an entire file.
 
$NUM gets previous value number NUM.  $ and $$ are the last two values.
$$NUM refers to NUM'th value back from the last one.
Names starting with $ refer to registers (with the values they would have
if the program were to return to the stack frame now selected, restoring
all registers saved by frames farther in) or else to debugger
"convenience" variables (any such name not a known register).
Use assignment expressions to give values to convenience variables.
 
{TYPE}ADREXP refers to a datum of data type TYPE, located at address ADREXP.
@ is a binary operator for treating consecutive data objects
anywhere in memory as an array.  FOO AT NUM gives an array whose first
element is FOO, whose second element is stored in the space following
where FOO is stored, etc.  FOO must be an expression whose value
resides in memory.
 
EXP may be preceded with /FMT, where FMT is a format letter
but no count or size letter (see "x" command).


(gdb) help x
Examine memory: x/FMT ADDRESS.
ADDRESS is an expression for the memory address to examine.
FMT is a repeat count followed by a format letter and a size letter.
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
  t(binary), f(float), a(address), i(instruction), c(char) and s(string).
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).
The specified number of objects of the specified size are printed
according to the format.
 
Defaults for format and size letters are those previously used.
Default count is 1.  Default address is following last thing printed
with this command or "print".
(gdb) 


BTW: what does GDB print when you try to print or describe (whatis) the 
common block name?  If it recognizes that you may need to prepend the common 
block elements with the common name as if you were accessing a static 
declared in another function or file.  I am not sure I have never tried to 
debug FORTRAN in GDB.  I cannot remember the format and it is not in 
the GDB docs I could find but I suspect that it is either 
commonname:element or commonname.element.

Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

On Wed, 9 Apr 1997, Nihat M. Gurmen wrote:

> Hi:
> 
> I installed g770519 for DJGPP dev. env. .  I am using gdb to debug my
> program.  I can access the variables which are not listed in common
> blocks.  When I am trying to print the variables in a common block all I
> get is a memory address.  How can I retrieve the value of the variable
> at that address?  If GDB is not suitable for this, is there another free
> debugger for intel machines?  For example is there a port of DBX for
> DJGPP-Fortran?
> 
> Thanks for the help.
> --                   
> Nihat M. GURMEN      | University of South Florida   
> gurmen AT eng DOT usf DOT edu   | Chemical Engineering Department
> (813) 974-2139 (w)   | 4202 E. Fowler Av., ENG 320
> (813) 974-3651 (fax) | Tampa, FL, 33620 
> (813) 984-9497 (h)   | http://www.usf.edu
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019