Commit Graph

36 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 3925a5bd53 syscse: zero_extend() doesn't need a 'cu' arg
Since we don't need the cu to get the strings table, all tags have a
char pointer for strings.

Found while building with clang to prep 1.22.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-20 16:40:27 -03:00
Arnaldo Carvalho de Melo caa219dffc core: base_type__name() doesn't need a 'cu' arg
Another simplification made possible by using a plain char string
instead of string_t, that was only needed in the core as prep work
for CTF encoding.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 9d0e3ab9a2 pahole: function__name() doesn't need a 'struct cu *' argument
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 3280cb4176 core: Make parameter->name a real string
For the threaded code we want to access strings in tags at the same time
that the string table may grow in another thread making the previous
pointer invalid, so, to avoid excessive locking, use plain strings.

The way the tools work will either consume the just produced CU straight
away or keep just one copy of each data structure when we keep all CUs
in memory, so lets try stopping using strings_t for strings.

For the parameter->name case we get the bonus of removing a user of
dwarves__active_loader.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 790dfbda79 headers: Rebame __unused to __maybe_unused to avoid clashes with system headers
Andrii reported that __unused is a field in /usr/include/bits/stat.h and
vmlinux.h (generated by bpftool), so use the Linux kernel jargon for
this and rename it to '__maybe_unused'.

Reported-by: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-06-13 10:25:35 -03:00
Arnaldo Carvalho de Melo 66e640508e dwarves: Make function__for_each_parameter receive 'cu' arg
Needed to find the right 'struct ftype' to iterate function arguments
on. This is due to how BTF works with this and how we implemented it, at
some point this can get improved to avoid the need for checking if it is
BTF, doing it in a more format abstracted way, but for now, abstract
this away in the for_each_parameter helpers.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-01-09 14:16:52 -03:00
Arnaldo Carvalho de Melo 5375d06faf dwarves: Introduce type_id_t for use with the type IDs
This is just a prep patch, marking uint16_t IDs as type_id_t, that
points to uint16_t, so no change in the resulting code.

Cc: Andrii Nakryiko <andriin@fb.com>
Tested-by:Andrii Nakryiko <andrii.nakryiko@gmail.com>
Link: https://lore.kernel.org/bpf/CAEf4Bzb0SpvXdDKMMnUof==kp4Y0AP54bKFjeCzX_AsmDm7k7g@mail.gmail.com/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-03-11 11:44:53 -03:00
Domenico Andreoli e714d2eaa1 Adopt SPDX-License-Identifier
Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-01-18 15:41:48 -03:00
Arnaldo Carvalho de Melo 44130bf70e dwarves: Update e-mail address
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-06-28 14:24:41 -03:00
Arnaldo Carvalho de Melo 8af5ccd86d dwarves: Use cus__fprintf_load_files_err() in the remaining tools
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-03-15 14:29:57 -03:00
Arnaldo Carvalho de Melo a54515fa6e dwarves: Stop using 'self'
As Thomas Gleixner wisely pointed out, using 'self' is stupid, it
doesn't convey useful information, so use sensible names.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-08-17 18:47:15 -03:00
Arnaldo Carvalho de Melo 870afee9ce core: Stop using strings__ptr(strings, i) directly
Instead pass thru cu__strings(cu, i) so that we can figure out if the
underlying debugging format handler can do that more efficiently, such as by
looking up directly the ELF section ".strtab".

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 17:54:43 -03:00
Arnaldo Carvalho de Melo 9bb29daac4 base_type: Don't combine names with attributes
Such as signed, etc. This is in preparation for using directly ctf_strings.
Instead of duplicating it in the global strings table.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 16:12:36 -03:00
Arnaldo Carvalho de Melo c73972591b syscse: Stop using cu__for_each_tag
What it really needs is cu__for_each_function.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:11:20 -03:00
Arnaldo Carvalho de Melo 140712f06a cu: Rename cu__find_{type,tag}_by_id to cu__{type,tag}
To shorten the name and to reflect the fact that we're no longer
"finding" a type, but merely accessing an array with a bounds check in
this function.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-18 12:17:07 -03:00
Arnaldo Carvalho de Melo 4d44276d85 coding style: remove trailing whitespaces, etc
Amazing how many crept up over time, should have set the
execute bit of .git/hooks/pre-commit already, duh.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-14 13:50:36 -03:00
Arnaldo Carvalho de Melo 991c6a3ebb dwarves: Rename cus__loadfl with cus__load_files
Also introducing cus__load, that load just one file.

The new cus__load_files routine now iterates thru the provided array
calling cus__load for each, and that in turn will try first dwarf__load,
and if that fail, i.e. if no DWARF info is found, call ctf__load.

