public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* SGI/Irix: how to call procedure from GDB?
@ 2007-11-19  4:30 Gary Funck
       [not found] ` <B0D822BFECD50F4991F2516EA50F273C0367C768@NT-IRVA-0752.brcm.ad.broadcom.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Funck @ 2007-11-19  4:30 UTC (permalink / raw)
  To: GDB List


I'm trying to debug a problem in gcc using gdb (6.7.1)
on SGI/Irix 6.5.  GCC has been compiled with GCC 3.3
with '-g -O0' switches.  After hitting a breakpoint,
I try executing "p debug_tree(exp)" (via the gcc supplied
macro, "pt"), but instead, GDB issues the following somewhat
cryptic diagnostic:

  The program being debugged stopped while in a function called from GDB.
  When the function (debug_tree) is done executing, GDB will silently
  stop (instead of continuing to evaluate the expression containing
  the function call).

Any suggestions on what might've happened here, and what I
need to do to get GDB to to run the "debug_tree()" procedure?

thanks,
  - Gary

(Output excerpted below.)
-------------------------

Breakpoint 1, fancy_abort (file=0x10b75720 "/upc/dev/gary/gcc-upc-4-2/src/gcc/expr.c", 
    line=6882, function=0x10b75f58 "expand_expr_real_1")
    at /upc/dev/gary/gcc-upc-4-2/src/gcc/diagnostic.c:642
642       internal_error ("in %s, at %s:%d", function, trim_filename (file), line);
(gdb) up
#1  0x1031b788 in expand_expr_real_1 (exp=0x4200230, target=0x0, tmode=DImode, 
    modifier=EXPAND_INITIALIZER, alt_rtl=0x0)
    at /upc/dev/gary/gcc-upc-4-2/src/gcc/expr.c:6882
6882                      || TREE_CODE (exp) == FUNCTION_DECL);
(gdb) l
6877          context = decl_function_context (exp);
6878          gcc_assert (!context
6879                      || context == current_function_decl
6880                      || TREE_STATIC (exp)
6881                      /* ??? C++ creates functions that are not TREE_STATIC.  */
6882                      || TREE_CODE (exp) == FUNCTION_DECL);
6883    
6884          /* This is the case of an array whose size is to be determined
6885             from its initializer, while the initializer is still being parsed.
6886             See expand_decl.  */
(gdb) p exp
$1 = (tree) 0x4200230
(gdb) pt

Breakpoint 1, fancy_abort (file=0x10b75720 "/upc/dev/gary/gcc-upc-4-2/src/gcc/expr.c", 
    line=6882, function=0x10b75f58 "expand_expr_real_1")
    at /upc/dev/gary/gcc-upc-4-2/src/gcc/diagnostic.c:642
642       internal_error ("in %s, at %s:%d", function, trim_filename (file), line);
The program being debugged stopped while in a function called from GDB.
When the function (debug_tree) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).

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

* Re: SGI/Irix: how to call procedure from GDB?
       [not found] ` <B0D822BFECD50F4991F2516EA50F273C0367C768@NT-IRVA-0752.brcm.ad.broadcom.com>
@ 2007-11-19 15:03   ` Gary Funck
  2007-11-19 17:23     ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Funck @ 2007-11-19 15:03 UTC (permalink / raw)
  To: GDB List; +Cc: Robert Norton

On 11/19/07 03:04:38, Robert Norton wrote:
> > -----Original Message-----
> > From: Gary Funck
> > Sent: 19 November 2007 04:30
> > To: GDB List
> > Subject: SGI/Irix: how to call procedure from GDB?
> > 
> > [...]
> > Any suggestions on what might've happened here, and what I
> > need to do to get GDB to to run the "debug_tree()" procedure?
> 
> GDB called the debug_tree function _on the target_ in order to evaluate
> the expression. During execution of this the breakpoint at fancy_abort
> was hit again. You could try disabling the breakpoint, continuing then
> doing the pt command again, but it looks like you've run into another
> internal error during the evaluation of debug_tree so this probably
> isn't going to help.

That makes sense.  Thanks.

However, I just tried something simple.  A test program:

1       #include <stdio.h>
2       
3       int sq(int x)
4       {
5         return x * x;
6       }
7       
8       int main()
9       {
10        int x = 10;
11        int s = sq(x);
12        printf ("x = %d s = %d\n", x, s);
13      }

% gcc t.c -O0 -g -o t
% gdb t
GNU gdb 6.7.1
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mips-sgi-irix6.5"...
(gdb) b 11
Breakpoint 1 at 0x100013c0: file t.c, line 11.
(gdb) r
Starting program: /upc/dev/gary/gcc-upc-4-2/wrk/upc_test/test/t 
Breakpoint 1, main () at t.c:11
11        int s = sq(x);
(gdb) p sq(x)
Breakpoint 1, main () at t.c:11
11        int s = sq(x);
The program being debugged stopped while in a function called from GDB.
When the function (sq) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).

### if I delete all breakpoints, the following occurs:

(gdb) d
Delete all breakpoints? (y or n) y
(gdb) p sq(x)
x = 10 s = 100

Program exited normally.
The program being debugged stopped while in a function called from GDB.
When the function (sq) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).

Interestingly, I saw the same behavior with gdb 6.5, which I
had installed a while back.  But when I try the "freeware"
version built by SGI (gdb 5.3), all is well:

% /usr/freeware/bin/gdb --version
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
[...]
This GDB was configured as "mips-sgi-irix6.5"...
(gdb) b 12
Breakpoint 1 at 0x100013a8: file t.c, line 12.
(gdb) c
The program is not being run.
(gdb) r
Starting program: /upc/dev/gary/gcc-upc-4-2/wrk/upc_test/test/t 

Breakpoint 1, main () at t.c:12
12        int s = sq(x);
(gdb) p sq(x)
$1 = 100

It's been a while since I ran anything on that now antiquated
SGI/MIPS Irix box.  I recall installing gdb 6.5 because there
were limitations in gdb 5.3's understanding of the dwarf
debugging info.  What I don't recall is whether I tried calling
a procedure from gdb.

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

* Re: SGI/Irix: how to call procedure from GDB?
  2007-11-19 15:03   ` Gary Funck
@ 2007-11-19 17:23     ` Joel Brobecker
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2007-11-19 17:23 UTC (permalink / raw)
  To: Gary Funck; +Cc: GDB List, Robert Norton

It looks like function calls in broken on mips-irix, not sure why,
and unfortunately I don't have the time to investigate it right now.
If you are using GCC 3.3, I would suggest that you stick to gdb-5.3
for now. It should work well with that compiler.

-- 
Joel

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

end of thread, other threads:[~2007-11-19 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-19  4:30 SGI/Irix: how to call procedure from GDB? Gary Funck
     [not found] ` <B0D822BFECD50F4991F2516EA50F273C0367C768@NT-IRVA-0752.brcm.ad.broadcom.com>
2007-11-19 15:03   ` Gary Funck
2007-11-19 17:23     ` Joel Brobecker

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