public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* step into function fails
@ 2003-06-24  8:16 Bernd Geiser
  2003-06-24 14:47 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Bernd Geiser @ 2003-06-24  8:16 UTC (permalink / raw)
  To: gdb

I experienced it is not possible to step into functions of an executable 
with stabs-debug-info. Only "stepi" seems to help! A little research 
showed that this test (in gdb/infrun.c) fails:

    /* If we have line number information for the function we
         are thinking of stepping into, step into it.

         If there are several symtabs at that PC (e.g. with include
         files), just want to know whether any of them have line
         numbers.  find_pc_line handles this.  */
      {
        struct symtab_and_line tmp_sal;
        tmp_sal = find_pc_line (ecs->stop_func_start, 0);
===>    if (tmp_sal.line != 0)
          {
            step_into_function (ecs);
            return;
          }
      }

Consequently this one gets called:

  step_over_function (ecs);

which is obviously wrong.

I use gdb 5.3 and compiled the program with gcc 2.95.3 (both configured for a 
MIPS-target, but also the ARM-target fails, when compiling with -gstabs). The 
host is x86.

"objdump -G" proves the presence of line-number infomation. However, it is 
NOT generated for the respective function's start-address, but for a later 
address (after the prologue?):


----------- the (really simple :-) ) prog: --------------

int main()
{
  int a;
  a = doppelt(2);
  return a+1;
}

int doppelt(int x)
{
  return 2*x;
}

------------ its object-dump -------------------
bash# objdump -G mips_exec

mips:     file format elf32-little

Contents of .stab section:

Symnum n_type n_othr n_desc n_value  n_strx String

[...]
22     SLINE  0      42     00000050 0
23     SLINE  0      43     00000058 0
24     SLINE  0      44     00000058 0
25     SLINE  0      45     00000068 0
26     SLINE  0      46     00000080 0
27     SLINE  0      46     00000080 0
28     FUN    0      42     00000040 716    main:F1
29     LSYM   0      43     fffffff0 724    a:1
30     LBRAC  0      0      00000058 0
31     RBRAC  0      0      00000080 0
32     FUN    0      0      00000058 0
33     SOL    0      0      00000040 1      a.c
34     SLINE  0      49     000000a4 0
35     SLINE  0      50     000000a8 0
36     SLINE  0      51     000000c4 0
37     FUN    0      49     00000098 728    doppelt:F1
38     PSYM   0      48     00000000 739    x:p1
39     FUN    0      0      00000040 0
-----------------------------------------------------------


This effect appears for a MIPS- as well as an ARM-target when stabs-info is 
generated (the dwarf-format for the ARM works).

Is this a known issue or did anyone experience sth. similar? 

Bernd

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

* Re: step into function fails
  2003-06-24  8:16 step into function fails Bernd Geiser
@ 2003-06-24 14:47 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2003-06-24 14:47 UTC (permalink / raw)
  To: Bernd Geiser; +Cc: gdb

On Tue, Jun 24, 2003 at 10:05:09AM +0200, Bernd Geiser wrote:
> I experienced it is not possible to step into functions of an executable 
> with stabs-debug-info. Only "stepi" seems to help! A little research 
> showed that this test (in gdb/infrun.c) fails:
> 
>     /* If we have line number information for the function we
>          are thinking of stepping into, step into it.
> 
>          If there are several symtabs at that PC (e.g. with include
>          files), just want to know whether any of them have line
>          numbers.  find_pc_line handles this.  */
>       {
>         struct symtab_and_line tmp_sal;
>         tmp_sal = find_pc_line (ecs->stop_func_start, 0);
> ===>    if (tmp_sal.line != 0)
>           {
>             step_into_function (ecs);
>             return;
>           }
>       }
> 
> Consequently this one gets called:
> 
>   step_over_function (ecs);
> 
> which is obviously wrong.
> 
> I use gdb 5.3 and compiled the program with gcc 2.95.3 (both configured for a 
> MIPS-target, but also the ARM-target fails, when compiling with -gstabs). The 
> host is x86.

This is a known bug in GCC 2.95.3.  We added some code to GDB to try to
work around it, and in some cases it works, but the debug info is just
too messed up to get right reliably.

Recommend not using that version :)  3.2 does not seem to suffer from
this problem.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

end of thread, other threads:[~2003-06-24 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-24  8:16 step into function fails Bernd Geiser
2003-06-24 14:47 ` Daniel Jacobowitz

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