Suche C++ Runtime Error Detection Tool für UNIX



  • Am besten GNU/Freeware. Sollte sowas sein wie Purify von Rational oder Insure++ von Parasoft!
    Also Speicherlöcher finden und allgemeinen Aufbau besser analysieren können und so weiter...

    [ Dieser Beitrag wurde am 06.01.2003 um 11:51 Uhr von ElDiablo666 editiert. ]



  • Schau dir mal ccmalloc an:
    http://www.inf.ethz.ch/personal/biere/projects/ccmalloc/

    Beispiel-Quellcode:

    #include <stdio.h>
    #include <stdlib.h> /* malloc() realloc() free() */
    
    int main()
    {
      char* a;
      char* b;
    
      a = malloc(2000);
      b = malloc(3000);
    
      free(a);
    
      return 0;
    }
    

    Kompiliert mit: "ccmalloc gcc -g -ggdb -o main_binary main.o"

    erzeugt folgende Ausgabe:

    .--------------------------------------------------------------------------.
    |================ ccmalloc-0.3.9 (C) 1997-2001 Armin Biere ================|
    +--------------------------------------------------------------------------+
    | executable       = /home/descartes/main_binary                           |
    | startup file     = .ccmalloc                                             |
    | log file         = stderr                                                |
    | start time       = Mon Jan  6 13:07:42 2003                              |
    | operating system = Linux 2.4.18-bf2.4 i686 on debian                     |
    +--------------------------------------------------------------------------+
    | only-count        = 0            keep-deallocated-data = 0               |
    | check-interval    = 0            check-free-space      = 1               |
    | check-start       = 0            file-info             = 1               |
    | chain-length      = 0            additional-line       = 1               |
    | check-underwrites = 0            print-addresses       = 1               |
    | check-overwrites  = 0            print-on-one-line     = 0               |
    | sort-by-wasted    = 1            sort-by-size          = 1               |
    | # only-log-chain  = 0            continue              = 0               |
    | # dont-log-chain  = 0            statistics            = 1               |
    | debug             = 0            library-chains        = 0               |
    | load-dynlibs      = 1            align-8-byte          = 0               |
    | only-wasting-alloc= 1                                                    |
    `--------------------------------------------------------------------------'
    
    .---------------.
    |ccmalloc report|
    =======================================================
    | total # of|   allocated | deallocated |     garbage |
    +-----------+-------------+-------------+-------------+
    |      bytes|        5000 |        2000 |        3000 |
    +-----------+-------------+-------------+-------------+
    |allocations|           2 |           1 |           1 |
    +-----------------------------------------------------+
    | number of checks: 1                                 |
    | number of counts: 3                                 |
    | retrieving function names for addresses ... done.   |
    | reading file info from gdb ... done.                |
    | sorting by number of not reclaimed bytes ... done.  |
    | number of call chains: 1                            |
    | number of ignored call chains: 0                    |
    | number of reported call chains: 1                   |
    | number of internal call chains: 1                   |
    | number of library call chains: 0                    |
    =======================================================
    |
    *100.0% = 3000 Bytes of garbage allocated in 1 allocation
    |       | 1 allocated (3000 Bytes = 60.0% of total allocated)
    |       |
    |       @ [ 
    |       |   +0x0808a09c
    |       | ]
    |       |
    |       |       0x400349f1 in <__libc_start_main>
    |       |
    |       |       0x08049d88 in <main>
    |       |                  at main2.c:11
    |       |
    |       `-----> 0x08054002 in <malloc>
    |        
    `------------------------------------------------------
    

    [ Dieser Beitrag wurde am 06.01.2003 um 13:08 Uhr von Descartes editiert. ]



  • Original erstellt von ElDiablo666:
    **Am besten GNU/Freeware. Sollte sowas sein wie Purify von Rational oder Insure++ von Parasoft!
    Also Speicherlöcher finden und allgemeinen Aufbau besser analysieren können und so weiter...

    [ Dieser Beitrag wurde am 06.01.2003 um 11:51 Uhr von [qb]ElDiablo666** editiert. ][/QB]

    Rational Purify und Rational PurifyPlus gibt es auch für UNIX. Rational PurifyPlus ist zusätzlich auch für Linux verfügbar.

    Siehe: http://www.rational.com/tryit/index.jsp



  • Schade! ccmalloc läuft wohl nur unter Linux und nicht unter UNIX.



  • Original erstellt von ElDiablo666:
    Schade! ccmalloc läuft wohl nur unter Linux und nicht unter UNIX.

    Auszug aus der Datei FEATURES:

    > + OS: Linux, Solaris, and (NEW) FreeBSD[/b]

    Seit wann zählst du Solaris und *BSD nicht zu UNIX?

    Auszug aus der Homepage:

    > Version 0.3.4 added some initial support for SUN's Workshop Compiler CC.
    > But hold your breath. It is not working propertly yet.

    Kein Problem. Die GNU Compiler Collection (GCC) ist auch unter Solaris und *BSD verfügbar.



  • **
    > Version 0.3.4 added some initial support for SUN's Workshop Compiler CC.
    > But hold your breath. It is not working propertly yet.
    **
    Interessant... und gut zu wissen 😉
    Wobei der aktuelle Workshop 6.x übrigens ein enorm guter Detector integriert hat.... und auch ein Garbage-Collector ist für diesen Compiler downloadbar..



  • Original erstellt von Solaris'dUKe:


    > Version 0.3.4 added some initial support for SUN's Workshop Compiler CC.
    > But hold your breath. It is not working propertly yet.
    **
    Interessant... und gut zu wissen 😉
    Wobei der aktuelle Workshop 6.x übrigens ein enorm guter Detector integriert hat.... und auch ein Garbage-Collector ist für diesen Compiler downloadbar..**

    Mit dem "Boehm-Demers-Weiser conservative garbage collector" verfügt auch die GNU Compiler Collection über einen Garbage Collector.

    A garbage collector for C and C++
    http://www.hpl.hp.com/personal/Hans_Boehm/gc/



  • Original erstellt von Descartes:
    *Seit wann zählst du Solaris und BSD nicht zu UNIX?

    Ich hatte es unter HP-UX getestet!
    Und den garbage collector werde ich wohl auch mal testen...

    [ Dieser Beitrag wurde am 07.01.2003 um 10:50 Uhr von ElDiablo666 editiert. ]



  • Original erstellt von ElDiablo666:
    *[quote]Original erstellt von Descartes:
    [qb]Seit wann zählst du Solaris und BSD nicht zu UNIX?

    Ich hatte es unter HP-UX getestet!
    [/QB][/QUOTE]
    Immer schön in die Release Notes schauen ob die Zielplattform auch supported ist. Im Fall von HP-UX steht nämlich nichts dabei.

    Original erstellt von ElDiablo666:
    **
    Und den garbage collector werde ich wohl auch mal testen...
    **

    Einfache #include<gc/gc.h> und dann GC_malloc() und GC_free() verwenden statt malloc() und free().


Anmelden zum Antworten