Qt urgent



  • Hi everybody,
    my problem that i wana do a menu that display the name of source file ,
    so it's my method
    @
    QSet<QString> Program::filsource() {
    const char *path;
    int opt;
    enum {
    LINE_TO_CODE = 0,
    CODE_TO_LINE = 1,
    GET_LINE = 2,
    GET_ADDRESS = 3
    } opt_mode = LINE_TO_CODE;
    uint32_t opt_addr = 0;
    int opt_line = 0;
    const char *opt_file = 0;
    gel_line_map_t *map;
    map = gel_new_line_map(_file); //Ouvrez les informations de ligne de source debugage
    if(!map) {
    switch(gel_errno) {
    case GEL_ENOTFOUND:
    fprintf(stderr, "ERROR: no debugging line section in %s\n", path);
    //return 1;
    case GEL_EFORMAT:
    fprintf(stderr, "ERROR: bad formatted debugging line\n");
    //return 1;
    case GEL_ERESOURCE:
    fprintf(stderr, "ERROR: not enough memory \n");
    //return 1;
    case GEL_EDEPEND:
    fprintf(stderr, "ERROR: no parser for available debugging information\n");
    //return 2;
    default:
    assert(0);
    }
    gel_close(_file);
    //return 1;
    }
    QSet<QString> set;
    dwarf_line_iter_t iter;
    dwarf_location_t loc;
    for(loc = dwarf_first_line(&iter, map);
    loc.file;
    loc = dwarf_next_line(&iter))
    set.insert(loc.file);
    dwarf_delete_line_map(map);
    return set;
    }
    @

    and the code that i add to mainwindow is
    @
    QSet<QString> Program::filsource() {
    const char *path;
    int opt;
    enum {
    LINE_TO_CODE = 0,
    CODE_TO_LINE = 1,
    GET_LINE = 2,
    GET_ADDRESS = 3
    } opt_mode = LINE_TO_CODE;
    uint32_t opt_addr = 0;
    int opt_line = 0;
    const char *opt_file = 0;
    gel_line_map_t *map;
    map = gel_new_line_map(_file); //Ouvrez les informations de ligne de source debugage
    if(!map) {
    switch(gel_errno) {
    case GEL_ENOTFOUND:
    fprintf(stderr, "ERROR: no debugging line section in %s\n", path);
    //return 1;
    case GEL_EFORMAT:
    fprintf(stderr, "ERROR: bad formatted debugging line\n");
    //return 1;
    case GEL_ERESOURCE:
    fprintf(stderr, "ERROR: not enough memory \n");
    //return 1;
    case GEL_EDEPEND:
    fprintf(stderr, "ERROR: no parser for available debugging information\n");
    //return 2;
    default:
    assert(0);
    }
    gel_close(_file);
    //return 1;
    }
    QSet<QString> set;
    dwarf_line_iter_t iter;
    dwarf_location_t loc;
    for(loc = dwarf_first_line(&iter, map);
    loc.file;
    loc = dwarf_next_line(&iter))
    set.insert(loc.file);
    dwarf_delete_line_map(map);
    return set;
    }
    @
    the erreur is
    @
    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff7d89236 in Prog::filsource (this=0x0) at Prog.cpp:265
    265 map = gel_new_line_map(_file); //Ouvrez les informations de ligne de source debugage
    Missing separate debuginfos, use: debuginfo-install GConf2-2.28.0-6.el6.x86_64 ORBit2-2.14.17-3.2.el6_3.x86_64 PackageKit-gtk-module-0.5.8-21.el6.x86_64 atk-1.28.0-2.el6.x86_64 avahi-glib-0.6.25-12.el6.x86_64 avahi-libs-0.6.25-12.el6.x86_64 cairo-1.8.8-3.1.el6.x86_64 dbus-glib-0.86-6.el6_4.x86_64 dbus-libs-1.2.24-7.el6_3.x86_64 expat-2.0.1-11.el6_2.x86_64 fontconfig-2.8.0-3.el6.x86_64 freetype-2.3.11-14.el6_3.1.x86_64 glib2-2.22.5-7.el6.x86_64 glibc-2.12-1.107.el6.x86_64 gnome-keyring-2.28.2-8.el6_3.x86_64 gnome-vfs2-2.24.2-6.el6.x86_64 gtk2-2.18.9-12.el6.x86_64 gtk2-engines-2.18.4-5.el6.x86_64 keyutils-libs-1.4-4.el6.x86_64 krb5-libs-1.10.3-10.el6_4.3.x86_64 libICE-1.0.6-1.el6.x86_64 libSM-1.2.1-2.el6.x86_64 libX11-1.5.0-4.el6.x86_64 libXau-1.0.6-4.el6.x86_64 libXcomposite-0.4.3-4.el6.x86_64 libXcursor-1.1.13-2.el6.x86_64 libXdamage-1.1.3-4.el6.x86_64 libXext-1.3.1-2.el6.x86_64 libXfixes-5.0-3.el6.x86_64 libXi-1.6.1-3.el6.x86_64 libXinerama-1.1.2-2.el6.x86_64 libXrandr-1.4.0-1.el6.x86_64 libXrender-0.9.7-2.el6.x86_64 libart_lgpl-2.3.20-5.1.el6.x86_64 libbonobo-2.24.2-5.el6.x86_64 libbonoboui-2.24.2-3.el6.x86_64 libcanberra-0.22-1.el6.x86_64 libcanberra-gtk2-0.22-1.el6.x86_64 libcom_err-1.41.12-14.el6.x86_64 libgcc-4.4.7-3.el6.x86_64 libgnome-2.28.0-11.el6.x86_64 libgnomecanvas-2.26.0-4.el6.x86_64 libgnomeui-2.24.1-4.el6.x86_64 libogg-1.1.4-2.1.el6.x86_64 libpng-1.2.49-1.el6_2.x86_64 libselinux-2.0.94-5.3.el6.x86_64 libstdc++-4.4.7-3.el6.x86_64 libtdb-1.2.10-1.el6.x86_64 libtool-ltdl-2.2.6-15.5.el6.x86_64 libuuid-2.17.2-12.9.el6.x86_64 libvorbis-1.2.3-4.el6_2.1.x86_64 libxcb-1.8.1-1.el6.x86_64 libxml2-2.7.6-12.el6_4.1.x86_64 nss-softokn-freebl-3.12.9-11.el6.x86_64 openssl-1.0.0-27.el6_4.2.x86_64 pango-1.28.1-7.el6_3.x86_64 pixman-0.26.2-5.el6_4.x86_64 popt-1.13-7.el6.x86_64 qt-4.6.2-26.el6_4.x86_64 qt-x11-4.6.2-26.el6_4.x86_64 zlib-1.2.3-29.el6.x86_64
    @

    what should i do svppp

    [edit, code wrappings added, koahnig]


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Please enclose your code with coding tags, it's pretty unreadable without them.

    I would also suggest a title change, yours doesn't reflect your problem so there are good chance that only few people will take a look if at all.


  • Moderators

    As SGaist already suggested. In addition here is a "link to the way how to place code wrappings.":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01

    Will introduce them for you this time.


  • Moderators

    The best recommendations at this time are probably use the debugger and check where this error occurs. Alternatively, you need to check the places where you have changed just prior before this error occurred.

    With the given segmentation fault the system tells that something is badly broken (e.g. access to an undefined pointer and similar).

    Personally, it would be good to have a better structure in your program for your overview. The code wrappings helped a bit, but the missing structure does not make your code easy read.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.