Pmc2c line numbering confuses gdb #641

Closed
plobsing opened this Issue Aug 10, 2010 · 5 comments

Comments

Projects
None yet
4 participants
@plobsing
Contributor

plobsing commented Aug 10, 2010

Using the default configuration, gdb is unable to step through vtables, giving messages such as:


0x00007ffff7a90ae4 in Parrot_OpLib_init_pmc (
    interp=0x60a080, _self=0x789770, 
    name_pmc=0x7892d0)
   from /home/pitr/dev/parrot/dynop_mapping/blib/lib/libparrot.so.2.6.0
(gdb) n
Single stepping until exit from function Parrot_OpLib_init_pmc, 
which has no line number information.
Parrot_pmc_new_init (interp=0x60a080, base_type=37, 
    init=0x7892d0) at src/pmc.c:551
551         return pmc;

This is a significant drag because much Parrot functionality is inside vtables.

Reconfiguring with --no-line-directives, which disables line directive generation from tools such as pmc2c, the vtables become steppable.

Originally http://trac.parrot.org/parrot/ticket/1735

@bacek

This comment has been minimized.

Show comment Hide comment
@bacek

bacek Nov 20, 2011

Member

Hello.

plobsing, what is purpose of this ticket? Fix line number regeneration by pmc2c?

-- Bacek

Member

bacek commented Nov 20, 2011

Hello.

plobsing, what is purpose of this ticket? Fix line number regeneration by pmc2c?

-- Bacek

@Whiteknight

This comment has been minimized.

Show comment Hide comment
@Whiteknight

Whiteknight May 9, 2012

Contributor

I think the solution here is to use the --no-line-directives flag when configuring. I might like to see that option become the default, since the line numbers added are not really helpful to developers, but so long as the option exists and we can turn it off I think this is a non-issue.

I will close this issue as WONTFIX in a day or two, unless anybody else has an opinion about it.

Contributor

Whiteknight commented May 9, 2012

I think the solution here is to use the --no-line-directives flag when configuring. I might like to see that option become the default, since the line numbers added are not really helpful to developers, but so long as the option exists and we can turn it off I think this is a non-issue.

I will close this issue as WONTFIX in a day or two, unless anybody else has an opinion about it.

@ghost ghost assigned Whiteknight May 9, 2012

rurban pushed a commit that referenced this issue Dec 28, 2012

