Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Pmc2c line numbering confuses gdb #641

Closed
plobsing opened this Issue · 5 comments

4 participants

@plobsing
Collaborator

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
Collaborator

Hello.

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

-- Bacek

@Whiteknight

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.

@Whiteknight Whiteknight was assigned
@rurban rurban referenced this issue from a commit
@rurban rurban [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.
6ba3f3e
@rurban
Collaborator

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 rurban referenced this issue from a commit
@rurban rurban [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.
41a11f3
@rurban
Collaborator

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

@rurban rurban closed this
@rurban
Collaborator

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
@rurban rurban referenced this issue from a commit
@rurban rurban [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.
6dbc04d
@rurban rurban closed this
@Whiteknight Whiteknight removed their assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.