Commit Graph

21 Commits

Author SHA1 Message Date
Jon Turney a9da3e4e67 Make ldd stop after any non-continuable exception
Ensure that ldd always stops when the exception is flagged as
non-continuable.

Also arrange for ldd to exit with a non-zero exit code if something went
wrong which prevented us from listing all dynamic dependencies.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-04-04 18:47:44 +01:00
Corinna Vinschen 85db21730b ldd: Handle executable relocation when setting breakpoint
set_entry_point_break() uses GetModuleInformation to fetch the
address of the exe's entry point.  However, just as with
lpStartAddress from the CREATE_PROCESS_DEBUG_EVENT event, the
returned address is only computed from the PE file header.  It's
not actually the entry point in memory, if the executable is
relocated (ASLR).  See
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684229(v=vs.85).aspx

Convert this to using the info from CREATE_PROCESS_DEBUG_EVENT
combined with the offset from the PE file header's  AddressOfEntryPoint
to deal with relocation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-02 12:36:05 +02:00
Corinna Vinschen 9f54ceadae ldd: terminate process on hitting breakpoint
So far ldd terminates the inferior process as soon as some thread
is started.  Apparently threads are started from even ntdll.dll
before the main thread of the application is started.  As a result
the dll list is cut short since ldd terminates prematurely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-02 12:27:04 +02:00
Corinna Vinschen d21b63594c Set supported Windows release to Windows 10
This affects setting _WIN32_WINNT and WINVER.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27 17:51:41 +02:00
Corinna Vinschen 6e623e9320 Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause.

Everything else stays under GPLv3+.

New Linking Exception exempts resulting executables from LGPLv3 section 4.

Add CONTRIBUTORS file to keep track of licensing.

Remove 'Copyright Red Hat Inc' comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23 10:09:17 +02:00
Corinna Vinschen 23ad79d7de Fix potential hang in ldd if DLL encounters missing entry point
* ldd.cc (STATUS_DLL_NOT_FOUND): Drop definition.
        (report): Handle STATUS_ENTRYPOINT_NOT_FOUND exception.  Explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-20 18:32:24 +02:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Yaakov Selkowitz abd9714a7b * ldd.cc (start_process): Handle .oct and .so as DLLs. 2012-01-24 06:29:01 +00:00
Christopher Faylor 1b23b30b29 Clean up whitespace. 2011-12-17 23:39:47 +00:00
Corinna Vinschen f213601cda * ldd.cc (VERSION): Remove. 2011-10-10 15:34:52 +00:00
Christopher Faylor c4fc42535c * ldd.cc: Update copyright. 2011-10-10 15:04:00 +00:00
Corinna Vinschen 92b499acff * Align usage output, version output, as well as usage and version
option handling to use the same style throughout all Cygwin utils.
	Throughout use program_invocation_short_name to refer to current
	process name in Cygwin executables.
	* utils.sgml: Align documentation to above change.  Add missing
	sections for getconf, ldd, and setmetamode.
	* strace.cc (proc_child): Avoid compiler warning.
2011-10-10 14:57:48 +00:00
Corinna Vinschen 16e1c98c1b * ldd.cc (report): Drop long pathname considerations which result in
invalid path, now that this is done in cygwin_conv_path.
2010-08-23 11:04:04 +00:00
Christopher Faylor c8fe6dc446 * ldd.cc: Clean up formatting throughout.
(head): Move earlier.
(saw_file): Ditto.
(print_dlls): Reset head here.  Record seen dll names so they will not
potentially be printed later.
(process_file): Remove clearing of head here.
2010-07-05 16:24:24 +00:00
Corinna Vinschen 73535010d7 * cygpath.cc (main): Only setlocale for LC_CTYPE category. Fallback
to UTF-8 if locale is "C".
	* ldd.cc (main): Ditto.
	* mkgroup.c (main): Ditto.
	* mkpasswd.c (main): Ditto.
	* passwd.c (main): Ditto.
2009-05-15 11:30:18 +00:00
Corinna Vinschen 2971f07610 * cygcheck.cc (dump_sysinfo): Fix compiler warning in printf.
* strace.cc (proc_child): Ditto.
	* ldd.cc: Remove now useless undef wcscasecmp.
2009-03-24 13:35:08 +00:00
Corinna Vinschen 35aeac58b0 * ldd.cc: Fix compiler warning.
* passwd.c: Use mbstowcs instead of MultiByteToWideChar throughout.
	(main): Call setlocale.  Fix a bug in fetching the logon server from
	the environment.
2009-03-22 10:09:01 +00:00
Christopher Faylor 2e13058eac * ldd.cc (load_dll): Start helper program rather than ldd.exe.
(set_entry_point_break): Rename from get_entry_point.
(print_dlls): Rename from print_dlls_and_kill_inferior.  Avoid printing
specific dll name if we're looking at a dll.
(report): Always dump dlls on process exit.  Don't allow thread creation.
Accommodate get_entry_point rename.
(start_process): Start process with DEBUG_ONLY_THIS_PROCESS.
(longopts): Eliminate "dll" option.
(main): Ditto.
* ldd.cc: Use wide character Win32 paths throughout.
(load_dll): Fix size expression (add fn) in realloc.
2009-03-18 04:19:05 +00:00
Christopher Faylor d5e4f55b14 * ldd.cc (longopts): Add --dll option.
(get_module_filename): Generalized wrapper function which avoid path length
restrictions.
(load_dll): Handle special-case of inspecting a DLL.
(start_process): Accept an output parameter "isdll".  Detect when file to start
is a DLL and start a wrapper instead.
(print_dlls_and_kill_inferior): When dealing with a DLL, avoid printing
everything before the DLL itself first appears.  (This is not strictly correct
and should be fixed eventually)
(report): Deal with DLLs.  Don't set a breakpoint for DLLs, just let captive
ldd process terminate normally.  Pass dll info to print_dlls_and_kill_inferior.
(main): Handle special-case "--dll" option by loading the DLL and exiting.
2009-03-14 18:40:59 +00:00
Christopher Faylor 962acfe58a * ldd.cc: Rework to detect missing DLLs.
(start_process): Change to expect windows filename as input.
(tocyg): New function - convert cygwin fn to windows fn.
(print_dlls_and_kill_inferior): Accept extra argument denoting whether to open
input and look for nonexistent DLLs.  Use tocyg to convert filename and pass it
to start_process.
(report): Flag when an DLL-not-found exception occurs and pass this information
to print_dlls_and_kill_inferior.
(filelist): New structure.
(saw_file): New function.
(dump_import_directory): Ditto.
(map_file): Ditto.
(skip_dos_stub): Ditto.
(get_directory_index): Ditto.
(process_file): Ditto.
2009-03-14 06:46:00 +00:00
Christopher Faylor 086dc27fec * ldd.cc: New file. First stab at implementing ldd-like functionality for
Cygwin.
* Makefile.in (CYGWIN_BINS): Add ldd.
(ldd.exe): Use -lpsapi.
2009-01-09 05:11:57 +00:00