57 Commits

Author SHA1 Message Date
Julian Seward
f75575351e Clean up the m_debuginfo interface a bit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4801
2005-09-28 01:23:25 +00:00
Julian Seward
cc8ccbbfb4 This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789
2005-09-27 19:20:21 +00:00
Nicholas Nethercote
63df7df1c8 Give file a better name.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4546
2005-08-28 04:48:12 +00:00
Nicholas Nethercote
3abe14bc49 Only show the "line number too large" warning once.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4511
2005-08-25 00:20:56 +00:00
Nicholas Nethercote
81903d273f Compactify unload_symbols().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4403
2005-08-14 04:29:12 +00:00
Tom Hughes
5636f53a8c If the pre-handler for the execve system call fails to state the file
being executed then propagate the error from the stat instead of just
return ENOACCES all the time. Fixes bug #110208.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4330
2005-08-05 07:46:32 +00:00
Julian Seward
ec3da192ee Don't show CFI reader warnings without -v. This is intended to hide
Warning: zero-sized CIE/FDE but not at section end in DWARF2 CFI reading

which I know is not a good fix, but I don't want to get into messing
with the CFI reader this close to 3.0, and the appearance of this
message causes many regtests to fail on some systems.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4299
2005-08-01 14:12:17 +00:00
Tom Hughes
011cbec76a A static const variable must have a constant initialiser, so remove the
static qualifier from those variables with a non-constant initialiser.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4294
2005-07-29 18:33:19 +00:00
Julian Seward
0f4a5064dd Replace a bunch of useless memory-to-memory copies with some highly
predictable branches.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4233
2005-07-23 17:45:15 +00:00
Julian Seward
7f196f23c4 When canonicalising CFI information, truncate overlapping address
ranges and remove zero-length entries.  If these appear it's because
the generating compiler has created invalid CFI info.  Nevertheless we
should handle this robustly.  This fixes a bug reported by Bill
Hoover.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4232
2005-07-23 17:14:03 +00:00
Julian Seward
6789f6542e A commit which is almost all trivial change.
- m_main: if --log-file-qualifier applies, do not add ".pid"
  at the end of the name

- Fix the logic which detected whether the just-devised name
  already existed.  This was broken (by me) because it could not
  distinguish the reasons for failing to open the logfile.

  Doing this required changing the return type of VG_(open)
  from Int to SysRes (to make failure reasons visible) and 
  that's the cause of most of the changes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4228
2005-07-23 09:18:34 +00:00
Nicholas Nethercote
3816fc83da Re-institute SegInfo reference counting and deallocation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4225
2005-07-21 23:26:25 +00:00
Tom Hughes
c3e2f37aa6 Allow negative sizes for structure members in stabs. Fixed bug #109385.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4221
2005-07-21 11:49:24 +00:00
Tom Hughes
f8e2de1c61 Handle a 'd' stab that indicates a file in pascal. Fixes bug #89914.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4220
2005-07-20 17:48:18 +00:00
Tom Hughes
e1f2161fe1 Handle stabs builtin type -30 (wide characters, 16 bit unsigned).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4218
2005-07-20 13:56:22 +00:00
Julian Seward
f13ea11bf8 Clean up endianness macros a bit. Now pub_tool_basics.h defines
VG_LITTLEENDIAN or VG_BIGENDIAN and that's what should be used.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4142
2005-07-10 00:53:42 +00:00
Nicholas Nethercote
fdeaecb9e1 Rename VG_(get_obj)() as VG_(find_seginfo) to be more consistent
with the other function names.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4114
2005-07-06 13:19:11 +00:00
Julian Seward
71677bc130 acroread-5.06 for x86-linux requires up to 598 CIEs. Bump the array
size accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4058
2005-06-30 00:22:38 +00:00
Julian Seward
2a0a78dffe A couple more XML cases that slipped through the net.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4056
2005-06-30 00:10:16 +00:00
Nicholas Nethercote
f87b53e9d9 Don't include headers from headers -- make inclusions explicit in all C
files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4031
2005-06-26 14:48:23 +00:00
Nicholas Nethercote
c8f13ea9d3 Cleaned up m_redir.c: renamed some variables and functions, added some
comments, neatened the debugging output, avoided unexpected side-effects
in functions, tweaked code to make it clearer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4028
2005-06-26 04:49:25 +00:00
Nicholas Nethercote
cc404a9c03 If read_lib_symbols() fails, once again discard the SegInfo.
And some other minor cleanups.






