Commit Graph

2001 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo f95f783849 btfdiff: Use --sort for pretty printing from both BTF and DWARF
$ btfdiff vmlinux
  $

As expected, no change, both sort to the same output, now lets add
--jobs to the DWARF case.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 3e1c7a2077 pahole: Introduce --sort
To ask for sorting output, initially by name.

This is needed in 'btfdiff' to diff the output of 'pahole -F dwarf
--jobs N', where N threads will go on consuming DWARF compile units and
and pretty printing them, producing a non deterministic output.

So we need to sort the output for both BTF and DWARF, and then diff
them.

This is still not enough for some cases where different types have the
same name, things like "usb_priv" that exists in multiple DWARF compile
units, the first processed is "winning", i.e. being the only one
considered.

I have to look how BTF handles this to adopt a similar algorithm and
keep btfdiff usable as a regression test for the BTF and DWARF loader
and the BTF encoder.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 967290bc71 pahole: Store the class id in 'struct structure' as well
Needed to defer calling printing classes to after we have all sorted out
by name with the upcoming 'pahole --sort' option, needed to make it
possible to compare 'pahole -F btf' with 'pahole -F dwarf -j', as the
multithreaded DWARF loader will not have all classes in a deterministic
order. This is needed for 'btfdiff'.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 2b45e1b6d0 dwarf_loader: Defer freeing libdw Dwfl handler
So that 'pahole --sort -F dwarf' can defer printing all classes to when
it has all of them processed and sorted.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 35845e7e41 core: Provide a way to store per loader info in cus and an exit function
So that loaders such as the DWARF one can store there the DWARF handler
(Dwfl) that needs to stay live while tools use the core tags (struct
class, struct union, struct tag, etc) because they point to strings that
are managed by Dwfl, so we have to defer dwfl_end() to after tools are
done processing the core tags.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 5365c45177 pahole: Keep class + cu in tree of structures
We'll use it for ordering by name.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo fb99cad539 dwarf_loader: Parallel DWARF loading
Tested so far with a typical Linux kernel vmlinux file.

Testing it:

  ⬢[acme@toolbox pahole]$ perf stat -r5 pahole -F dwarf vmlinux > /dev/null

   Performance counter stats for 'pahole -F dwarf vmlinux' (5 runs):

            5,675.97 msec task-clock:u              #    1.000 CPUs utilized            ( +-  0.36% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             736,865      page-faults:u             #  129.898 K/sec                    ( +-  0.00% )
      21,921,617,854      cycles:u                  #    3.864 GHz                      ( +-  0.23% )  (83.34%)
         206,308,275      stalled-cycles-frontend:u #    0.95% frontend cycles idle     ( +-  4.59% )  (83.33%)
       2,186,772,169      stalled-cycles-backend:u  #   10.02% backend cycles idle      ( +-  0.46% )  (83.33%)
      62,272,507,248      instructions:u            #    2.85  insn per cycle
                                                    #    0.03  stalled cycles per insn  ( +-  0.03% )  (83.34%)
      14,967,758,961      branches:u                #    2.639 G/sec                    ( +-  0.03% )  (83.33%)
          65,688,710      branch-misses:u           #    0.44% of all branches          ( +-  0.29% )  (83.33%)

              5.6750 +- 0.0203 seconds time elapsed  ( +-  0.36% )

  ⬢[acme@toolbox pahole]$ perf stat -r5 pahole -F dwarf -j12 vmlinux > /dev/null

   Performance counter stats for 'pahole -F dwarf -j12 vmlinux' (5 runs):

           18,015.77 msec task-clock:u              #    7.669 CPUs utilized            ( +-  2.49% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             739,157      page-faults:u             #   40.726 K/sec                    ( +-  0.01% )
      26,673,502,570      cycles:u                  #    1.470 GHz                      ( +-  0.44% )  (83.12%)
         734,106,744      stalled-cycles-frontend:u #    2.80% frontend cycles idle     ( +-  2.30% )  (83.65%)
       2,258,159,917      stalled-cycles-backend:u  #    8.60% backend cycles idle      ( +-  1.51% )  (83.62%)
      63,347,827,742      instructions:u            #    2.41  insn per cycle
                                                    #    0.04  stalled cycles per insn  ( +-  0.03% )  (83.32%)
      15,242,840,672      branches:u                #  839.841 M/sec                    ( +-  0.03% )  (83.22%)
          73,860,851      branch-misses:u           #    0.48% of all branches          ( +-  0.51% )  (83.09%)

               2.349 +- 0.116 seconds time elapsed  ( +-  4.93% )

  ⬢[acme@toolbox pahole]$

