| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
The test program will launch a gtk treeview windows to
display the symbol node in the AST.
Signed-Off-By: Christopher Li <sparse@chrisli.org>
|
|
|
|
|
|
|
|
| |
`install` by default uses 755 permissions; for everything but executables we
want to use 644 permissions.
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Christopher Li <sparse@chrisli.org>
|
|
|
|
|
|
|
| |
I find a way to get rid of the macro and $$ in linking
executable program.
Signed-off-by: Christopher Li <sparse@chrisli.org>
|
|
|
|
| |
Signed-off-by: Christopher Li <sparse@chrisli.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
In particular, on systems which do not have 'pkg-config' installed,
every invocation of make issues the following message:
/bin/sh: pkg-config: command not found
Suppress the message by redirecting stderr to the bit-bucket.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Christopher Li <sparse@chrisli.org>
|
|
|
|
|
|
|
|
| |
This will allow users to override build settings without dirtying their
trees, making life with `git stash' a bit easier.
Signed-off-by: Samuel Bronson <naesten@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
|
|
|
|
| |
Signed-Off-By: Christopher Li<sparse@chrisli.org>
|
|
|
|
|
|
|
|
|
|
|
| |
It use the gcc generated dependency file to track
header file changes.
Use pattern rules to build programes.
Makefile is much shorter now. Easier to add
new objs or new programs.
Signed-Off-By: Christopher Li<sparse@chrisli.org>
|
|
|
|
|
|
|
|
|
|
|
| |
You can now tell sparse where to look for the compiler
headers with -gcc-base-dir <dir>. Otherwise sparse will
look for headers used to build it.
Also adds $GCC_BASE/include-fixed used by newer gcc
versions.
Signed-off-by: Alexey zaytsev <alexey.zaytsev@gmail.com>
|
|
|
|
|
|
|
| |
Note that we need to build sparse with -g3 -gdwarf-2 to get
the cpp macros included into the debug ingo.
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
| |
the install step for manpages currently does not use the -m option which means
perms default to 755 which makes no sense for man pages
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
| |
aliasing rules
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
| |
Hello,
I needed to re-arrange the libxml-2.0 library order to make sparse
compile on Cygwin. Patch attached.
Signed-off-by: Kovarththanan Rajaratnam <krj@rajaratnam.dk>
|
|
|
|
|
|
|
| |
Tweak the makefile so that it respects CFLAGS set in the environment and it
makes sure to link the shared libsparse with $(LDFLAGS).
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sparse doesn't have a stable shared library interface, and doesn't build
libsparse.so by default. However, it used -fpic, which incurred a noticeable
performance hit. Remove -fpic from the default CFLAGS, and add a comment near
the definition of LIBS about adding it back if building a shared library. You
probably want to build Sparse twice if you want a shared library: once without
-fpic to build the Sparse tools, and again with -fpic to build the shared
library.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
|
| |
ptrlist.o didn't depend on $(LIB_H); in particular, it didn't depend on
compat.h, which manifested in "bad allocation size" errors when changing the
chunk size in compat.h and running "make" without "make clean".
test-unssa.o also didn't depend on $(LIB_H).
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
| |
This makes debugging more difficult by default, but as usual, developers can
change CFLAGS if they want to use a debugger; the default CFLAGS should cater
to users.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
test-suite merged stdout and stderr, which relied on the ordering of data from
the two streams in the merged stream. This made test-suite frequently fail on
tests with both output and errors, when the ordering didn't happen to match
what the test assumed. Handle each of the streams separately, and update the
tests accordingly.
Also clean up the output of "test-suite format" to avoid outputting values
equal to the defaults.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
| |
Adds new c2xml program which dumps out the parse tree for a given file as
well-formed xml. A DTD for the format is included as parse.dtd.
Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
[Josh: DTD fixes]
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
| |
This patch introduces test-suite, a simple script that makes test cases
verification easier. Test cases in the validation directory are annotated
and this script parses them to check if the actual result is the one
expected by the test writer.
Signed-off-by: Damien Lespiau <damien.lespiau@gmail.com>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
| |
Beautify make's output like kbuild or git. The install
target is especially much more readable.
make V=1 (install) to get back to the old behaviour.
Signed-off-by: Damien Lespiau <damien.lespiau@gmail.com>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
| |
Thanks to Jeff Garzik for pointing this out.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Here is my attempt to write a Ctags base on sparse.
It depends on the result from actually preprocessing the C source file.
It can handle the tags from macro expansion.
It works well enough for me to locate "int32_t" and "clear_token_alloc".
This is the updated ctags that actually generates output to a tags file.
Signed-Off-By: Christopher Li <sparse@chrisli.org>
Signed-Off-By: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Makefile now generates and installs a pkg-config file, sparse.pc, to
provide information about the installed Sparse library and header files. Use
`pkg-config --cflags sparse` to get the include path, and `pkg-config --libs
sparse` to get the library path and library.
To help packagers of Sparse, also add support for the DESTDIR variable to the
Makefile. DESTDIR allows you to target a particular prefix (such as /usr),
but install to another directory (such as debian/tmp), usually for the
purposes of subsequently constructing a package from that directory.
Previously, just setting PREFIX would work for that, but with the new
pkg-config file, the Makefile needs to know the real prefix.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modify Makefile to install the static library and all of the library header
files. Add dissect.h to LIB_H. Remove redundant headers from dependency
lines. Remove rpath suggestion.
The header files get installed to a "sparse" subdirectory of the include
directory; please reference the sparse headers as sparse/${HEADER}.h. The
various sparse test programs can all now compile successfully outside the
sparse tree, given that modification to their #include lines.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
| |
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
| |
Since none of the header files get installed, making it difficult or
impossible for anything external to use libsparse.so, and libsparse.so doesn't
provide a stable API/ABI or a SONAME, and the backends all build with the
static libsparse.a, stop building and installing libsparse.so.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
| |
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
| |
No need to confuse everyone. Besides, it allows to use "make check" for
some something meaningful in the future.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
|
|
|
|
|
|
|
|
| |
Add a new backend program which parses the input files, processes them through
the linearization pass, and outputs a graphviz graph of the resulting basic
blocks. Each entrypoint gets labelled by name, but for now the basic blocks
just get labelled with the address of the basic_block structure.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
|
|
|
|
|
|
|
|
| |
The Makefile has variables for both PREFIX (default $(HOME)) and BINDIR
(default $(PREFIX)/bin); however, it then uses $(PREFIX)/bin in several other
places, making it difficult to install to an alternate BINDIR. Fix this by
using $(BINDIR) consistently throughout the Makefile.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds dissect.{h,c} files to the sparse distribution.
From dissect.h:
struct reporter
{
void (*r_symdef)(struct symbol*);
void (*r_symbol)(unsigned mode, struct position*, struct symbol*);
void (*r_member)(unsigned mode, struct position*, struct symbol*, struct symbol*);
};
extern void dissect(struct symbol_list*, struct reporter*);
dissect() walks the output of the sparse_file() and calls reporter's
callbacks.
->r_symdef() is called when the symbol (variable or function) is defined.
->r_symbol() - when the symbol is used in any way. The 'mode' parameter
denotes how this symbol was used. It is a bitmask of possible flags:
FLAG: Code example:
U_R_VAL return VAR;
U_W_VAL VAR = 0;
U_R_PTR return *VAR;
U_W_PTR *VAR = 0;
U_R_AOF const void *... = &VAR;
U_W_AOF memset(&VAR, ...);
->r_member() tracks the use of members of structures in the same way.
This patch also adds test-dissect.c, a simple and stupid example. It
prints the 'mode' parameter in a human readable format along with the
storage info, variable's name (or struct_name.member_name), and it's
type.
The 'mode' is dumped as a 3-letter string. The first letter denotes
AOF part, 2-nd - VAL, 3-rd - PTR.
0 -> '-'
U_R_xxx -> 'r'
U_W_xxx -> 'w'
U_R_xxx | U_W_xxx -> 'm'
Example:
$ cat -n T.c
1 int var;
2
3 static void func(void)
4 {
5 int *ptr;
6
7 ptr = &var;
8 *ptr = var;
9
10 var = *++ptr;
11 }
$ ./test-dissect T.c
FILE: T.c
1:5 g def var int
3:13 s def func void ( )( ... )
5:6 l def ptr int *
7:2 l -w- ptr int *
7:9 g m-- var int
8:3 l --w ptr int *
8:9 g -r- var int
10:2 g -w- var int
10:11 l -mr ptr int *
Note that '*ptr' does not add U_R_VAL flag, this is a feature, not a bug,
even if technically wrong.
dissect() does not check the code for correctness, for example:
0 = X = Y;
gives this output:
5:6 g -w- X bad type
5:10 g -r- Y bad type
Again, X has no U_R_VAL, notabug.
Members of structures usage:
task_t *tsk;
tsk->parent->real_parent->pid++;
output:
7:2 l --r tsk struct task_struct [usertype] *
7:5 g --r task_struct.parent struct task_struct *
7:13 g --m task_struct.real_parent struct task_struct *
7:26 g -m- task_struct.pid int
dissect() tries to de-anonymize unnamed structures/unions:
1 struct T {
2 struct {
3 int x, y;
4 } m;
5 } t = {
6 { undeclared }
7 };
output:
5:3 g def t struct T
5:3 g -w- t struct T
6:2 s -w- T.m struct T:m
6:4 s -w- T:m.x int
6:4 g -r- undeclared bad type
When entire struct is overwritten, ->r_member() is called with mem == NULL,
this reported as struct_name.*, example:
*new_vma = *vma;
output:
2028:5 l --w new_vma struct vm_area_struct *
2028:13 g -w- vm_area_struct.* struct vm_area_struct
2028:13 g -w- pgprot_t.* struct pgprot_t
2028:13 g -w- rb_node.* struct rb_node
2028:13 g -w- vm_area_struct:shared.* union vm_area_struct:shared
2028:13 g -w- vm_area_struct:shared:vm_set.* struct vm_area_struct:shared:vm_set
2028:13 g -w- list_head.* struct list_head
2028:13 g -w- raw_prio_tree_node.* struct raw_prio_tree_node
2028:13 g -w- list_head.* struct list_head
2028:16 l --r vma struct vm_area_struct *
Function calls use U_R_PTR bit:
5 func();
6 pf = func;
7 pf();
5:2 g --r func void ( )( ... )
6:2 l -w- pf void ( * )( ... )
6:7 g r-- func void ( )( ... )
7:2 l --r pf void ( * )( ... )
BUGS:
1. dissect() confuses array-in-container with a pointer:
3 struct T { int ary[]; } t;
4
5 t.ary[0] = 0;
output:
5:2 l -r- t /* BUG, should be -w- */ struct T
5:3 s -w- T.ary int [0]
2. It can't detect the case when the address is taken only for writing,
eg: *(&i + 1) = 0, so U_W_AOF always implies U_R_AOF.
3. It does not support "flat" initializers without braces:
3 struct O {
4 struct I {
5 int x, y;
6 } a, b;
7 };
8
9 struct O o1 = { 1, 2, 3 };
buggy output:
9:11 l -w- o1 struct O
9:18 s -w- O.a struct I
9:21 s -w- O.b struct I
9:24 s -w- O.? bad type
This is ok:
11 struct O o2 = { { 1 }, .b = { .y = 0 } };
11:11 l -w- o2 struct O
11:18 s -w- O.a struct I
11:20 s -w- I.x int
11:30 s -w- O.b struct I
11:37 s -w- I.y int
4. The implementation is far from perfect. It was really done
in "add some code + printf and see what happens" manner, without
studying the sources first. However I beleive it may be useful
for others, that is why I am posting it.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
|
|
|
|
|
|
| |
For now, it use a simple method but which introduces a lot more copies
than necessary. Can be fixed later.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@looxix.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Right now it only makes 'blob_free()' mprotect(PROT_NONE) the buffer it
free's instead of unmapping it, but that's already quite useful for
figuring out when we've freed up memory that we later end up using after
all.
In particular, the multi-file mode ends up having different lifetime
rules for the various objects, so it introduced some nasty MM bugs.
With -DDEBUG we get some nice SIGSEGV's rather than just strange memory
corruption.
|
|
|
|
|
| |
They rate their own "ptrlist" library status, since they are
definitely potentially useful outside of sparse.
|