- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
Recently, I switched to develop Fortran program in Xcode with Intel Fortran compiler 11.1.084. When I debug, Xcode uses gdb. But I can't viewthe constant variables or public variables of a module from gdb. So how can I debug Fortran with idb in Xcode? I have done some search on the internet, but still can't figure it out.
And it seems that I can't see the array in user defined type with idb, too. It doesn't support "::" operator. How to see it?
Cheers,
DONG Li
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IDB does not work under Xcode.
What is the entire command and syntax you use in IDB to view the array component? type%array ?
ron
What is the entire command and syntax you use in IDB to view the array component? type%array ?
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ron,
What a pity that IDB doesn't work with Xcode!
I define a type "tracer_type", and declare a 1D array "tracers" in that type. When I am in IDB, I input "p tracers(1)", it says
(idb) p tracers(1)No symbol "tracers" in current context.Evaluating 'tracers' failed!Could not evaluate array expression tracers(1).cannot evaluate tracers(1)
Cheers,
DONG Li
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't seem to be able to reproduce what you are seeing. Here is my output:
fordprefect:731088 rwgreen$ ifort -o deb -save-temps -g -O0 deb.f90
fordprefect:731088 rwgreen$ idb deb
Intel Debugger for applications running on Intel 64, Version 11.1, Build [1.2097.2.319]
------------------
object file name: deb
Reading symbols from /Users/rwgreen/quads/forums/731088/deb...done.
(idb) list
5 real :: tracers(10)
6 end type tracer_type
7
8 type (tracer_type) :: my_struct
9
10 my_struct%tracers = 42.0
11
12 print*, "Tracer(1)", my_struct%tracers(1)
13
14 end program deb
(idb) break 12
Breakpoint 1 at 0x100000a06: file /Users/rwgreen/quads/forums/731088/deb.f90, line 12.
(idb) run
Starting program: /Users/rwgreen/quads/forums/731088/deb
Breakpoint 1, deb () at /Users/rwgreen/quads/forums/731088/deb.f90:12
12 print*, "Tracer(1)", my_struct%tracers(1)
(idb) p my_struct%tracers(1)
$1 = 42
(idb) p my_struct%tracers
$2 = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42}
(idb) quit
The program is running. Exit anyway? (y or n) y
fordprefect:731088 rwgreen$ cat deb.f90
program deb
implicit none
type tracer_type
real :: tracers(10)
end type tracer_type
type (tracer_type) :: my_struct
my_struct%tracers = 42.0
print*, "Tracer(1)", my_struct%tracers(1)
end program deb
fordprefect:731088 rwgreen$ ifort -o deb -save-temps -g -O0 deb.f90
fordprefect:731088 rwgreen$ idb deb
Intel Debugger for applications running on Intel 64, Version 11.1, Build [1.2097.2.319]
------------------
object file name: deb
Reading symbols from /Users/rwgreen/quads/forums/731088/deb...done.
(idb) list
5 real :: tracers(10)
6 end type tracer_type
7
8 type (tracer_type) :: my_struct
9
10 my_struct%tracers = 42.0
11
12 print*, "Tracer(1)", my_struct%tracers(1)
13
14 end program deb
(idb) break 12
Breakpoint 1 at 0x100000a06: file /Users/rwgreen/quads/forums/731088/deb.f90, line 12.
(idb) run
Starting program: /Users/rwgreen/quads/forums/731088/deb
Breakpoint 1, deb () at /Users/rwgreen/quads/forums/731088/deb.f90:12
12 print*, "Tracer(1)", my_struct%tracers(1)
(idb) p my_struct%tracers(1)
$1 = 42
(idb) p my_struct%tracers
$2 = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42}
(idb) quit
The program is running. Exit anyway? (y or n) y
fordprefect:731088 rwgreen$ cat deb.f90
program deb
implicit none
type tracer_type
real :: tracers(10)
end type tracer_type
type (tracer_type) :: my_struct
my_struct%tracers = 42.0
print*, "Tracer(1)", my_struct%tracers(1)
end program deb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, the simplified version of my code is
type tracer_type... ! some variablesend type tracer_typetype(tracer_type) tracers(10) ! an array in type of tracer_type
So I got an array in type of "tracer_type", not an array in the type structure of it.
Cheers
PS:
How do I input formal code with color in forum? : P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will have to show me your screen capture because I still can see the structure, as far as I understand:
ifort -o deb -save-temps -g -O0 deb.f90
fordprefect:731088 rwgreen$ !idb
idb ./deb
Intel Debugger for applications running on Intel 64, Version 11.1, Build [1.2097.2.319]
------------------
object file name: ./deb
Reading symbols from /Users/rwgreen/quads/forums/731088/deb...done.
(idb) list
6 integer :: bar
7 end type tracer_type
8
9 type (tracer_type) :: my_struct(10)
10
11 my_struct(1:10)%foo = 42.0
12 my_struct(1:10)%bar = 43
13
14 print*, "done"
15
(idb) break 14
Breakpoint 1 at 0x100000a39: file /Users/rwgreen/quads/forums/731088/deb.f90, line 14.
(idb) run
Starting program: /Users/rwgreen/quads/forums/731088/deb
Breakpoint 1, deb () at /Users/rwgreen/quads/forums/731088/deb.f90:14
14 print*, "done"
(idb) p my_struct(1)
$1 = {foo = 42, bar = 43}
(idb) p my_struct
$2 = {{foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}}
(idb) quit
The program is running. Exit anyway? (y or n) y
fordprefect:731088 rwgreen$
fordprefect:731088 rwgreen$
fordprefect:731088 rwgreen$ cat deb.f90
program deb
implicit none
type tracer_type
real :: foo
integer :: bar
end type tracer_type
type (tracer_type) :: my_struct(10)
my_struct(1:10)%foo = 42.0
my_struct(1:10)%bar = 43
print*, "done"
end program deb
To insert text, there is an icon above the edit window, 2nd row, 4th icon. Looks like a pencil or erase - no, I think it is supposed to be a highlight pen. Try that.
ron
ifort -o deb -save-temps -g -O0 deb.f90
fordprefect:731088 rwgreen$ !idb
idb ./deb
Intel Debugger for applications running on Intel 64, Version 11.1, Build [1.2097.2.319]
------------------
object file name: ./deb
Reading symbols from /Users/rwgreen/quads/forums/731088/deb...done.
(idb) list
6 integer :: bar
7 end type tracer_type
8
9 type (tracer_type) :: my_struct(10)
10
11 my_struct(1:10)%foo = 42.0
12 my_struct(1:10)%bar = 43
13
14 print*, "done"
15
(idb) break 14
Breakpoint 1 at 0x100000a39: file /Users/rwgreen/quads/forums/731088/deb.f90, line 14.
(idb) run
Starting program: /Users/rwgreen/quads/forums/731088/deb
Breakpoint 1, deb () at /Users/rwgreen/quads/forums/731088/deb.f90:14
14 print*, "done"
(idb) p my_struct(1)
$1 = {foo = 42, bar = 43}
(idb) p my_struct
$2 = {{foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}, {foo = 42, bar = 43}}
(idb) quit
The program is running. Exit anyway? (y or n) y
fordprefect:731088 rwgreen$
fordprefect:731088 rwgreen$
fordprefect:731088 rwgreen$ cat deb.f90
program deb
implicit none
type tracer_type
real :: foo
integer :: bar
end type tracer_type
type (tracer_type) :: my_struct(10)
my_struct(1:10)%foo = 42.0
my_struct(1:10)%bar = 43
print*, "done"
end program deb
To insert text, there is an icon above the edit window, 2nd row, 4th icon. Looks like a pencil or erase - no, I think it is supposed to be a highlight pen. Try that.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ron,
I find out what is the problem. My main program (main.f90) uses a module (tracer.f90) which defines a type (tracer_type) and an array in that type (tracers). Then I can display the content of "tracers" in that module, but I can't see them in main program.
So the main program is not in the scope of "tracers".
I also tried "p tracer::tracers(1)", but it doesn't work. How to see it without in its module?
Thanks for help!
DONG Li
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CAn you show a code sample?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page