Is there any symbolic execution tools in llvm? - pointers

I want to do points-to anlysis in llvm IR. I want it to be path sensitive, which means that when I print out the result, I need append the condition for the "May" Points-to.
I plan to using symbolic execution to achieve this goal.
Are there any tools in llvm, or stand-alone tools to solve the symbolic equation.
Thank you!

Some pointers to get you started:
The Scalar Evolution LLVM module is basically symbolic execution of arithmetic expressions (and taking loops into consideration).
Klee is a full symbolic execution VM for LLVM IR.

Related

Julia AMDGPU.jl launch configuration

I wonder if there is an equivalent (or something similar) of the launch_configuration
function in CUDA.jl that can be used in the AMDGPU.jl package? Otherwise, do you have any comments on how to know the configuration of the AMD GPU? Thanks.

Is it able to compile Julia script using PyCall.pyimport?

I have to compile a Julia script and use opencv-python in it.
If it is feasible, how to compile?
What should I use? >PackageCompiler?
This may be possible with PackageCompiler.jl. You will likely need to set up some artifacts as detailed here: https://julialang.github.io/PackageCompiler.jl/dev/apps/#Artifacts-1
You can find out more about the Julia Artifacts system here: https://julialang.github.io/Pkg.jl/v1/artifacts/
It may also be worth opening an issue and asking on the PackageCompiler.jl repo if there has been any work or tests with combining Julia and Python via PackageCompiler so as to avoid going down a dead end.

Decompile a RISC system/6000 executable file

we have a old AIX server and it has an executable file and we want to rewrite the same logic of the executable file on linux server, so we are trying to read it but could not find a way to do that.could you please let us know if there is a way to decipher this file
$ file execfile
execfile: executable (RISC System/6000) or object module
The IBM RS/6000 has a POWER architecture CPU, possibly a PowerPC 603 or PowerPC 604, or possibly one of the newer models like POWER1, POWER2, POWER3, etc. The most recent (current) systems use POWER7 or POWER8.
Anyway, if the system has the compiler and toolchain installed on it then there should be a decent symbolic debugger included, and you should be able to use that to disassemble any executable. Depending on exactly which version of the OS it was compiled on, and which compiler was used, you might even be able to use PowerPC tools on some other OS, such as MacOS, or even potentially a cross-compiler toolchain on any type of system, to disassemble the program. For example GDB built for PowerPC may be able to disassemble the program.
However if the executable has been stripped of symbols (as was typically the case on AIX systems, IIRC), and especially if it had been run through the most powerful optimizing stage of the compiler, then you'll be pretty much lost and what you are trying to do will be impractical and require many man hours to decipher -- indeed many thousands of man hours for any significantly sized program, even if you're able to hire someone to help who is familiar with the code generation patterns of the particular compiler which was used.
You might be better off trying to hire an archeologist to help you dig through the specific landfill where you might hope to find listings or backup tapes or CDs or disks containing the original source code, or specification documents, etc., for this program. Seriously.
Or try to find and (re-)hire the original author(s).

What is the best lisp/scheme for unix scripting?

