tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Improve generated .stabs to make easy to debug tinycc gen


From: Domingo Alvarez Duarte
Subject: [Tinycc-devel] Improve generated .stabs to make easy to debug tinycc generated code
Date: Sun, 30 Mar 2014 14:30:24 +0100

Hello all !

I'm trying to figure out why the fossil-scm compiled with tinycc on arm doesn't work as expected and again with my previous experience trying to figure out why tinycc was generating bad code on X86_64 I found that having function names on the generated .stabs is better than nothing but when we step through the code with gdb to find bugs it's a pain not been able to see parameters and local variables values.

I looked at the code and found that maybe would not be so hard to add more .stabs info in this function:
-----
static void put_func_debug(TCCState* tcc_state, Sym *sym)
{
    char buf[512];

    /* stabs info */
    /* XXX: we put here a dummy type */
    snprintf(buf, sizeof(buf), "%s:%c1", 
             tcc_state->tccgen_funcname, sym->type.t & VT_STATIC ? 'f' : 'F');
    put_stabs_r(tcc_state, buf, N_FUN, 0, tcc_state->tccpp_file->line_num, 0,
                tcc_state->tccgen_cur_text_section, sym->c);
    /* //gr gdb wants a line at the function */
    put_stabn(tcc_state, N_SLINE, 0, tcc_state->tccpp_file->line_num, 0); 
    tcc_state->tccgen_last_ind = 0;
    tcc_state->tccgen_last_line_num = 0;
}
-----

But as we was talking on other thread not knowing how the information is stored in the AST to use it here is sad.

Can someone with more knowledge do this or shed a light here ?

Cheers ! 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]