Since this is done in 12 threads and pahole prints as it finishes
processing each CU, the output is not anymore deterministically the same
for all runs.

I'll add a mode where one can ask for the structures to be kept into a
data structure to sort before printing, so that btfdiff can use it with
-j and continue working.

Also since it prints the first struct with a given name, and there are
multiple structures with a given name in the kernel, we get differences
even when we ask just for the sizes (so that we get just one line per
struct):

  ⬢[acme@toolbox pahole]$ pahole -F dwarf --sizes vmlinux > /tmp/pahole--sizes.txt
  ⬢[acme@toolbox pahole]$ pahole -F dwarf -j12 --sizes vmlinux > /tmp/pahole--sizes-j12.txt
  ⬢[acme@toolbox pahole]$ diff -u /tmp/pahole--sizes.txt /tmp/pahole--sizes-j12.txt | head
  --- /tmp/pahole--sizes.txt	2021-07-01 21:56:49.260958678 -0300
  +++ /tmp/pahole--sizes-j12.txt	2021-07-01 21:57:00.322209241 -0300
  @@ -1,20 +1,9 @@
  -list_head	16	0
  -hlist_head	8	0
  -hlist_node	16	0
  -callback_head	16	0
  -file_system_type	72	1
  -qspinlock	4	0
  -qrwlock	8	0
  ⬢[acme@toolbox pahole]$

We can't compare it that way, lets sort both and then try again:

  ⬢[acme@toolbox pahole]$ sort /tmp/pahole--sizes.txt > /tmp/pahole--sizes.txt.sorted
  ⬢[acme@toolbox pahole]$ sort /tmp/pahole--sizes-j12.txt > /tmp/pahole--sizes-j12.txt.sorted
  ⬢[acme@toolbox pahole]$ diff -u /tmp/pahole--sizes.txt.sorted /tmp/pahole--sizes-j12.txt.sorted
  --- /tmp/pahole--sizes.txt.sorted	2021-07-01 21:57:13.841515467 -0300
  +++ /tmp/pahole--sizes-j12.txt.sorted	2021-07-01 21:57:16.771581840 -0300
  @@ -1116,7 +1116,7 @@
   child_latency_info	48	1
   chipset	32	1
   chksum_ctx	4	0
  -chksum_desc_ctx	4	0
  +chksum_desc_ctx	2	0
   cipher_alg	32	0
   cipher_context	16	0
   cipher_test_sglists	1184	0
  @@ -1589,7 +1589,7 @@
   ddebug_query	40	0
   ddebug_table	40	1
   deadline_data	120	1
  -debug_buffer	72	0
  +debug_buffer	64	0
   debugfs_blob_wrapper	16	0
   debugfs_devm_entry	16	0
   debugfs_fsdata	48	1
  @@ -3291,7 +3291,7 @@
   integrity_sysfs_entry	32	0
   intel_agp_driver_description	24	1
   intel_community	96	1
  -intel_community_context	68	0
  +intel_community_context	16	0
   intel_early_ops	16	0
   intel_excl_cntrs	536	0
   intel_excl_states	260	0
  @@ -3619,7 +3619,7 @@
   irqtime	24	0
   irq_work	24	0
   ir_table	16	0
  -irte	4	0
  +irte	16	0
   irte_ga	16	0
   irte_ga_hi	8	0
   irte_ga_lo	8	0
  @@ -4909,7 +4909,7 @@
   pci_platform_pm_ops	64	0
   pci_pme_device	24	0
   pci_raw_ops	16	0
  -pci_root_info	104	0
  +pci_root_info	120	1
   pci_root_res	80	0
   pci_saved_state	64	0
   pciserial_board	24	0
  @@ -5132,10 +5132,10 @@
   pmc_clk	24	0
   pmc_clk_data	24	0
   pmc_data	16	0
  -pmc_dev	144	4
  +pmc_dev	40	1
   pm_clk_notifier_block	32	0
   pm_clock_entry	40	0
  -pmc_reg_map	136	0
  +pmc_reg_map	40	0
   pmic_table	12	0
   pm_message	4	0
   pm_nl_pernet	80	1
  @@ -6388,7 +6388,7 @@
   sw842_hlist_node2	24	0
   sw842_hlist_node4	24	0
   sw842_hlist_node8	32	0
  -sw842_param	59496	2
  +sw842_param	48	1
   swait_queue	24	0
   swait_queue_head	24	1
   swap_cgroup	2	0
  @@ -7942,7 +7942,7 @@
   uprobe_trace_entry_head	8	0
   uprobe_xol_ops	32	0
   urb	184	0
  -urb_priv	32	1
  +urb_priv	8	0
   usb2_lpm_parameters	8	0
   usb3_lpm_parameters	16	0
   usb_anchor	56	0
  ⬢[acme@toolbox pahole]$