The title pretty much says it all. I use clojure for my major projects but it's not a good scripting language because the jvm has a slow startup and doesn't interface well with some unixy things. So I'm looking for a lisp which will work well as a scripting language, for example having a good interface for managing unix processes, easily use things like async io, etc.
Scsh (it stands for "Scheme shell") can be gotten at http://www.scsh.net. It's "a variant of Scheme 48 (an R5RS compliant new-tech Scheme system) ... designed for writing real-life standalone Unix programs and shell scripts."
A nice introduction to system administration in it can be found at http://www.theillien.com/Sys_Admin_v12/html/v11/i01/a2.htm.
A wide range of common unix tools have bindings for Guile. If its your objective to automate any of these tools, this might be a nice place to look.
Racket is a really nice Scheme implementation. Its pretty powerful. One of its introductions is developing a web server from scratch.
Scsh
newLisp
PicoLisp (also see this)
CLISP, an implementation of Common Lisp, is useful for Unix scripting.
CLISP has many extensions that make it useful for scripting: Unicode support, regular expressions, various command line options, socket streams, piping, ...
Additionally CLISP has a relatively small footprint, is written in C for portability and starts fast - for a Common Lisp.
Eshell with Elisp for interactive use:
"Eshell is capable of invoking almost any elisp function loaded in Emacs. That sort of flexibility is unmatched; there are no shells out there capable of approximating what Eshell can do. In fact, this functionality is heavily used (and encouraged!) by Eshell. If you want to open the file foobar.txt in Emacs you simply invoke find-file foobar.txt and Eshell will map that to the elisp call (find-file "foobar.txt") and open the file for you."
from http://www.masteringemacs.org/articles/2010/12/13/complete-guide-mastering-eshell/
I ran into this page a few times while looking for a nice way to port some increasingly-unweildy bash scripts into a saner language. Since these scripts were already invoking a few Racket scripts, it made sense to remove a layer of indirection and use Racket for everything.
After some searching, I came across the shell-pipeline package for Racket. From the documentation:
This library makes unix-style pipelines of external programs and racket functions easy. You can write things as simply as (run-pipeline '(cat /etc/passwd) '(grep root) '(cut -d : -f 1)), which will print "root\n" to stdout (on unix systems) and will return 0. To get the output as a string, use run-pipeline/out the same way. You can also put racket functions in the pipeline. If you have a racket implementation of grep called my-grep, you can do (run-pipeline '(cat /etc/passwd) `(,my-grep root) '(cut -d : -f 1)) to get the same results. So you can write all sorts of filter functions in Racket rather than using shell commands.

Unix shell code that is portable enough to run on all shells

Can anyone please let me know the coding guidelines along with code samples of Unix shell scripting by using which the code can run on most of the current shells like ksh, bash, csh etc. Most of the times some of my code written for ksh would not work on normal sh. I want to make my code maximum portable. Most of my code will be around [ifs, elifs] and [whiles, fors] and return code capturing of child shell (which will mostly be running SQL scripts for which I want to get some of the return codes like number of rows processed, return codes, error codes of the SQL script).
Also can anyone let me know which shell specific code can be easily ported to other shells? Can anyone point me to right tutorials and/or sample codes?
Get yourself a 7th Edition Unix Programmer's Manual (Vol 1) and program to the (Bourne) shell notation described there. You can actually upgrade to a System V (Bourne) shell if you can find an appropriate manual; it has a few extra features, like functions, that the 7th Edition shell did not have, and they are essentially available everywhere. (This is a very conservative stance - but it will give you maximal portability.)
The other issue is choosing which commands you use, and which options you use to those commands. For example, GNU grep has numerous useful options that are not available elsewhere. GNU sed similarly has extensions that are not available elsewhere. If you write your shell script to use those extensions, your code will be unportable, even if the shells all understand the syntax correctly.
I recommend being aware of what the POSIX standard says is portable. Most of the POSIX features are usually supported by most systems, but each system usually adds some extra options and features that are not always widely available. Note that the POSIX shell does have some features, notably $(...) command substitution in place of back-ticks that you were not in original Bourne shells. You'll have to decide whether the clarity that the more modern notation brings is worth the (nominal) loss of portability.
Also, the Autoconf shell guidelines concentrate on maximal portability. However, the result is a rather stilted version of shell scripting, not least because it has to interwork with the m4 macro processor, which leads to some additional constraints.
Note that it is essentially impossible to write portable shell scripts that will work with the Bourne/Korn/POSIX shell family and the C Shell family. There are strong arguments for concluding "you should not write scripts in C shell".
The short answer for portability is to write scripts for the lowest common denominator which is the Bourne shell (sh) and to avoid C shell which has an incompatible syntax and serious limitations. The Bourne shell should be universally available and most system startup and administration scripts are written for it.
All of the capabilities you mentioned as requirements are available in sh. One of the main things that is missing is support for arrays, but that can be worked around.
One thing to keep in mind is that much of the functionality of a shell script is provided by external utilities which are accessible from any shell.
why not write your scripts in perl or python?
Get yourself Beginning Portable Shell scripting and see what the author have to say.
There's some portability talk between shells in Bash Hackers Wiki. See, if that helps.
There's also Steve Parker's Bourne / Bash online shell scripting tutorial or books such as "Shell Scripting Recipes: A Problem-Solution Approach" by Chris F.A. Johnson.
To test for maximum portability you may use bournesh.
http://freshmeat.net/projects/bournesh/
I've a few links from here:
http://www.pixelbeat.org/programming/shell_script_mistakes.html#portability
You can use Loker for checking for syntactic conformance to the POSIX standard.

Resources