This now allows loading DWARF _and_ CTF files at the same time. This
will be useful in the future when we, from DWARF generate CTF and at the
same time do a codiff, comparing the freshly generated CTF file with the
DWARF it came from.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-13 10:49:01 -03:00
Arnaldo Carvalho de Melo 250dded466 dwarf: separate dwarf_tag from tag
So that, when not needing the DWARF info, the apps can tell that at load
time, and then the dwarf loader can just free all the dwarf_tags
allocated, reducing memory usage.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-09 14:43:47 -03:00
Arnaldo Carvalho de Melo 20464ba7f0 dwarves: Reduce the size of some data structures
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-07 16:45:09 -03:00
Arnaldo Carvalho de Melo 9fadbfffba dwarves: use tag__is_function in the tools
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-06 11:14:26 -03:00
Arnaldo Carvalho de Melo a2289d0606 dwarves: Ditch parameter__type and simplify parameter__name
parameter__type was needed because the abstract_origin resolution was
done later, now it is at dwarf recode time, and for debugging formats
that don't have this crap, never. So it now can use the same idiom as
other tags: foo->tag.type.

parameter__name still exists because the tools still want a string
returned, but for some what they want is indeed the string_t, so that
when looking for a particular string it can be done as an string__find
for the key + integer comparision instead of doing a costlier strcmp.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-06 09:27:40 -03:00
Arnaldo Carvalho de Melo 3f4e4457e2 dwarves: Add DW_TAG_ptr_to_member_type to tag__is_tag_type
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-03 15:12:29 -03:00
Arnaldo Carvalho de Melo 56be29c649 all: Add the --version
Using the argp tricks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-02-13 10:57:23 -02:00
Arnaldo Carvalho de Melo 138cc4739c dwarves: Don't pass argp to dwarf_loadfl
Now we just pass a NULL terminated array of filenames, since we got rid
of that ugly -e insertion hack.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-02-09 21:43:56 -02:00
Arnaldo Carvalho de Melo ce2219915d argp: check if child_inputs is NULL
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-11-18 14:09:13 -02:00
Arnaldo Carvalho de Melo 212b994ab5 strings: Introduce the strings class
And make the dwarves use it, so that we can remove duplicate strings in
a multi-CU file (vmlinux anyone?) and have it ready for insertion in a
compressed DWARF format with just the types, or better, CTF or some new
compressed debugging info format.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-02 14:34:42 -03:00
Arnaldo Carvalho de Melo efa997ed40 dwarves: Remove type_emissions fields from cus
Now only when one wants to emit this struct is needed.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-01 12:47:42 -03:00
Arnaldo Carvalho de Melo c3f6f8b79f dwarves_emit: Introduce type_emissions
We may want to work on just one object file, not on a multi cu.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-01 11:26:51 -03:00
Arnaldo Carvalho de Melo fb809733cc [DWARVES]: Introduce tag__assert_search_result
For correctly created and completely parsed debugging information the type will
always be found, but as we still need to parse more tags and expecting
debugging information to be always correctly built is not sane... sprinkle some
asserts.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-20 18:56:36 -03:00
Arnaldo Carvalho de Melo f8c943bfe5 [DWARVES] base_type: store the size in bits
This is trying to get CTF friendly, where bitfields are not stored in the
equivalent to the DW_TAG_member dwarf TAG, but on "base types" with bit sizes
different than the real in the DWARF sense, base types (char, long, etc).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-03-04 18:38:21 -03:00
Arnaldo Carvalho de Melo 46d63102eb [DWARVES]: Fixup usage messages
Thanks to Ilpo Järvinen for getting this to my attention.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-31 09:30:55 -02:00
Arnaldo Carvalho de Melo 5bc698ab1b [DUTIL]: Move __unused definition to dutil.h
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-16 14:47:59 -02:00
Arnaldo Carvalho de Melo b0a2942cde [SYSCSE]: Fix printf format specifier
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-24 00:20:15 -02:00
Eduardo Habkost 15c6f261b6 [CMAKE] Define _GNU_SOURCE on CMakeLists.txt
The latest elfutils-libelf headers won't compile without _LARGEFILE64_SOURCE
(that is implied by _GNU_SOURCE).

Some .c files don't have a #define _GNU_SOURCE line. Instead of adding the line
to all .c files, define it globally on CMakeLists.txt.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-10-26 13:21:31 -02:00
Arnaldo Carvalho de Melo bcc9c3b842 [SYSCSE]: Calculate prefix_len when --prefix is used
Ah, forgot to mention in the last commit that this is an exercise being done
with Ralf Baechle, that needs this to cope with some MIPSisms, but the point
here is to see if the lib is approachable enough, and the best ways is to write
more and more dwarves :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-12 16:02:04 -03:00
Arnaldo Carvalho de Melo 1382ee83da [SYSCSE]: System Call Sign Extender
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-12 15:53:46 -03:00