How to print function level calling graph by using Rose Compiler - c++

Hello I just installed Rose Compiler and by following the instructions on GitHub here
I managed to install it successfully as well as execute it, now when I type rajaChecker --version it shows the version number which shows it is installed
for scanning the source code when I type command
rajaChecker test.cpp -report=report.txt
The command executes successfully and output generates which is useless for me as I want function level calling graph for the file or even project but the documentation is not clear about this, it would be the best if I can get the function level calling graph of the source code or preferably a project

Can you try
bat-cg --help
From their
github wiki page
Then you might try
bat-cg test.cpp

Related

i don't know what is wrong with vs code in running cpp

i just started to code in cpp and nothing is working idk if i didn't install the gcc properly or what but i already set the path of the bin file idk why it refuses to run
the code:
#include<iostream>
int main()
{
std::cout<<"hello";
}
and the problem is that when I try to use the "code runner extension" it is not working so I just press f5 and then when I get the error messages which says at first "could not find the task file'c/c++:g++.exe build active file' " and I get three options 1:debug anyway
2:configure task
3:cancel
when I choose debug anyway I get this error here
Since you're on windows consider installing Visual Studio or CLion. They're more beginner friendly - VSCode can get tricky to run c++ on windows. Either way, looks like you're trying to run your project without building it first. There should be a build option right next to the run option. Try building it, then running. The build is what compiles and creates the project.exe file, which is what the compiler is saying isn't there.
The referenced IDE's always auto-build on run, so there's that
If you're familiar with using the command line, these commands will do what you want, assuming the .cpp file is in your current directory.
g++ <FILENAME>
./a.out
There are wonderful flags you can add to the first command (the compiling command) like -Wall, -Wextra, -o, and many more. But, since it seems like you're just starting out, there's no need to worry about those!
If you're not familiar with the command line, I would encourage you to become familiar! It is an extremely powerful tool for a programmer. Here is a YouTube video that talks about it.

Build errors in cpprest sdk (casablanca) on Ubuntu 16.04