I'll check one by one, but looks kinda legit.

Now to fiddle with thread affinities. And then move to threaded BTF
encoding, that at a first test with a single btf_lock in the pahole
stealer ended up producing corrupt BTF, valid just up to a point.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 75d4748861 pahole: Disable parallell BTF encoding for now
Introduce first parallell DWARF loading, test it, then move on to use it
together with BTF encoding.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 1c60f71daa pahole: Add locking for the structures list and rbtree
Prep work for multithreaded DWARF loading, when there will be concurrent
access to this data structure.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 46ad8c0158 dwarf_loader: Introduce 'dwarf_cus' to group all the DWARF specific per-cus state
Will help reusing in the upcoming multithreading mode.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo d963af9fd8 dwarf_loader: Factor common bits for creating and processing CU
Will be used for the multithreaded loading

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 0c5bf70cc1 fprintf: class__vtable_fprintf() 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 38ff86b149 fprintf: string_type__fprintf() 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 a75c342ac2 core: Ditch tag__free_orig_info(), unused
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 80fe32fd29 core: variable__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 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 7569e46d35 core: namespace__delete() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo de4e8b7f17 core: {tag,function,lexblock}__delete() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

They call each other, so do the three at once.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 789ed4e3a2 core: ftype__delete() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 6340cb4627 core: enumeration__delete() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 33e44f5295 core: type__delete() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 0f54ca9c82 core: class__clone() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 2b2014187b core: class__delete() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo f40900eba6 core: type__delete_class_members() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 50916756d5 core: class_member__delete() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 2e50463c3a core: type__clone_members() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo a66208355e core: class_member__clone() doesn't need a 'cu' arg
Since we stopped using per-cu obstacks we don't need it. If we ever
want to use it we can do per thread obstacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 33e0d5f874 pahole: Introduce --prettify option
The use of isatty(0) to switch into pretty printing is problematic as
reported by Bernd Buschinski, that ran into problems with his scripts:

========================================================================
  I am using pahole 1.21 and I recently noticed that I no longer have
  any pahole output in several scripts.

  Using (on the command line):

    $ pahole -V -E -C my_struct /path/to/my/debug.o

  works fine and gives the expected output.

  But:

    $ parallel -j 1 pahole -V -E -C my_struct ::: /path/to/my/debug.o

  gives nothing, no stderr, no stdout and ret code 0.

  After testing some versions, it works fine in 1.17 and no longer works in 1.18.
========================================================================

Since the pretty printer broke existing scripts, and its a relatively
new feature, lets switch to using a explicit command line option to
activate the pretty printer, i.e. where we used:

  $ pahole --header elf64_hdr < /bin/bash

We now use one of:

  ⬢[acme@toolbox pahole]$ pahole --header elf64_hdr --prettify=/bin/bash
  {
  	.e_ident = { 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  	.e_type = 3,
  	.e_machine = 62,
  	.e_version = 1,
  	.e_entry = 204016,
  	.e_phoff = 64,
  	.e_shoff = 1388096,
  	.e_flags = 0,
  	.e_ehsize = 64,
  	.e_phentsize = 56,
  	.e_phnum = 13,
  	.e_shentsize = 64,
  	.e_shnum = 31,
  	.e_shstrndx = 30,
  },
  ⬢[acme@toolbox pahole]$ pahole --header elf64_hdr --prettify /bin/bash
  {
  	.e_ident = { 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  	.e_type = 3,
  	.e_machine = 62,
  	.e_version = 1,
  	.e_entry = 204016,
  	.e_phoff = 64,
  	.e_shoff = 1388096,
  	.e_flags = 0,
  	.e_ehsize = 64,
  	.e_phentsize = 56,
  	.e_phnum = 13,
  	.e_shentsize = 64,
  	.e_shnum = 31,
  	.e_shstrndx = 30,
  },
  ⬢[acme@toolbox pahole]$ pahole --header elf64_hdr --prettify - < /bin/bash
  {
  	.e_ident = { 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  	.e_type = 3,
  	.e_machine = 62,
  	.e_version = 1,
  	.e_entry = 204016,
  	.e_phoff = 64,
  	.e_shoff = 1388096,
  	.e_flags = 0,
  	.e_ehsize = 64,
  	.e_phentsize = 56,
  	.e_phnum = 13,
  	.e_shentsize = 64,
  	.e_shnum = 31,
  	.e_shstrndx = 30,
  },
  ⬢[acme@toolbox pahole]$ pahole --header elf64_hdr --prettify=- < /bin/bash
  {
  	.e_ident = { 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  	.e_type = 3,
  	.e_machine = 62,
  	.e_version = 1,
  	.e_entry = 204016,
  	.e_phoff = 64,
  	.e_shoff = 1388096,
  	.e_flags = 0,
  	.e_ehsize = 64,
  	.e_phentsize = 56,
  	.e_phnum = 13,
  	.e_shentsize = 64,
  	.e_shnum = 31,
  	.e_shstrndx = 30,
  },
  ⬢[acme@toolbox pahole]$

Reported-by: Bernd Buschinski <b.buschinski@googlemail.com>
Report-Link: https://lore.kernel.org/dwarves/CACN-hLVoz2tWrtgDLabOv6S1-H_8RD2fh8SV6EnADF1ikMxrmw@mail.gmail.com/
Tested-by-by: Bernd Buschinski <b.buschinski@googlemail.com>
Test-Link: https://lore.kernel.org/dwarves/CACN-hLXgHWdBkyMz+w58qX8DaV+WJ1mj1qheGBHbPv4fqozi5w@mail.gmail.com/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo bc36e94f32 pahole: Try harder to resolve the --header type when pretty printing
Go on processing CUs till we have everything sorted out, which includes
the --header type.

On a file with DWARF info where the header type was the last to be found
it wasn't being resolved and the tool fails to resolve header variable
references and emits this misleading error message:

  ⬢[acme@toolbox pahole]$ pahole ~/bin/perf --header=perf_file_header --seek_bytes '$header.data.offset' --size_bytes='$header.data.size' -C 'perf_event_header(sizeof,type,type_enum=perf_event_type)' < perf.data
  pahole: --seek_bytes ($header.data.offset) makes reference to --header but it wasn't specified
  ⬢[acme@toolbox pahole]$

And that 'struct perf_file_header' _is_ in one of the CUs in ~/bin/perf:

  ⬢[acme@toolbox pahole]$ pahole ~/bin/perf -C perf_file_header
  struct perf_file_header {
  	u64                        magic;                /*     0     8 */
  	u64                        size;                 /*     8     8 */
  	u64                        attr_size;            /*    16     8 */
  	struct perf_file_section   attrs;                /*    24    16 */
  	struct perf_file_section   data;                 /*    40    16 */
  	struct perf_file_section   event_types;          /*    56    16 */
  	/* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
  	long unsigned int          adds_features[4];     /*    72    32 */

  	/* size: 104, cachelines: 2, members: 7 */
  	/* last cacheline: 40 bytes */
  };
  ⬢[acme@toolbox pahole]$

With this fix all the records are printed.

This probably wasn't noticed before because most tests were made with a
~/bin/perf file with BTF information, i.e. just one "CU", so the logic
of deferring the pretty printing till everything gets resolved wasn't
being exercised properly.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo fcfa2141c3 pahole: Make prototype__stdio_fprintf_value() receive a FILE to read raw data from
So far its just from stdin, but shouldn't.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 1a65d232b0 man-page: Move the PRETTY PRINTING header earlier
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 2d35630fa5 pahole: Make pipe_seek() honour the 'fp' arg instead of hardcoding stdin
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 9aa01472d9 pahole: Rename 'fp' to 'output' in prototype__stdio_fprintf_value()
As we'll also have another FILE pointer for input.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 472b940180 pahole: Use the supplied 'fp' argument in type__instance_read_once()
It was unconditionally reading from 'stdin', when a 'fp' is supplied.

Fix this as now we'll stop unconditionally reading from stdin for the
pretty printer.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo 63992cb02a core: Use namespace->name in class__clone()
Now that we stopped using string indexes, no need for that, just set
namespace->name with the new class name.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:13 -03:00
Arnaldo Carvalho de Melo ced4c34c37 core: Remove strings.c, unused
We were using this just for the ctf_encoder, that never really got
complete, so ditch it.

For BTF the strings table is done by libbpf, so we don't need it there
either.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:11 -03:00
Arnaldo Carvalho de Melo adbb66c295 ctf_loader: Use uint32_t instead of strings_t, that is going away
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo ad707445b3 core: Remove base_type_name_to_size_table.sname, unused
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo f8d571934b pahole: Add missing bpf/btf.h include
We get it by accident, via pahole_strings.h, and that is going away, fix
it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo deb6a4a492 libctf: Comment out unused CTF encoding functions
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 82155bc92f btf_loader: Add missing bpf/btf.h include
We get it by accident, via pahole_strings.h, and that is going away, fix
it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 05f1f9dece btf_encoder: Add missing bpf/btf.h include
We get it by accident, via pahole_strings.h, and that is going away, fix
it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo f4a77d0390 pahole: Use conf_load.kabi_prefix
Should work just as before, i.e. we hook at wher we read strings from
DWARF.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 2b9bd83e63 dwarf_loader: Make attr_suffix() handle kabi_prefix
Since we're going to get rid of strings.c.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo daaafeb35f dwarf_loader: Pass conf_load to functions calling attr_string()
As we'll implement that kabi_prefix thing there and without using global
variables.

This is because we're stopping usage of strings.c, where the kabi_prefix
feature was implemented.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo def39099c1 ctf_loader: No need for the 'strings' extern, not used
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 2499920ac8 btf_loader: No need for the 'strings' extern, not used
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo a388aaf489 dwarf_loader: Remove unused strings variable and debug_fmt_ops->{init,exit}()
No need to create that object anymore.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 3d3b7b3287 core: Remove unused debug_fmt_ops->dwarf__strings_ptr()
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00
Arnaldo Carvalho de Melo 05687c547e core: Remove unused cu__string() method
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:46 -03:00