git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4027
2005-06-26 02:19:17 +00:00
Nicholas Nethercote
e7aa6b03de Made m_debuginfo not depend on m_aspacemgr, breaking the direct circular
dependence between them.  (There's still an indirect one via m_libcmman.)

As a result, I was able to move the Segment type declaration into
pub_core_aspacemgr.h, which is a much better spot.  I was also able to
remove a couple of #includes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4025
2005-06-25 20:49:33 +00:00
Nicholas Nethercote
4b4e694fef Avoid m_redir.c importing priv_symtab.h.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4024
2005-06-25 20:22:43 +00:00
Nicholas Nethercote
58b0509c03 Rename functions to make the type involved clearer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4021
2005-06-25 19:51:33 +00:00
Nicholas Nethercote
b6a7de7795 Remove the Segment back-pointer from SegInfo. The only place it was
being used was in resolve_redir(), and due to the way resolve_redir()
is called, the involved test was always failing anyway.  So we lose
nothing by removing it except some complexity -- there is no longer a
circularity between Segments and SegInfos.







git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4019
2005-06-25 19:33:50 +00:00
Cerion Armour-Brown
c259dd1e6d VG_() -> ML() for ppc32, amd64
(plus a few scattered ones in comments etc)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4003
2005-06-23 07:52:54 +00:00
Nicholas Nethercote
d463dd2292 Removed the VGA_/VGO_/VGP_ prefixes for arch/OS/platform-specific
things.  These made sense when the arch/OS/platform-specific code was in
one module, but as that code got mixed in with generic code the boundary
between generic and non-generic blurred, and the distinction made less
sense.  So let's get rid of them.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4002
2005-06-23 03:27:57 +00:00
Julian Seward
9cb0696641 For symbols which have C-level global scope but which we regard as
module-local, use the new ML_ prefix instead of VG_.  This makes it
trivial to see which names are those exported from public module
interfaces: precisely those using VG_.

/* VG_ is for symbols exported from modules.  ML_ (module-local) is
   for symbols which are not intended to be visible outside modules,
   but which cannot be declared as C 'static's since they need to be
   visible across C files within a given module.  It is a mistake for
   a ML_ name to appear in a pub_core_*.h or pub_tool_*.h file.
   Likewise it is a mistake for a VG_ name to appear in a priv_*.h
   file. 
*/



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4000
2005-06-23 01:02:53 +00:00
Nicholas Nethercote
ba5255ccdc Make search_all_symtabs() work in the same way as search_all_loctabs()
and search_all_scopetabs(), ie. search through SegInfos instead of Segments.
This reduces m_debuginfo's dependency on m_aspacemgr.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3994
2005-06-21 23:09:45 +00:00
Nicholas Nethercote
fc38860306 Don't #include pub_core_debuginfo.h in pub_core_aspacemgr.h. So have
to #include it explicitly in lots of other places, but at least the 
dependency is clear now.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3974
2005-06-21 00:28:11 +00:00
Cerion Armour-Brown
d5f7c8aed3 Finally, valgrind on ppc32.
Plenty still to do, but simple programs like ls seem to run ok

Thanks, Paul, for having your ppc port of valgrind 2.4 to work from!




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3969
2005-06-20 15:51:07 +00:00
Nicholas Nethercote
0100346c9d Remove some unnecessary #includes, comment some others.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3968
2005-06-20 14:18:12 +00:00
Nicholas Nethercote
f174930b23 Final commit for the initial modularisation pass:
- Broke part of m_scheduler off into a new module m_threadstate.  It
  contains ThreadState, VG_(threads)[] and some basic operations on the
  thread table.  All simple stuff, the complex stuff stays in m_scheduler.
  This avoids lots of circular dependencies between m_scheduler and other
  modules.

- Managed to finally remove core.h and tool.h, double hurrah!

- Introduced pub_tool_basics.h and pub_core_basics.h, one of which is
  include by every single C file.

- Lots of little cleanups and changes related to the above.

- I even did a small amount of documentation updating.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3944
2005-06-19 01:24:32 +00:00
Julian Seward
e40e2c0cee Don't do strlen on ui->compdir if it is NULL. Duh.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3920
2005-06-17 13:06:53 +00:00
Nicholas Nethercote
3ae4d1a0ab A cleanup of the redirection stuff.
- Renamed VG_INTERCEPT as VG_REPLACE_FUNCTION to make its purpose
  clearer.

- Renamed VG_WRAPPER as VG_NOTIFY_ON_LOAD to make its purpose cleare.
  Started calling that stuff "load notification".

- Moved various things into m_redir.c, a much more sensible place for
  them.  This reduced the number of exported functions overall.  Renamed
  intercept_demangle() as Z_decode() as part of this.

- Improved the documentation of this stuff, especially in
  pub_core_redir.c.

- Got --run-libc-freeres=yes working again.  It was doing nothing.

- Renamed vg_inject.so as vg_preload_core.so to match
  vg_preload_<tool>.so

- Renamed vg_intercept.c as vg_preloaded.c.  (I kept the "vg_" prefix
  because this filename can appear in stack traces, so the "vg_" is a
  useful hint for users that it belongs to Valgrind.)

- Removed all the Memcheck-specific calls to add_redirect_sym_to_sym()
  from VG_(setup_redirect_table)(), instead using VG_REPLACE_FUNCTION in
  mac_replace_strmem.c, just like vg_replace_malloc.c.  This is the
  right way to do it.  This required moving some of
  coregrind/pub_core_redir.h into the newly added
  include/pub_tool_redir.h.  add_redirect_sym_to_sym() is no longer
  used...

- Now only handing off symbols to m_redir for inspection/decoding after
  they have been deemed to be interesting by the symbol table reader.

- Factored out commonality between the add_redirect_*_to_* functions
  into add_redirect_X_to_X().

- Added "Zh", meaning '-' ('h' for "hyphen"), to the Z-decoding scheme,
  to handle sonames like "ld-linux-x86-64.so.2".

- Added a FAQ explaining the newly found issue of glibc aliasing 
  sometimes causing the wrong function name to appear in stack traces.

- Added a new regtest strchr.c.  It's possible this will fail on some
  platforms.  If so, an alternative output file can be provided, but
  I'd like to see it in practice first.

It's possible that there will be minor breakage on other
platforms/setups, but it should be minimal and easily fixable.

Plus some ordinary cleanups in symtab.c:

- Removed the old optimisation from VG_(addStr)() whereby it kept track
  of the previous 5 added strings and avoiding duplicating any of them.
  Turns out it was barely having any effect any more, and just
  complicated things.

- Made read_symtab() more readable, by introducing a new variable
  "sym_name" and introducing the auxiliary function
  is_symbol_interesting().

- renamed the module variable 'segInfo' as 'segInfo_list' to make it
  more obvious it's a module variable and not just some ordinary local
  variable (which was an easy mistake to make).

-----------------------------------------------------------------------------

XXX: [later] remove add_redirect_sym_to_sym, and everything related to
     X_to_sym?  (ie. only need X_to_addr)

XXX: better function names?  all those 'resolved' names...
     [later...]




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3916
2005-06-16 03:56:58 +00:00
Tom Hughes
cd3fd144e8 When separate debug information is used make sure we look for all
the DWARF sections we now need in the separate debug file.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3912
2005-06-15 10:19:43 +00:00
Julian Seward
6793eb773d Complete the merge of Eric Estievenart's DWARF2 directory-reading
patch.  This actually requires a major restructuring of the DWARF2
line number reading stuff.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3911
2005-06-14 21:51:14 +00:00
Julian Seward
90e98b737e Updates to the rest of the debuginfo module to track directory names.
The only interesting part is a change of signature of
VG_(get_filename_linenum) so that callers can optionally request
directory info too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3909
2005-06-13 17:39:06 +00:00
Julian Seward
56b4d07c7d Partially merge in a (heavily modified) patch from Eric Estievenart
which adds support for reading directory names from DWARF2 debug info.

Also rework the representation of file and directory tables in the
DWARF2 reader.  This removes a longstanding but only-just-discovered
curiousity that the previous code expanded the filename table one
entry at a time, so that reading file names from a DWARF2 object was
quadratic in the number of file names.  It's now N log N.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3908
2005-06-13 17:33:27 +00:00
Nicholas Nethercote
1d0e2e6e41 Created m_machine, for various machine-related things.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3903
2005-06-13 04:21:38 +00:00
Nicholas Nethercote
82860347b1 Modularised the libc low-level memory management stuff (mmap, etc).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3891
2005-06-11 15:51:30 +00:00
Nicholas Nethercote
bd0bea1552 Remove VG_ERRTXT_LEN from core.h.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3886
2005-06-11 05:04:09 +00:00
Nicholas Nethercote
38d2799b5b Having moved VG_(arena_strdup)() out of core.h, core.h no longer
needs to #include pub_core_mallocfree.h.  As a result, we need
to #include it explicitly everywhere else.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3881
2005-06-11 01:31:52 +00:00
Nicholas Nethercote
17bb449c9e Modularised signal libc stuff into m_libcsignal.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3870
2005-06-10 22:08:14 +00:00
Julian Seward
afdd63db49 When printing XML, partially escape the output so that <, > and & in
C++ function names do not totally screw up XML parsers.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3864
2005-06-09 23:58:36 +00:00
Julian Seward
4579ae44e9 Disable debugging printing. Duh.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3862
2005-06-09 19:30:18 +00:00
Julian Seward
2e46c067cd More CFI-reader hacking. Thus far the reader has assumed that each
FDE refers to the immediately preceding CIE, and gives up if that
isn't so.  Well, that isn't so, and this commit fixes it.  Now FDEs
may refer to CIEs seen arbitrarily far back.  This fixes some missing
stack traces on AMD64.

Also add some comments giving a top-level sketch of how the CFI reader
works.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3861
2005-06-09 19:27:25 +00:00
Julian Seward
fe8e63a1d7 Clean up after m_syscalls changes: unbreak amd64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3856
2005-06-09 12:43:42 +00:00
Nicholas Nethercote
face101a47 Modularised file and socket libc stuff in m_libcfile.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3844
2005-06-04 20:03:55 +00:00