While searching for an HTTP client C++ based library, I have decided to use the casablanca -- so I needed to build it.
I'm running on Ubuntu 16.04.
While following the "common" build steps described here: How-to-build-for-Linux I have encountered a build error (when running the make command as the last operation of step 4).
The entire error output can be found here (now it is the last comment in the thread cpprestsdk-build-error#266).
Just to be sure my system has the needed build tools and libraries I performed the command mentioned in step 2 and this is the output:
--> Which means my system is "good to go".
So after I struggled it a little more, I have found "an alternative" way to build it:
I have downloaded the source code from here: Source Package: casablanca (2.8.0-2) [universe], and again, followed the same instructions STARTING FROM STEP 4 from the link mentioned in the question (How-to-build-for-Linux).
This time the make phase was successful !! (it is worth to mention that not all the unit tests that are recommended to be run on step 5 passed - I did not spend time trying to understand why...).
Went on and "copied-pasted" the complete sample provided at the bottom of the following link: cpprestsdk-Getting-Started-Tutorial.
Built the program with the following command (the program contained a single cpp file called main):
g++ -std=c++11 main.cpp -o myProg -lboost_system -lcrypto -lssl -lcpprest
Ran the program
./myProg
and it passed (there was output in the console saying:"Received response status code:200").
Would be glad to hear if you have encountered the same issue, or perhaps I did something wrong in my first attempt (or in any other step along the way).

Tensorflow C++ API guide examples on Windows

I built tensorflow with VS2015 and I was able to run some examples,
as tf_tutorials_example_trainer and label_image.
Then I tried to run the samples here. I was able to compile and start the example.cc but when reaching the line
Scope root = Scope::NewRootScope();
I get this error:
Op type not registered 'NoOp' in binary running on DESKTOP-S5QHRCE.
Make sure the Op and Kernel are registered in the binary running in this process
What am I missing?
I found this.Thanks to Joe, who explains how to use the /WHOLEARCHIVE option to fix the issue.To avoid out of memory error during linking if using Optimize for debugging (/DEBUG) option, do msbuild /p:Configuration=Release youproject.vcxproj in a command prompt.

Problems with using gperftools on Mac OS X

I have found several conflicting answers over this topic. This blog post requires libuwind, but that doesn't work on Mac OS X. I included #include <google/profiler.h> in my code, however my compiler (g++) could not find the library. I installed gperftools via homebrew. In addition, I found this stackoverflow question showing this:
Then I ran pprof to generate the output:
[hidden ~]$ pprof --text ./a.out cpu.profile
Using local file ./a.out.
Using local file cpu.profile.
Removing __sigtramp from all stack traces.
Total: 282 samples
107 37.9% 37.9% 107 37.9% 0x000000010d72229e
16 5.7% 43.6% 16 5.7% 0x000000010d721a5f
12 4.3% 47.9% 12 4.3% 0x000000010d721de8
...
Running that command (without any of the prior steps) gets me this:
[hidden]$ pprof --text ./a.out cpu.profile
Using remote profile at ./a.out.
Failed to get the number of symbols from http://cpu.profile/pprof/symbol
Why does it try to access an internet site on my machine and a local file on his/hers?
Attempting to link lib profiler as a dry run with g++ gets me:
[hidden]$ g++ -l libprofiler
ld: library not found for -llibprofiler
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have looked at the man pages, the help option text, the official online guide, blog posts, and many other sources.
I am so confused right now. Can someone help me use gperftools?
The result of my conversation with #osgx was this script. I tried to clean it up a bit. It likely contains quite a few unnecessary options too.
The blog post https://dudefrommangalore.wordpress.com/2012/02/09/profiling-c-code-using-google-performance-tools/ "Profiling C++ code using Google Performance Tools" 2012 by dudefrommangalore missed the essential step.
You should link your program (which you want to be profiled) with cpu profiler library of gperftools library.
Check official manual: http://goog-perftools.sourceforge.net/doc/cpu_profiler.html, part "Linking in the Library"
add -lprofiler to the link-time step for your executable. (It's also probably possible to add in the profiler at run-time using LD_PRELOAD, but this isn't necessarily recommended.)
Second step is to collect the profile, run the code with profiling enabled. In linux world it was done by setting controlling environment variable CPUPROFILE before running:
CPUPROFILE=name_of_profile ./program_to_be_profiled
Third step is to use pprof (google-pprof in ubuntu world). Check that there is not-empty name_of_profile profile file generated; it there is no such file, pprof will try to do remote profile fetch (you see output of such try).
pprof ./program_to_be_profiled name_of_profile
First you need to run your program with profiling enabled.
This is usually first linking your program with libprofiler and then running it with CPUPROFILE=cpu.profile.
I.e.
$ CPUPROFILE=cpu.profile my_program
I think that later step is what you have been missing.
The program will create this cpu.profile file when it exits. And then you can use pprof (preferably from github.com/google/pprof) on it to visualize/analyze.

llc -view-*-dags foo.ll not working in ubuntu

I have installed LLVM3.6 on my Ubuntu 14.04 machine. I have also set the path for
LLVM_PATH_DOT=/usr/bin/dot and later on LLVM_PATH_DOT=/usr/bin/dotty.
I also tried to check LLVM_ENABLE_DOXYGEN during CMake configuration, and gave the path for DOTTY. It also doesn't work.
Lastly, I created a new entry in CMAKE, called LLVM_PATH_DOTTY, and supplied in the path. It also doesn't work.
When I try to create the DAG output for a .ll file, llc neither gives any error message nor prints a graph.
I pass in the following command:
llc -view-dag-combine-lt-dags foo.ll
How can I solve this problem? Thank you
If you're using LLVM 3.6.x or earlier, you have to also specify the -filter-view-dags=<bb-name> option to specify the name of the basic block which you wish to view.
This was unintended behaviour (omitting the flag is meant to mean "view all basic blocks", not "view none of the basic blocks"). The bug was fixed in LLVM 3.7. If you want to manually apply the patch which fixes this, see this mailing list post for details: http://lists.llvm.org/pipermail/llvm-dev/2015-July/088631.html