Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Understanding GDB frames
@ 2007-05-21 22:24 Maxim Grigoriev
  2007-05-21 23:28 ` Ross Morley
                   ` (3 more replies)
  0 siblings, 4 replies; 40+ messages in thread
From: Maxim Grigoriev @ 2007-05-21 22:24 UTC (permalink / raw)
  To: gdb, Marc Gauthier, Pete MacLiesh, Ross Morley

I experience some difficulties in finding a precise definition
of gdb frames.

Any help on choosing the right answer among the list provided
by me at the end of this message will be highly appreciated.

QUESTION
========

The program (frame.c) is

#include <stdio.h>

int frame_number = 1;

int f11(int b)
{
        int a;

        printf("f11() frame number %d\n", frame_number++);

        a = b + 1;
        b--;
        if (b != 0)
          {
            printf("f11() will be called recursively\n");
            f11(b);
          }
        return a;   /* <-- BP set here.  */
}

int f1(int a)
{
        return f11(a);
}

int main()
{
        int a = 1;
        int i;

        for (i = 0; i <2; i++)
          a = f11(a);

        a = f11(1);
        a = f1(1);

        return 0;
}

The gdb command file "CMD":

    break frame.c:18
    run
    continue
    continue
    continue
    continue
    kill
    quit

was used to run a gdb session like this :
    gdb <executable> --command=CMD

Let's define that "frames A and B are the same" if

    frame_id_eq ( A->this_id, B->this_id ) == true

The breakpoit has been set at line 18 and hit 5 times.
Execution control has been subsequently taken by
gdb in five frames numbered 1, 2, 3, 4, and 5.

According to the definition of GDB frames,
which statement is correct ?

ANSWERS
=======

1) All frames 1, 2, 3, 4, and 5 are the same;
2) All frames 1, 2, 3, 4, and 5 are different from each other;
3) Frames 1,2, and 4 are the same. Frames 3 and 5 are
   different from 1, 2, 4 and from each other;
4) It's implementation-dependent. While doing architecture ports,
   people decide how to implement frame_id-related functions
   to compare frames;
5) Other ( explanation would be appreciated ).

-- Maxim










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

end of thread, other threads:[~2007-05-24 21:56 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-21 22:24 Understanding GDB frames Maxim Grigoriev
2007-05-21 23:28 ` Ross Morley
2007-05-22  2:05   ` Nick Roberts
2007-05-22  2:31     ` Daniel Jacobowitz
2007-05-22  2:51       ` Nick Roberts
2007-05-22 10:58         ` Daniel Jacobowitz
2007-05-22  8:40       ` Ross Morley
2007-05-22 16:10         ` Marc Gauthier
2007-05-22 16:36           ` Daniel Jacobowitz
2007-05-22 18:14             ` Vladimir Prus
2007-05-22 18:33             ` Jim Ingham
2007-05-22 18:36               ` Daniel Jacobowitz
2007-05-23 21:45                 ` Jim Blandy
2007-05-22 17:20           ` Ross Morley
2007-05-22 20:24           ` Nick Roberts
2007-05-22 21:12             ` Maxim Grigoriev
2007-05-22  1:40 ` Joel Brobecker
2007-05-22  2:29 ` Daniel Jacobowitz
2007-05-22 18:37 ` Jim Blandy
2007-05-22 19:17   ` Maxim Grigoriev
2007-05-22 20:25     ` Nick Roberts
2007-05-22 20:33       ` Ross Morley
2007-05-22 20:45       ` Maxim Grigoriev
2007-05-22 21:26         ` Nick Roberts
2007-05-23  7:00           ` Eli Zaretskii
2007-05-23 10:48             ` Daniel Jacobowitz
2007-05-23 12:44               ` Eli Zaretskii
2007-05-22 23:56     ` Jim Blandy
2007-05-23  1:01       ` Maxim Grigoriev
2007-05-23  2:24         ` Daniel Jacobowitz
2007-05-23 16:37           ` Maxim Grigoriev
2007-05-23  0:05     ` Jim Blandy
2007-05-23  0:17       ` Daniel Jacobowitz
2007-05-23  0:17       ` Ross Morley
2007-05-23  0:32         ` Jim Blandy
2007-05-23  2:24           ` Ross Morley
2007-05-23 21:52             ` Jim Blandy
2007-05-24  0:05               ` Ross Morley
2007-05-24  1:24                 ` Ross Morley
2007-05-24 21:56                   ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox