Commit Graph

1005 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo cd03ae0eb1 regtest: Add a 'ctf' mode
To encode CTF information from the DWARF one. Next patches will add
support for comparing the CTF and DWARF info.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-22 09:34:12 -03:00
Arnaldo Carvalho de Melo ab554628a1 regtest: Don't run the tools on symlinks
Its redundant and thus slows down the whole regression testing.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-22 09:14:28 -03:00
Arnaldo Carvalho de Melo 641daf5191 regtest: remove the .py extension
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-21 23:03:34 -03:00
Arnaldo Carvalho de Melo 65b3b7a03f regtest: remove temp diff file
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-21 23:03:03 -03:00
Arnaldo Carvalho de Melo 02a419287a dwarves_fprintf: Bump the size passed to tag__name in imported_declaration__fprintf
As it was not enough to cover some, hum, limits in the way C++ encodes piles of
abstractions:

+++ /media/tb/pahole/regtest/after/usr/bin/enfuse.pahole -A.c   2009-08-21 09:04:15.000000000 -0300
@@ -10414,7 +10414,7 @@ struct _Vector_base<enblend::enfuseMain(

        using ::_M_deallocate;

-       using ::__uninitialized_move_a<enblend::enfuseMain(std::list<vigra::ImageImportInfo*, std::allocator<vigra::ImageImportInfo*> >&, vigra::ImageExportInfo&, vigra::Rect2D&) [with ImagePixelType = vigra::RGBValue<unsigned int, 0u, 1u, 2u>]::ImagePyramidType**, enblend::enfuseMain(std::list<vigra::ImageImportInfo*, std::allocator<vigra::ImageImportInfo*> >&, vigra::ImageExportInfo&, vigra::Rect2D&) [with ImagePixelType = vigra::RGBValue<unsigned int, 0u, 1u, 2u>]::ImagePyramidType**, std::allocator<enblend::enfuseMain(ð7K^A;
+       using ::__uninitialized_move_a<enblend::enfuseMain(std::list<vigra::ImageImportInfo*, std::allocator<vigra::ImageImportInfo*> >&, vigra::ImageExportInfo&, vigra::Rect2D&) [with ImagePixelType = vigra::RGBValue<unsigned int, 0u, 1u, 2u>]::ImagePyramidType**, enblend::enfuseMain(std::list<vigra::ImageImportInfo*, std::allocator<vigra::ImageImportInfo*> >&, vigra::ImageExportInfo&, vigra::Rect2D&) [with ImagePixelType = vigra::RGBValue<unsigned int, 0u, 1u, 2u>]::ImagePyramidType**, std::allocator<enblend::enfuseMain(std::list<vigra::ImageImportInfo*, std::allocator<vigra::ImageImportInfo*> >&, vigra::ImageExportInfo&, vigra::Rect2D&) [with ImagePixelType = vigra::RGBValue<unsigned int, 0u, 1u, 2u>]::ImagePyramidType*> >;

        using ::_M_get_Tp_allocator;

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-21 09:05:15 -03:00
Arnaldo Carvalho de Melo 36151b470a dwarves: Make tag__name support variables
As DW_TAG_imported_declaration can also point to one...

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-20 22:41:48 -03:00
Arnaldo Carvalho de Melo ca6dc1446c dwarf_loader: Follow const types too in class_member__cache_byte_size
In the same fashion as DW_TAG_volatile_type, as we need to get to the
DW_TAG_base_type at the end of the chain.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-20 19:48:14 -03:00
Arnaldo Carvalho de Melo 68bac65d2e regtest: Convert the regtests to a python script and include it in the repo
I'm using it using a directory with all debuginfo packages in fedora, so
that I can run a before and after with different tools (pahole, pfunct),
and check the differences after some change.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-20 18:47:57 -03:00
Arnaldo Carvalho de Melo bd361e461e dwarf_loader/dwarves_fprintf: Support "using" pointing to data members
If it is C++ add DW_TAG_member entries to cu->tags_table and at
imported_declaration__fprintf fallback to cu__tag() if cu__function()
fails.

The right thing tho, long term, is to have a class for
"DW_TAG_imported_declaration" to register to what kind of tag this
points, if for DW_TAG_subprogram or to DW_TAG_member, the info is in the
DWARF DW_AT_import attribute, but so far we're not decoding it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-20 18:33:52 -03:00
Arnaldo Carvalho de Melo 3de722e9ab dwarves: Delete list entries in reverse order
It doesn't matter when using a traditional malloc/free allocator, but
with obstacks we need to do it in reverse order.

For the usual case where we successfully process an object this doesn't
matter, as when we started using obstacks we don't traverse all the tags
calling their destructors anymore, we just free the whole obstack in one
go.

Noticed when processing object files built from non-supported languages
such as FORTRAN and Pascal, where there are some DWARF tags that are not
supported, which makes the object file load to be prematurely aborted
and that calls destructors for things like classes and functions that in
turn free space for their parameter/member lists, which now have to be
done in reverse order.

We could just stop calling the destructors and then destroying the whole
obstack, but I think that partially processed files are a nice feature,
so keep the interface in a way that both obstacks and traditinal malloc
alocators can be used.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-19 10:32:49 -03:00
Arnaldo Carvalho de Melo d2581fa5aa dwarves_fprintf: Revert experimentation with const rendering
Still doesn't fixes the case "const char * const foo"...

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-19 10:04:54 -03:00
Arnaldo Carvalho de Melo 19bbecf668 dwarves: Pass the cu to destructors to free memory on the obstack
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-18 18:21:20 -03:00
Arnaldo Carvalho de Melo f0435286c0 dwarves_reorganize: Fix class__demote_bitfields, we need power of two bytes
There is no such thing as a 3 bytes sized base type. Round it up to 4.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-16 12:26:33 -03:00
Arnaldo Carvalho de Melo dffd3d4ee7 dwarves: Fix cu__find_base_type_by_name when the base_type name is NULL
This shouldn't happen, but if it does, don't return it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-16 12:13:38 -03:00
Arnaldo Carvalho de Melo f7034469a6 dwarves_reorganize: Fix padding calculation
We can't always pad using the module of addr_size, we need to find the
minimum alignment requirement as a power of two < addr_size.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-13 13:28:09 -03:00
Arnaldo Carvalho de Melo de44cfece7 pahole: fix class__packable so that it catches bugs in the reorg algo
Where we end up with the same struct but class__size() returns off by
some bytes result. Investigating...

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-13 11:59:18 -03:00
Arnaldo Carvalho de Melo f7bbe7dee2 dwarves_fprintf: Support zero sized arrays in the middle of the struct
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-08-10 12:31:47 -03:00
Arnaldo Carvalho de Melo 44085cc239 reorganize: Adjust padding after moving from the tail
When we move fields from the tail to eliminate holes look if the struct
still correctly fits into a multiple of cu->addr_size.

Unless the struct is explicitely marked __attribute__((packed)) (and we
can't know that for sure) we have to add padding in that case.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-11 12:54:46 -03:00
Arnaldo Carvalho de Melo d46525e7ce dwarves: reorganize struct namespace
Oh well, we need to use these tools on these tools from time to time ;-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-08 16:53:22 -03:00
Arnaldo Carvalho de Melo 932a884ed9 dwarves: Use an obstack for all the tags
We got it down from:

15.733210256  seconds time elapsed   ( +-   0.197% )

as reported in the previous changeset to:

[acme@doppio pahole]$ perf stat -r 5 pahole object_samples/zweinberg\@mozilla.com/libgklayout.so > /dev/null

 Performance counter stats for 'pahole object_samples/zweinberg@mozilla.com/libgklayout.so' (5 runs):

   12293.726462  task-clock-msecs         #      0.969 CPUs    ( +-   0.189% )
           2663  context-switches         #      0.000 M/sec   ( +-  18.994% )
             40  CPU-migrations           #      0.000 M/sec   ( +-  34.146% )
         127003  page-faults              #      0.010 M/sec   ( +-   0.000% )
    24417854522  cycles                   #   1986.204 M/sec   ( +-   0.174% )
    29007002413  instructions             #      1.188 IPC     ( +-   0.009% )
      297872959  cache-references         #     24.230 M/sec   ( +-   0.529% )
       21440854  cache-misses             #      1.744 M/sec   ( +-   0.321% )

   12.680530119  seconds time elapsed   ( +-   1.042% )

[acme@doppio pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-08 16:37:37 -03:00
Arnaldo Carvalho de Melo 83890e1b71 dwarf_loader: Use an obstack for the extra dbg info
Down from:

[acme@doppio pahole]$ perf stat -r 5 pahole object_samples/zweinberg\@mozilla.com/libgklayout.so > /dev/null

 Performance counter stats for 'pahole object_samples/zweinberg@mozilla.com/libgklayout.so' (5 runs):

   17616.878879  task-clock-msecs         #      0.967 CPUs    ( +-   0.321% )
           3778  context-switches         #      0.000 M/sec   ( +-   9.606% )
             35  CPU-migrations           #      0.000 M/sec   ( +-  52.778% )
          25571  page-faults              #      0.001 M/sec   ( +-   0.000% )
    34988998483  cycles                   #   1986.107 M/sec   ( +-   0.315% )
    32724666091  instructions             #      0.935 IPC     ( +-   0.004% )
      438506991  cache-references         #     24.891 M/sec   ( +-   0.220% )
       67307526  cache-misses             #      3.821 M/sec   ( +-   0.849% )

   18.222393088  seconds time elapsed   ( +-   0.593% )

[acme@doppio pahole]$

To:

[acme@doppio pahole]$ perf stat -r 5 pahole object_samples/zweinberg\@mozilla.com/libgklayout.so > /dev/null

 Performance counter stats for 'pahole object_samples/zweinberg@mozilla.com/libgklayout.so' (5 runs):

   15275.481260  task-clock-msecs         #      0.971 CPUs    ( +-   0.088% )
           3547  context-switches         #      0.000 M/sec   ( +-   2.424% )
              0  CPU-migrations           #      0.000 M/sec   ( +-   0.000% )
         129063  page-faults              #      0.008 M/sec   ( +-   0.000% )
    30337614830  cycles                   #   1986.033 M/sec   ( +-   0.087% )
    31164622345  instructions             #      1.027 IPC     ( +-   0.002% )
      416754268  cache-references         #     27.283 M/sec   ( +-   0.140% )
       44617384  cache-misses             #      2.921 M/sec   ( +-   0.174% )

   15.733210256  seconds time elapsed   ( +-   0.197% )

[acme@doppio pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-08 15:38:18 -03:00
Arnaldo Carvalho de Melo 97a6afe058 codiff: Fix thinko
Sigh, pushed publicly... </brownpaperbagtag>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-06 14:00:44 -03:00
Arnaldo Carvalho de Melo 9c0cb4939c dwarves: Allow avoiding loading addr information
As, for instance, pahole doesn't need it at all.

Down from:

[acme@doppio pahole]$ perf stat -r 5 pahole object_samples/zweinberg\@mozilla.com/libgklayout.so > /dev/null

 Performance counter stats for 'pahole object_samples/zweinberg@mozilla.com/libgklayout.so' (5 runs):

   17233.989563  task-clock-msecs         #      0.994 CPUs    ( +-   0.076% )
           1880  context-switches         #      0.000 M/sec   ( +-   0.159% )
              0  CPU-migrations           #      0.000 M/sec   ( +-   0.000% )
          26248  page-faults              #      0.002 M/sec   ( +-   0.000% )
    34244461105  cycles                   #   1987.030 M/sec   ( +-   0.078% )
    34510583834  instructions             #      1.008 IPC     ( +-   0.001% )
      445937867  cache-references         #     25.875 M/sec   ( +-   0.160% )
       56898165  cache-misses             #      3.302 M/sec   ( +-   0.074% )

   17.335292038  seconds time elapsed   ( +-   0.076% )

[acme@doppio pahole]$

To:

[acme@doppio pahole]$ perf stat -r 5 pahole object_samples/zweinberg\@mozilla.com/libgklayout.so > /dev/null

 Performance counter stats for 'pahole object_samples/zweinberg@mozilla.com/libgklayout.so' (5 runs):

   16511.627334  task-clock-msecs         #      0.992 CPUs    ( +-   0.208% )
           1922  context-switches         #      0.000 M/sec   ( +-   3.068% )
              0  CPU-migrations           #      0.000 M/sec   ( +-   0.000% )
          25570  page-faults              #      0.002 M/sec   ( +-   0.000% )
    32807624343  cycles                   #   1986.941 M/sec   ( +-   0.208% )
    32711598374  instructions             #      0.997 IPC     ( +-   0.001% )
      436345377  cache-references         #     26.427 M/sec   ( +-   0.178% )
       54044997  cache-misses             #      3.273 M/sec   ( +-   0.685% )

   16.652951166  seconds time elapsed   ( +-   0.304% )

[acme@doppio pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-06 13:44:57 -03:00
Arnaldo Carvalho de Melo aca067837c dwarf_loader: Don't always call dwarf_decl_{file,line}
If conf_load.extra_dbg_info is false don't call those functions, that
way we reduce the number of page faults by not accessing the DWARF
sections that contains these informations.

Together with the previous optimization (don't delete everything on
exit), this shaves off 10% of a C++ test case (libgklayout.so)!

Thanks to 'perf record -g + perf report -c fractal' for telling me this
:-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-06 00:44:09 -03:00
Arnaldo Carvalho de Melo 4e6afaa76f pahole: Don't delete everything at exit
Only when debugging leaks we need to be so judicious.

When not debugging we want to exit faster :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-07-06 00:42:59 -03:00
Arnaldo Carvalho de Melo f96099b4c5 cmake: Add comments explaining build_id and fedora/rh detection
Suggested-by: Samuel Bronson <naesten@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-27 13:32:20 -03:00
Arnaldo Carvalho de Melo 0db0b7c9d6 pahole: Fix -a regression, printing anonymous structs again
Example:

[acme@doppio pahole]$ pahole -a object_samples/foo
typedef struct {
	int           i;      /*     0     4 */

	/* size: 4, cachelines: 1, members: 1 */
	/* last cacheline: 4 bytes */
} bar;
[acme@doppio pahole]$

Reported-by: Samuel Bronson <naesten@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-27 11:59:58 -03:00
Arnaldo Carvalho de Melo 7583a4e018 pahole: Kill structures__find
We really only need structures__add, that now returns an existing entry
or add a new one, the code that uses it just passes a bool to figure out
if this is a new entry or an existing one.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-22 18:40:39 -03:00
Arnaldo Carvalho de Melo 4851de7763 pahole: Convert structure to use rb_trees
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-19 00:42:42 -03:00
Arnaldo Carvalho de Melo 519d1d3d96 pahole: Allow list of class names to be passed to -C/--class_name
CSV, and also supports file://class_list.txt as one of the entries
in the list, so:

[acme@doppio pahole]$ pahole -C str_node,strings build/libdwarves.so.1.0.0
struct strings {
	void *              tree;                 /*     0     8 */
	struct gobuffer     gb;                   /*     8    24 */

	/* size: 32, cachelines: 1, members: 2 */
	/* last cacheline: 32 bytes */
};
struct str_node {
	struct rb_node      rb_node;              /*     0    24 */
	const char  *       s;                    /*    24     8 */

	/* size: 32, cachelines: 1, members: 2 */
	/* last cacheline: 32 bytes */
};
[acme@doppio pahole]$

And also:

[acme@doppio pahole]$ pahole -C file://classes.txt,tag build/libdwarves.so.1.0.0
struct strings {
	void *              tree;                 /*     0     8 */
	struct gobuffer     gb;                   /*     8    24 */

	/* size: 32, cachelines: 1, members: 2 */
	/* last cacheline: 32 bytes */
};
struct tag {
	struct list_head    node;                 /*     0    16 */
	uint16_t            type;                 /*    16     2 */
	uint16_t            tag;                  /*    18     2 */
	uint16_t            visited:1;            /*    20:15  2 */
	uint16_t            top_level:1;          /*    20:14  2 */

	/* XXX 14 bits hole, try to pack */

	uint16_t            recursivity_level;    /*    22     2 */
	void *              priv;                 /*    24     8 */

	/* size: 32, cachelines: 1, members: 7 */
	/* bit holes: 1, sum bit holes: 14 bits */
	/* last cacheline: 32 bytes */
};
struct str_node {
	struct rb_node      rb_node;              /*     0    24 */
	const char  *       s;                    /*    24     8 */

	/* size: 32, cachelines: 1, members: 2 */
	/* last cacheline: 32 bytes */
};
[acme@doppio pahole]$

Suggested-by: Zack Weinberg <zweinberg@mozilla.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-18 14:58:51 -03:00
Arnaldo Carvalho de Melo 1009bc9fe7 dutil: Convert strlist to use rb_trees
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-18 14:02:29 -03:00
Arnaldo Carvalho de Melo 5ad2e36d32 dwarves: overhaul cu->language handling
Adding an enum so that CTF doesn't have to include dwarf.h and
setting the language to LANG_C in the CTF loader.

Next csets will handle C++ in a different way, because we may need
to find class sizes in a different CU since ancestors sometimes
are only forward declared...

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-17 15:32:35 -03:00
Zack Weinberg 1298ce789e dwarves_fprintf: Honour conf.show_only_data_members for the vtable
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Zack Weinberg <zweinberg@mozilla.com>
2009-06-17 15:30:09 -03:00
Arnaldo Carvalho de Melo 063bad0a80 dwarves: Add missing return type to function__addr
dwarves.h:695: warning: return type defaults to ‘int’

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-17 13:09:54 -03:00
Arnaldo Carvalho de Melo ba928a23ee cmake: set policy for escaping preprocessor definitions to NEW
CMP0005

       Preprocessor definition values are now escaped automatically.
This policy determines whether or not CMake should generate escaped
preprocessor definition values added via add_definitions.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-17 13:05:44 -03:00
Arnaldo Carvalho de Melo 4b796de4aa dwarves: export ftype__fprintf_parms
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-08 14:23:46 -03:00
Arnaldo Carvalho de Melo e39c0b0998 dwarves: Introduce function__addr method
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-08 14:20:44 -03:00
Arnaldo Carvalho de Melo 2791a55e95 dwarves: Add label__name method
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-08 14:19:23 -03:00
Arnaldo Carvalho de Melo 570dd1ea55 dwarves: constify filename parm of cus__load_file
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-08 14:17:23 -03:00
Arnaldo Carvalho de Melo 27f4f0afb1 dwarves: Make cus__load_file really use the format path
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-04 23:15:52 -03:00
Arnaldo Carvalho de Melo 7c6603189e dwarves: Make all the tags that have an IP to be derived from ip_tag
Next we'll add a new kind of tag, DW_TAG_perf_counter, that will come
from perf.data generated by 'perf report'.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-04 17:30:06 -03:00
Arnaldo Carvalho de Melo e429f8efbb dwarves: Add an rbtree for the functions in a cu
That is used by cus__find_function_by_addr & cu__func_function_by_addr.

First user is pfunct --addr, but this is really for pfunct --annotate, that
will process a perf.data file generated by 'perf report', load the debugging
info and regenerate the functions (pfunct -TVi like) that had hits, using
libdisasm to show the assembly code, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-04 14:56:44 -03:00
Arnaldo Carvalho de Melo dd8c983b40 dwarves: addresses are now uint64_t, no more Dwarf_ types in the core
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-03 15:40:38 -03:00
Arnaldo Carvalho de Melo 0b9d022fb1 dwarf_loader: Move the specification Dwarf_Off from the core
This field is resolved now entirely by the dwarf loader, no sense in having it
in the core.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-03 15:33:57 -03:00
Arnaldo Carvalho de Melo e2b7d1a5f5 dwarves: types are uint16_t now
Remove one more DWARF specific detail.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-03 14:56:53 -03:00
Arnaldo Carvalho de Melo 2f7ffdb088 pahole: Don't add anonymous structs to the list of known structs
Replicating the comment added to the source code:

No sense in adding an anonymous struct to the list of structs already
printed, as we look for the name...  The right fix probably will be to
call class__fprintf on a in-memory FILE, do a hash, and look it by full
contents, not by name. And this is needed for CTF as well, but its late
now and I'm sleepy, will leave for later...

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-05-08 01:05:31 -03:00
Arnaldo Carvalho de Melo 73548f6be3 all: Fix possible uninitialized variable uses
I wasn't especifying the optimization level and the default, despite
using -Wall, was for this so simple case not to be warned about, so
now I'm using -O2.

Alexandre provided a patch initializing the variables to NULL, so that
when we called cus__delete it would bail out and not possibly act on
a random value, I preferred to add extra goto labels and do the exit
path only on the resources that were successfully allocated/initialized,
avoiding, for instance, to call dwarves_exit() if dwarves_init() wasn't
called, which wasn't a problem so far, but could be in the future.

Reported-by: Alexandre Vassalotti <alexandre@peadrop.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-05-04 15:50:06 -03:00
Arnaldo Carvalho de Melo 044dceac85 strings: Fix stupid pointer deref
Fixing this comment,that only appears if one specifies -ON (N >= 2),
despite using -Wall:

strings.c: In function ‘strings__compare’:
strings.c:61: warning: dereferencing type-punned pointer will break strict-aliasing rules

strings.c stores a string_t on the are allocated by tsearch, so do it by
casting to unsigned long, that has a size > than string_t. No need for
the contortionism that was there before, that was plain silly.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-05-04 15:40:44 -03:00
Arnaldo Carvalho de Melo 188cacfe5e gobuffer: Fix buffer expansion algorithm
Kinda brown paper bag one, and the thanks goes to C++ and the boost
library for providing such beautiful test cases as:

	virtual int undefine(class
grammar_helper<boost::spirit::grammar<boost::detail::graph::dot_skipper,
boost::spirit::parser_context<boost::spirit::nil, class
grammar<boost::detail::graph::dot_skipper,
boost::spirit::parser_context<boost::spirit::nil_t> > *); /*
linkage=_ZN5boost6spirit4impl14grammar_helperINS0_7grammarINS_6detail5graph11dot_skipperENS0_14parser_contextINS0_5nil_tEEEEES6_NS0_7scannerINS0_10multi_passISt16istream_iteratorIccSt11char_traitsIcElENS0_19multi_pass_policies14input_iteratorENSH_11ref_countedENSH_12buf_id_checkENSH_9std_dequeEEENS0_16scanner_policiesINS0_27no_skipper_iteration_policyINS0_29inhibit_case_iteration_policyINS0_28skip_parser_iteration_policyIS6_NS0_16iteration_policyEEEEEEENS0_12match_policyENS0_13action_policyEEEEEE8undefineEPSA_
*/

	;-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-25 12:13:14 -03:00
Arnaldo Carvalho de Melo 0a2a9e03c7 dwarf_loader: DW_AT_name can be NULL in DW_TAG_compile_unit
So pass "" in this case so that cu__new doesn't segfaults on strdup'ing
it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-25 11:41:47 -03:00