Reini Urban
[GH #641] Renable line-directives for pmc
line directives point to the real errors in the original source.
The generated c file is sorted. Rather fix debugging problems if there are any.
@rurban

This comment has been minimized.

Show comment Hide comment
@rurban

rurban Dec 28, 2012

Member

I found no problem with wrong or missing PMC line numbers, only the problem that ops2c does not generate this information.
Single stepping and --tui stepping through vtables was much better with real line directives.

See eg. gdb --tui --args ./parrot t/pmc/oplib.t

   │48      =item C<void init_pmc(PMC *name_pmc)>                                                                               │
   │49                                                                                                                          │
   │50      Initializes the OpLib with information about an oplib.                                                              │
   │51                                                                                                                          │
   │52      =cut                                                                                                                │
   │53                                                                                                                          │
   │54      */                                                                                                                  │
   │55                                                                                                                          │
   │56          VTABLE void init_pmc(PMC *name_pmc) {                                                                           │
   │57              STRING   * const name      = VTABLE_get_string(INTERP, name_pmc);                                           │
   │58              char     * const name_cstr = Parrot_str_to_cstring(INTERP, name);                                           │
   │59              op_lib_t *oplib     = NULL;                                                                                 │
   │60                                                                                                                          │
  >│61              if (STREQ(name_cstr, PARROT_CORE_OPLIB_NAME)) {                                                             │
   │62                  oplib = PARROT_CORE_OPLIB_INIT(INTERP, 1);                                                              │
   │63              }                                                                                                           │
   │64              else {                                                                                                      │
   │65                  int i;                                                                                                  │
   │66                  for (i = 0; i < INTERP->n_libs; i++) {                                                                  │
   │67                      if (STREQ(name_cstr, INTERP->all_op_libs[i]->name)) {                                               │
   └68 ─────────                oplib = INTERP->all_op_libs[i];─────────────────────────────────────────────────────────────────┘
multi-thre process 16036 In: _dl_debug_state                                                       Line: ??   PC: 0x7ffff7deb780 
Breakpoint Thread 0x7ffff In: Parrot_OpLib_init_pmc_orig                                                 61               b911a6
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff4193700 (LWP 16039)]
1..13

Breakpoint 4, Parrot_OpLib_init_pmc (interp=0x412050, _self=PMC<OpLib> = {...}, name_pmc=PMC<String> = {...})
    at ./src/pmc/oplib.c:168
(gdb) s
Parrot_OpLib_init_pmc_orig (interp=0x412050, _self=PMC<OpLib> = {...}, name_pmc=PMC<String> = {...}) at ./src/pmc/oplib.pmc:57
(gdb) n
(gdb) n
(gdb) n
Member

rurban commented Dec 28, 2012

I found no problem with wrong or missing PMC line numbers, only the problem that ops2c does not generate this information.
Single stepping and --tui stepping through vtables was much better with real line directives.

See eg. gdb --tui --args ./parrot t/pmc/oplib.t

   │48      =item C<void init_pmc(PMC *name_pmc)>                                                                               │
   │49                                                                                                                          │
   │50      Initializes the OpLib with information about an oplib.                                                              │
   │51                                                                                                                          │
   │52      =cut                                                                                                                │
   │53                                                                                                                          │
   │54      */                                                                                                                  │
   │55                                                                                                                          │
   │56          VTABLE void init_pmc(PMC *name_pmc) {                                                                           │
   │57              STRING   * const name      = VTABLE_get_string(INTERP, name_pmc);                                           │
   │58              char     * const name_cstr = Parrot_str_to_cstring(INTERP, name);                                           │
   │59              op_lib_t *oplib     = NULL;                                                                                 │
   │60                                                                                                                          │
  >│61              if (STREQ(name_cstr, PARROT_CORE_OPLIB_NAME)) {                                                             │
   │62                  oplib = PARROT_CORE_OPLIB_INIT(INTERP, 1);                                                              │
   │63              }                                                                                                           │
   │64              else {                                                                                                      │
   │65                  int i;                                                                                                  │
   │66                  for (i = 0; i < INTERP->n_libs; i++) {                                                                  │
   │67                      if (STREQ(name_cstr, INTERP->all_op_libs[i]->name)) {                                               │
   └68 ─────────                oplib = INTERP->all_op_libs[i];─────────────────────────────────────────────────────────────────┘
multi-thre process 16036 In: _dl_debug_state                                                       Line: ??   PC: 0x7ffff7deb780 
Breakpoint Thread 0x7ffff In: Parrot_OpLib_init_pmc_orig                                                 61               b911a6
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff4193700 (LWP 16039)]
1..13

Breakpoint 4, Parrot_OpLib_init_pmc (interp=0x412050, _self=PMC<OpLib> = {...}, name_pmc=PMC<String> = {...})
    at ./src/pmc/oplib.c:168
(gdb) s
Parrot_OpLib_init_pmc_orig (interp=0x412050, _self=PMC<OpLib> = {...}, name_pmc=PMC<String> = {...}) at ./src/pmc/oplib.pmc:57
(gdb) n
(gdb) n
(gdb) n

rurban pushed a commit that referenced this issue Jan 2, 2013

Reini Urban
[GH #641] Renable line-directives for pmc
line directives point to the real errors in the original source.
The generated c file is sorted. Rather fix debugging problems if there are any.
@rurban

This comment has been minimized.

Show comment Hide comment
@rurban

rurban Jan 2, 2013

Member

Now merged back into master. pmc line-directives re-enabled, ops not yet.

Member

rurban commented Jan 2, 2013

Now merged back into master. pmc line-directives re-enabled, ops not yet.

@rurban

This comment has been minimized.

Show comment Hide comment
@rurban

rurban Jan 9, 2013

Member

Re-opening: found the offending wrong line numbers. Need to filter out lib/Parrot/Pmc2c/PCCMETHOD.pm emit'ed line directives.

Member

rurban commented Jan 9, 2013

Re-opening: found the offending wrong line numbers. Need to filter out lib/Parrot/Pmc2c/PCCMETHOD.pm emit'ed line directives.

@rurban rurban reopened this Jan 9, 2013

rurban pushed a commit that referenced this issue Jan 9, 2013

Reini Urban
[GH #641] Fix wrong PCCMETHOD line-directives (only .c)
PCCMETHOD only emits .c level lines, no PMC level ones. This generates now
proper directives for all _nci_ methods.

@rurban rurban closed this Jan 12, 2013

@Whiteknight Whiteknight removed their assignment Mar 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment