Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -uprN codeviz-1.0.12/CHANGELOG codeviz-1.0.12_/CHANGELOG
- --- codeviz-1.0.12/CHANGELOG 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/CHANGELOG 2019-03-31 16:24:53.304935828 +0900
- @@ -6,6 +6,7 @@ Version 1.0.12
- o Delete vim swap files (Petr Cerny)
- o Handle DESTDIR as an alternative installation root than / (Petr Cerny)
- o gcc 4.6.2 (Rafael Aquini)
- + o gcc 8.3.0 and x86_64 (AZO)
- Version 1.0.11
- o Update the cncc collection method to understand ncc 2.4 (Tim Auckland)
- diff -uprN codeviz-1.0.12/CREDITS codeviz-1.0.12_/CREDITS
- --- codeviz-1.0.12/CREDITS 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/CREDITS 2019-03-31 13:16:46.058092266 +0900
- @@ -6,3 +6,4 @@ Joel Soete <soete.joel@tiscali.be>
- Eric Sandeen <sandeen@sgi.com>
- Konstantin Popov <kost@sics.se>
- Tim Auckland <tima@broadcom.com>
- +AZO <typesylph@gmail.com>
- diff -uprN codeviz-1.0.12/Makefile.in codeviz-1.0.12_/Makefile.in
- --- codeviz-1.0.12/Makefile.in 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/Makefile.in 2019-04-01 09:17:16.990397160 +0900
- @@ -8,6 +8,7 @@ export CDEPN_SUPPRESS
- all:
- cd $(TOPLEVEL)/compilers; \
- + chmod +x install_gcc-$(GCCVERSION).sh; \
- ./install_gcc-$(GCCVERSION).sh $(GCCGRAPH) compile-only
- clean:
- diff -uprN codeviz-1.0.12/README codeviz-1.0.12_/README
- --- codeviz-1.0.12/README 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/README 2019-03-31 13:21:04.144499585 +0900
- @@ -65,20 +65,20 @@ some scripts are available in the compil
- The patched version of gcc and g++ outputs .cdepn files for every c and c++
- file compiled. This .cdepn file contains information such as when functions
- are called, where they are declared and so on. Earlier versions of CodeViz
- -supported multiple gcc versions but this one only support 4.6.2.
- +supported multiple gcc versions but this one only support 8.3.0.
- First, the source tar has to be downloaded. For those who have better things
- to do than read the gcc install doc, just do the following
- cd compilers
- -ncftpget ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.6.2/gcc-4.6.2.tar.gz
- -./install_gcc-4.6.2.sh <optional install path>
- +ncftpget ftp://ftp.gnu.org/pub/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz
- +./install_gcc-8.3.0.sh <optional install path>
- This script will untar gcc, patch it and install it to the supplied path. If
- no path is given, it'll be installed to $HOME/gcc-graph . I usually install
- it to /usr/local/gcc-graph with
- -./install_gcc-4.6.2.sh /usr/local/gcc-graph
- +./install_gcc-8.3.0.sh /usr/local/gcc-graph
- If you seriously want to patch by hand, just read the script as it goes through
- each of the steps one at a time. There is one step to note though.
- diff -uprN codeviz-1.0.12/README-GCC-8.3.0 codeviz-1.0.12_/README-GCC-8.3.0
- --- codeviz-1.0.12/README-GCC-8.3.0 1970-01-01 09:00:00.000000000 +0900
- +++ codeviz-1.0.12_/README-GCC-8.3.0 2019-04-01 12:11:00.687903583 +0900
- @@ -0,0 +1,66 @@
- +GCC 8.3.0 notes
- +---------------
- +Apr 1, 2019 written by AZO
- +
- +* Environment
- + - 64bit only
- + - tested on Ubuntu 18.10 64bit(x86_64) and Cygwin 64bit(x86_64)
- + - not tested on AArch64
- + - multithread compile
- + - fixed for Perl 5.26 ('syntax error' when use gengraph, but output PS file)
- +
- +* Ubuntu 18.10 64bit
- + - first, install packages with follow command
- + ```shell
- + sudo apt install build-essential texinfo automake libtool git tar \
- + wget perl libgmp-dev libmpfr-dev libmpc-dev graphviz
- + ```
- +
- +* Cygwin 64bit
- + - When setup, select follow packages
- + - binutils
- + - gcc
- + - g++
- + - make
- + - texinfo
- + - automake
- + - libtool
- + - git
- + - tar
- + - xz
- + - wget
- + - patch
- + - perl
- + - libgmp-devel
- + - libmpfr-devel
- + - libmcp-devel
- + - graphviz
- +
- +* common
- + - get source-files from GitHub
- + ```shell
- + git clone https://github.com/AZO234/codeviz.git
- + ```
- + - configure
- + ```shell
- + cd codeviz
- + ./configure
- + ```
- + - make (don't set -j option)
- + ```shell
- + make
- + ```
- + - install
- + - Ubuntu 18.10 64bit
- + ```shell
- + sudo make install
- + ```
- + - Cygwin 64bit
- + ```shell
- + make install
- + ```
- +
- +* default install files
- + /usr/local/bin : perl scripts (gengraph, genfull)
- + /usr/local/gccgraph : gcc binary, includes, libraries
- +
- diff -uprN codeviz-1.0.12/compilers/gcc-patches/gcc-8.3.0-cdepn.diff codeviz-1.0.12_/compilers/gcc-patches/gcc-8.3.0-cdepn.diff
- --- codeviz-1.0.12/compilers/gcc-patches/gcc-8.3.0-cdepn.diff 1970-01-01 09:00:00.000000000 +0900
- +++ codeviz-1.0.12_/compilers/gcc-patches/gcc-8.3.0-cdepn.diff 2019-03-31 14:56:15.619267000 +0900
- @@ -0,0 +1,205 @@
- +diff -uprN gcc-8.3.0/gcc/cgraph.c gcc-8.3.0_/gcc/cgraph.c
- +--- gcc-8.3.0/gcc/cgraph.c 2018-05-28 22:44:18.000000000 +0900
- ++++ gcc-8.3.0_/gcc/cgraph.c 2019-03-31 13:06:46.192230294 +0900
- +@@ -828,7 +828,8 @@ cgraph_edge::set_call_stmt (gcall *new_s
- + cgraph_edge *
- + symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee,
- + gcall *call_stmt, profile_count count,
- +- bool indir_unknown_callee)
- ++ bool indir_unknown_callee,
- ++ location_t call_location)
- + {
- + cgraph_edge *edge;
- +
- +@@ -902,6 +903,8 @@ symbol_table::create_edge (cgraph_node *
- + if (call_stmt && caller->call_site_hash)
- + cgraph_add_edge_to_call_site_hash (edge);
- +
- ++ edge->call_location = call_location;
- ++
- + return edge;
- + }
- +
- +@@ -912,7 +915,7 @@ cgraph_node::create_edge (cgraph_node *c
- + gcall *call_stmt, profile_count count)
- + {
- + cgraph_edge *edge = symtab->create_edge (this, callee, call_stmt, count,
- +- false);
- ++ false, input_location);
- +
- + initialize_inline_failed (edge);
- +
- +@@ -950,7 +953,7 @@ cgraph_node::create_indirect_edge (gcall
- + bool compute_indirect_info)
- + {
- + cgraph_edge *edge = symtab->create_edge (this, NULL, call_stmt,
- +- count, true);
- ++ count, true, input_location);
- + tree target;
- +
- + initialize_inline_failed (edge);
- +diff -uprN gcc-8.3.0/gcc/cgraph.h gcc-8.3.0_/gcc/cgraph.h
- +--- gcc-8.3.0/gcc/cgraph.h 2018-05-28 22:44:18.000000000 +0900
- ++++ gcc-8.3.0_/gcc/cgraph.h 2019-03-31 14:08:31.805662556 +0900
- +@@ -1772,6 +1772,9 @@ struct GTY((chain_next ("%h.next_caller"
- +
- + /* Expected frequency of executions within the function. */
- + sreal sreal_frequency ();
- ++
- ++ /* CodeViz: Location the call occurred at */
- ++ location_t call_location;
- + private:
- + /* Remove the edge from the list of the callers of the callee. */
- + void remove_caller (void);
- +@@ -2288,7 +2291,8 @@ private:
- + edge). */
- + cgraph_edge *create_edge (cgraph_node *caller, cgraph_node *callee,
- + gcall *call_stmt, profile_count count,
- +- bool indir_unknown_callee);
- ++ bool indir_unknown_callee,
- ++ location_t call_location);
- +
- + /* Put the edge onto the free list. */
- + void free_edge (cgraph_edge *e);
- +diff -uprN gcc-8.3.0/gcc/cgraphunit.c gcc-8.3.0_/gcc/cgraphunit.c
- +--- gcc-8.3.0/gcc/cgraphunit.c 2018-05-28 22:44:18.000000000 +0900
- ++++ gcc-8.3.0_/gcc/cgraphunit.c 2019-03-31 14:28:51.574844134 +0900
- +@@ -602,10 +602,16 @@ cgraph_node::add_new_function (tree fnde
- + DECL_FUNCTION_PERSONALITY (fndecl) = lang_hooks.eh_personality ();
- + }
- +
- ++extern int cdepn_dump;
- + /* Analyze the function scheduled to be output. */
- + void
- + cgraph_node::analyze (void)
- + {
- ++ tree thisTree, calleeTree;
- ++ FILE *fnref_f;
- ++ cgraph_edge *calleeEdge;
- ++ expanded_location xloc;
- ++
- + if (native_rtl_p ())
- + {
- + analyzed = true;
- +@@ -691,6 +697,36 @@ cgraph_node::analyze (void)
- + analyzed = true;
- +
- + input_location = saved_loc;
- ++
- ++ if (cdepn_dump) {
- ++ /* CodeViz: Output information on this node */
- ++ thisTree = this->decl;
- ++ if ((fnref_f = cdepn_open(NULL)))
- ++ {
- ++ fprintf(fnref_f,"F {%s} {%s:%d}\n",
- ++ lang_hooks.decl_printable_name (thisTree, 2),
- ++ DECL_SOURCE_FILE (thisTree), DECL_SOURCE_LINE (thisTree));
- ++
- ++ }
- ++
- ++ /* CodeViz: Output information on all functions this node calls */
- ++ for (calleeEdge = this->callees; calleeEdge;
- ++ calleeEdge = calleeEdge->next_callee) {
- ++ calleeTree = calleeEdge->callee->decl;
- ++ if (thisTree != NULL &&
- ++ calleeTree != NULL &&
- ++ (fnref_f = cdepn_open(NULL)) != NULL)
- ++ {
- ++ xloc = expand_location(calleeEdge->call_location);
- ++ fprintf(fnref_f, "C {%s} {%s:%d} {%s}\n",
- ++ lang_hooks.decl_printable_name (thisTree, 2),
- ++ xloc.file, xloc.line,
- ++ lang_hooks.decl_printable_name (calleeTree, 2));
- ++ }
- ++ else
- ++ printf("CODEVIZ: Unexpected NULL encountered\n");
- ++ }
- ++ }
- + }
- +
- + /* C++ frontend produce same body aliases all over the place, even before PCH
- +diff -uprN gcc-8.3.0/gcc/toplev.c gcc-8.3.0_/gcc/toplev.c
- +--- gcc-8.3.0/gcc/toplev.c 2018-02-14 01:18:37.000000000 +0900
- ++++ gcc-8.3.0_/gcc/toplev.c 2019-03-31 14:41:11.531510182 +0900
- +@@ -2144,6 +2144,53 @@ do_compile ()
- + }
- + }
- +
- ++/*
- ++ * codeviz: Open the cdepn file. This is called with a filename by main()
- ++ * and with just NULL for every other instance to return just the handle
- ++ */
- ++FILE *g_fnref_f = NULL;
- ++char cdepnfile[256] = "--wonthappen--";
- ++int cdepn_dump = 0;
- ++
- ++FILE *cdepn_open(const char *filename) {
- ++ struct stat cdepnstat;
- ++ int errval;
- ++ time_t currtime;
- ++ if (filename && g_fnref_f == NULL) {
- ++ strcpy(cdepnfile, filename);
- ++ strcat(cdepnfile, ".cdepn");
- ++
- ++ /*
- ++ * Decide whether to open write or append. There appears to be a weird
- ++ * bug that decides to open the file twice, overwriting all the cdepn
- ++ * information put there before
- ++ */
- ++ errval = stat(cdepnfile, &cdepnstat);
- ++ currtime = time(NULL);
- ++ if (errval == -1 || currtime - cdepnstat.st_mtime > 5) {
- ++ g_fnref_f = fopen(cdepnfile, "w");
- ++ fprintf(stderr, "opened dep file %s\n",cdepnfile);
- ++ } else {
- ++ g_fnref_f = fopen(cdepnfile, "a");
- ++ fprintf(stderr, "append dep file %s\n",cdepnfile);
- ++ }
- ++
- ++ fflush(stderr);
- ++ }
- ++
- ++ return g_fnref_f;
- ++}
- ++
- ++void cdepn_close(void) {
- ++ if (g_fnref_f) fclose(g_fnref_f);
- ++ g_fnref_f = NULL;
- ++}
- ++
- ++int cdepn_checkprint(void *fncheck) {
- ++ return 1;
- ++ /*return (void *)fncheck == (void *)decl_name; */
- ++}
- ++
- + toplev::toplev (timer *external_timer,
- + bool init_signals)
- + : m_use_TV_TOTAL (external_timer == NULL),
- +@@ -2264,7 +2311,12 @@ toplev::main (int argc, char **argv)
- + {
- + if (m_use_TV_TOTAL)
- + start_timevars ();
- ++ cdepn_dump = ((getenv("CDEPN_SUPPRESS")) ? 0 : 1);
- ++ if (cdepn_dump)
- ++ cdepn_open(main_input_filename);
- + do_compile ();
- ++ if (cdepn_dump)
- ++ cdepn_close();
- + }
- +
- + if (warningcount || errorcount || werrorcount)
- +diff -uprN gcc-8.3.0/gcc/tree.h gcc-8.3.0_/gcc/tree.h
- +--- gcc-8.3.0/gcc/tree.h 2019-01-03 07:34:36.000000000 +0900
- ++++ gcc-8.3.0_/gcc/tree.h 2019-03-31 14:56:06.315311513 +0900
- +@@ -5870,4 +5870,11 @@ type_has_mode_precision_p (const_tree t)
- + return known_eq (TYPE_PRECISION (t), GET_MODE_PRECISION (TYPE_MODE (t)));
- + }
- +
- ++/*
- ++ * CodeViz functions to get the output file handle for cdepn files
- ++ */
- ++FILE *cdepn_open(const char *filename);
- ++void cdepn_close(void);
- ++int cdepn_checkprint(void *fncheck);
- ++
- + #endif /* GCC_TREE_H */
- diff -uprN codeviz-1.0.12/compilers/install_gcc-4.6.2.sh codeviz-1.0.12_/compilers/install_gcc-4.6.2.sh
- --- codeviz-1.0.12/compilers/install_gcc-4.6.2.sh 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/compilers/install_gcc-4.6.2.sh 2019-03-31 09:57:59.622269000 +0900
- @@ -28,6 +28,7 @@ tar -zxf gcc-4.6.2.tar.gz -C gcc-graph |
- # Apply patch
- cd gcc-graph/gcc-4.6.2
- +patch -p1 < ../../gcc-patches/gcc-4.6.2-codeviz.diff
- patch -p1 < ../../gcc-patches/gcc-4.6.2-cdepn.diff
- cd ../objdir
- diff -uprN codeviz-1.0.12/compilers/install_gcc-8.3.0.sh codeviz-1.0.12_/compilers/install_gcc-8.3.0.sh
- --- codeviz-1.0.12/compilers/install_gcc-8.3.0.sh 1970-01-01 09:00:00.000000000 +0900
- +++ codeviz-1.0.12_/compilers/install_gcc-8.3.0.sh 2019-04-01 10:04:07.761473951 +0900
- @@ -0,0 +1,87 @@
- +#!/bin/bash
- +
- +INSTALL_PATH=$HOME/gcc-graph
- +if [ "$1" != "" ]; then INSTALL_PATH=$1; fi
- +if [ "$2" = "compile-only" ]; then export COMPILE_ONLY=yes; fi
- +echo Installing gcc to $INSTALL_PATH
- +
- +JOBS=`which nproc`
- +EXIT=$?
- +if [ "$EXIT" != "0" ]; then
- + JOBS=1
- +else
- + JOBS=`nproc`
- +fi
- +
- +if [ ! -e gcc-8.3.0.tar.xz ]; then
- + echo gcc-8.3.0.tar.xz not found, downloading
- + wget ftp://ftp.gnu.org/pub/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz
- + if [ ! -e gcc-8.3.0.tar.xz ]; then
- + echo Failed to download gcc, download gcc-8.3.0.tar.xz from www.gnu.org
- + exit
- + fi
- +fi
- +
- +# Untar gcc
- +rm -rf gcc-graph/objdir 2> /dev/null
- +mkdir -p gcc-graph/objdir
- +echo Untarring gcc...
- +tar -Jxf gcc-8.3.0.tar.xz -C gcc-graph || exit
- +
- +# Apply patch
- +cd gcc-graph/gcc-8.3.0
- +patch -p1 < ../../gcc-patches/gcc-8.3.0-cdepn.diff
- +cd ../objdir
- +
- +# Configure and compile
- +../gcc-8.3.0/configure --prefix=$INSTALL_PATH --enable-shared --enable-languages=c,c++ || exit
- +make bootstrap -j$JOBS
- +
- +RETVAL=$?
- +PLATFORM=x86_64-pc-linux-gnu
- +if [ $RETVAL != 0 ]; then
- + if [ ! -e $PLATFORM/libiberty/config.h ]; then
- + echo Checking if this is AArch64
- + echo Note: This is untested, if building with AArch64 works, please email mel@csn.ul.ie with
- + echo a report
- + PLATFORM=aarch64-linux-gnu
- + if [ ! -e $PLATFORM/libiberty/config.h ]; then
- + echo Checking if this is CygWin
- + echo Note: This is untested, if building with Cygwin works, please email mel@csn.ul.ie with
- + echo a report
- + export PLATFORM=x86_64-unknown-cygwin
- + if [ ! -e $PLATFORM/libiberty/config.h ]; then
- + echo Do not know how to fix this compile error up, exiting...
- + exit -1
- + fi
- + fi
- + fi
- + cd $PLATFORM/libiberty/
- + cat config.h | sed -e 's/.*undef HAVE_LIMITS_H.*/\#define HAVE_LIMITS_H 1/' > config.h.tmp && mv config.h.tmp config.h
- + cat config.h | sed -e 's/.*undef HAVE_STDLIB_H.*/\#define HAVE_STDLIB_H 1/' > config.h.tmp && mv config.h.tmp config.h
- + cat config.h | sed -e 's/.*undef HAVE_UNISTD_H.*/\#define HAVE_UNISTD_H 1/' > config.h.tmp && mv config.h.tmp config.h
- + cat config.h | sed -e 's/.*undef HAVE_SYS_STAT_H.*/\#define HAVE_LIMITS_H 1/' > config.h.tmp && mv config.h.tmp config.h
- + if [ "$PLATFORM" = "x86_64-unknown-cygwin" ]; then
- + echo "#undef HAVE_GETTIMEOFDAY" >> config.h
- + fi
- +
- + TEST=`grep HAVE_SYS_STAT_H config.h`
- + if [ "$TEST" = "" ]; then
- + echo "#undef HAVE_SYS_STAT_H" >> config.h
- + echo "#define HAVE_SYS_STAT_H 1" >> config.h
- + fi
- + cd ../../
- + make -j$JOBS
- +
- + RETVAL=$?
- + if [ $RETVAL != 0 ]; then
- + echo
- + echo Compile saved after trying to fix up config.h, do not know what to do
- + echo This is likely a CodeViz rather than a gcc problem
- + exit -1
- + fi
- +fi
- +
- +if [ "$COMPILE_ONLY" != "yes" ]; then
- + make install
- +fi
- diff -uprN codeviz-1.0.12/configure codeviz-1.0.12_/configure
- --- codeviz-1.0.12/configure 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/configure 2019-04-01 09:13:58.812060351 +0900
- @@ -6,7 +6,7 @@
- # the scripts. It is meant to behave similar to ordinary configure scripts
- PREFIX=/usr/local
- -GCCVERSION=4.6.2
- +GCCVERSION=8.3.0
- GCCGRAPH=-unset-
- # Print program usage
- @@ -17,8 +17,8 @@ usage() {
- echo " -h, --help display this help and exit"
- echo " --prefix=PREFIX install architecture-independent files in PREFIX"
- echo " [Default: /usr/local]"
- - echo " --gcc=VERSION version of gcc to use: 4.6.2 only available"
- - echo " [Default: 4.6.2]"
- + echo " --gcc=VERSION version of gcc to use: 8.3.0 only available"
- + echo " [Default: 8.3.0]"
- echo " --gccgraph=PATH install patched gcc to this path"
- echo " [Default: $HOME/gccgraph]"
- echo " --perllib=PATH Where to install the perl libraries"
- @@ -89,6 +89,8 @@ fi
- checkprog dot graphviz
- checkprog make make
- checkprog gcc gcc
- +checkprog patch patch
- +checkprog wget wget
- # Check that dot can generate graphs
- TEMP=`mktemp 2> /dev/null`
- diff -uprN codeviz-1.0.12/lib/CodeViz/CollectCXref.pm codeviz-1.0.12_/lib/CodeViz/CollectCXref.pm
- --- codeviz-1.0.12/lib/CodeViz/CollectCXref.pm 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/lib/CodeViz/CollectCXref.pm 2019-03-31 20:38:28.765333000 +0900
- @@ -205,7 +205,7 @@ sub readcdepn {
- while (!eof(CDEPFILE)) {
- $line = <CDEPFILE>;
- # Read a function declaration line
- - if ($line =~ /^F {(.*)} {(.+):(.+)}/) {
- + if ($line =~ /^F \{(.*)\} \{(.+):(.+)\}/) {
- my $fdecl = $1;
- $file = $f;
- $file =~ s/\.cdepn//;
- @@ -220,7 +220,7 @@ sub readcdepn {
- }
- # Read a function call line
- - if ($line =~ /^C {(.*)} {(.+):(.+)}\s+(.+)/) {
- + if ($line =~ /^C \{(.*)\} \{(.+):(.+)\}\s+(.+)/) {
- $caller = parseDeclaration($1);
- $callee = parseDeclaration($4);
- $line = $3;
- diff -uprN codeviz-1.0.12/lib/CodeViz/CollectCppDepn.pm codeviz-1.0.12_/lib/CodeViz/CollectCppDepn.pm
- --- codeviz-1.0.12/lib/CodeViz/CollectCppDepn.pm 2013-04-27 20:09:56.000000000 +0900
- +++ codeviz-1.0.12_/lib/CodeViz/CollectCppDepn.pm 2019-03-31 20:40:29.824715000 +0900
- @@ -136,14 +136,14 @@ sub analyse_cdepn {
- # has been included from an external file and
- # should be ignored, otherwise record it as a function
- # declaration
- - if (/^F {(.*)} {(.+):(.+)}/) {
- + if (/^F \{(.*)\} \{(.+):(.+)\}/) {
- my $loc="$2:$3";
- $f1 = parseDeclaration($1);
- #if ($cpp) { $f1 =~ s/<.*>//g; }
- $F{$f1} = "$2:$3";
- $M{$f1}=3;
- - } elsif (/^C {(.*)} {(.+):(.+)}\s+(.+)/) {
- + } elsif (/^C \{(.*)\} \{(.+):(.+)\}\s+(.+)/) {
- my $loc = "$2:$3";
- # Lines beginning with C are calling a function
- # The key is hashed as "caller:callee" and the
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement