aboutsummaryrefslogtreecommitdiffstats
path: root/src/debug.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add a configure test for gettid.Werner Koch2024-12-041-2/+9
| | | | | | | | | | | | * configure.ac (HAVE_GETTID,HAVE_SYS_GETTID): New test. * src/debug.c: Include syscall.h if needed. (tid_log_callback) [HAVE_SYS_GETTID]: Use SYS_gettid -- Linux introduced the gettid syscall with 2.4.11 but glibc only with its version 2.30. This patch allows building on older platforms. Co-authored-by: lgh1
* Don't use ath_self, but get thread ID directly.NIIBE Yutaka2024-07-051-4/+21
| | | | | | | | | | | * src/debug.c [HAVE_W32_SYSTEM or __linux] (tid_log_callback): Use native thread ID call for Windows and Linux, ifdef-out-ed. (debug_init): Only call gpgrt_log_set_pid_suffix_cb for relevant systems. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Switch to logging via gpgrtWerner Koch2023-02-101-79/+83
| | | | | | | | | | | | * src/debug.c (errfp): Remove. (debug_init): Factor some code out to ... (safe_to_use_debug_file): new. (tid_log_callback): New. (debug_init): Rewrite to make use of gpgrt logging. (_gpgme_debug): Ditto. (_gpgme_debug_end): Remove extra LF testing code. * src/dirinfo.c (get_gpgconf_item): Remove now unneeded LFs. Realign output.
* core: At debug levels up to 9 print only an ascii dump.Werner Koch2019-06-131-27/+59
| | | | | | | | | | | | * src/debug.c (_gpgme_debug_buffer): Switch between two output formats. -- The new format is much more practical than the bunch of hex digits followed by just 16 ascii chars. To get the old behaviour use a debug level of 10. Signed-off-by: Werner Koch <[email protected]>
* core: Prettify _gpgme_io_select debug output again and fix TRACE_SYSRES.Werner Koch2019-06-051-5/+16
| | | | | | | | | | | | * src/debug.c (_gpgme_debug): Take better care of NULL userinfo. (_gpgme_debug_end): Rework. (_trace_sysres): Print ERRNO and not the supplied RES. -- The TRACE_SYSRES patch fixes Regression-due-to: 7a1e7006d06fdbab86ea79a197c316744b09d933 Signed-off-by: Werner Koch <[email protected]>
* core: Improve the debug messages even more.Werner Koch2019-06-051-59/+40
| | | | | | | | | | | | | | | * src/debug.c (_gpgme_debug): Add arg LINE. Chnage all callers. (_gpgme_debug_begin): Remove. * src/debug.h (TRACE_SEQ): Use the LINE arg of _gpgme_debug. -- This includes chnages to always print fds in decimal as weel as tweaking the TARCE_SEQ function to make use of the new machinery. The standard 'tag' can now always be NULL and no tag information will be printed. Signed-off-by: Werner Koch <[email protected]>
* core: Avoid explicit locks in the debug code.Werner Koch2019-06-051-46/+46
| | | | | | | | | | | | | | | | | * src/debug.c (debug_lock): Remove. Also remove all users. (_gpgme_debug): Use gpgrt_bsprintf to prepare the output and finally print using standard fprintf. Reformat to prefix to be narrower. -- Note that the locks are now implicitly done using the systems stdio. The threadid is now printed with 4 digits in hex and thus without the angle brackets and the 0x. However it is still a hex number even if it may look like an octal number. The hex letters are uppercase to make searching in locks easier iff the threadid happens to have a letter in it. Signed-off-by: Werner Koch <[email protected]>
* core, w32: Fix format string errors on windowsAndre Heinecke2019-03-271-1/+8
| | | | | | | | | * src/debug.c (_gpgme_debug): Use gpgrt_vasprintf instead of vfprintf to have a more portable format. -- This fixes crashes on Windows because "%zu" is used which is not natively supported on Windows but which gpgrt supports.
* core: Fix a LF problem in the new debug fucntion.Werner Koch2018-11-161-3/+6
| | | | | * src/debug.c (_gpgme_debug): Print a LF for an empty FORMAT unless we are in legacy mode.
* core: Fix format string errors in trace macrosWerner Koch2018-11-161-1/+1
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Remove old debug helper functionWerner Koch2018-11-161-60/+8
| | | | | | | * src/debug.c (_gpgme_debug): Remove. (_gpgme_debugf): Rename to _gpgme_debug. Signed-off-by: Werner Koch <[email protected]>
* core: Simplify the trace maros by using variadics.Werner Koch2018-11-161-0/+85
| | | | | | | | | | | | | | | | * src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros and remove the TRACE_BEG1 et al. Change all users to always pass a format string. (TRACE): Ditto. * src/debug.c (_gpgme_debugf): New. * configure.ac <GCC>: Add -Wno-format-zero-length. -- This makes it easier for use to enable format checks. The zero-length format is required to allow for an empty format due to the comman problematic of __VA_ARGS__. Signed-off-by: Werner Koch <[email protected]>
* Add SPDX identifiers to most source filesWerner Koch2018-11-161-19/+19
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* w32: Remove all support for WindowsCEWerner Koch2018-10-311-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Remove WindwosCE support. * contrib/: Remove all; it was only used for WindowsCE. * src/w32-ce.c, src/w32-ce.h: Remove files. * src/Makefile.am (system_components): Remove these files. * src/ath.c, src/ath.h: Remove W32CE support. * src/data-compat.c (gpgme_data_new_from_filepart): Ditto. (gpgme_data_new_from_file): Ditto. * src/debug.c (debug_init, _gpgme_debug): Ditto. * src/gpgme-tool.c (gpgme_server): Ditto. (main): Ditto. * src/priv-io.h: Do not include w32-ce.h. * src/util.h: Remove WindowsCE support. * src/w32-io.c: Ditto. * src/w32-util.c: Ditto. * src/debug.h (TRACE_SUC4): New. -- There is no more hardware to test our code, the support for Windows CE terminated along time ago. Note that our code worked only with the old WindowsCE with that overall system limit of 31 processes. Signed-off-by: Werner Koch <[email protected]>
* core: Return an error if NULL is provided for genkey's parms.Werner Koch2018-10-181-0/+3
| | | | | | | | | | | | * src/debug.c (_gpgme_debug_buffer): Bail out of BUF is NULL. * src/genkey.c (gpgme_op_genkey): Do no deref a NULL in TRACE_LOGBUF. (gpgme_op_genkey_start): Ditto. Return an error if PARMS is NULL. -- This robustness patch should solve one part of GnuPG-bug-id: 4192 Signed-off-by: Werner Koch <[email protected]>
* Spelling fixes for comments and docAndre Heinecke2017-12-081-1/+1
| | | | | | | -- Patch provided by ka7 in dev.gnupg.org Differential D423
* core: Replace all calls to *sprintf by gpgrt_*sprintf.Werner Koch2017-02-021-7/+7
| | | | | | | | | | | | | | * configure.ac (vasprintf): Remove check. * src/vasprintf.c: Remove file. * src/util.h (vasprintf, asprintf): Remove prototypes. Replace all calls to vasprintf and asprintf by gpgrt_vasprintf or gpgrt_asprintf. Also take care to use gpgrt_free on the returned value. * src/w32-util.c (_gpgme_get_gpgconf_path): Replace a gpgrt_asprintf by _gpgme_strconcat. (snprintf): New macro to use gpgrt_snprintf instead of the system's standard snprintf. Signed-off-by: Werner Koch <[email protected]>
* w32: Print the installation directory in debug mode.Werner Koch2015-08-241-1/+11
| | | | | | | | | | * src/debug.c (debug_init) [W32]: Show libgpgme installation dir. -- I expect that gpgme will be distributed by applications and thus it will be helpful to see in the debug log which gpgme is actually used. Signed-off-by: Werner Koch <[email protected]>
* Fix compiler warnings about unused value in TRACE macros.Werner Koch2015-06-081-4/+15
| | | | | | | | | | | | | | * src/debug.h: Change macros to not have a literal 0 as last expression of the comma operator. * src/debug.c (_gpgme_debug_frame_end): Return 0. (_gpgme_debug): Return 0. -- Instead of using foo(), 0 for the trace macros we let foo() return 0 instead. Signed-off-by: Werner Koch <[email protected]>
* Simplify a debug code function.Werner Koch2013-05-061-11/+4
| | | | * src/debug.c (_gpgme_debug): Remove static space string.
* Add gpgme_set_global_flag to help debuggingWerner Koch2012-09-251-7/+35
| | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_global_flag): New. * src/gpgme.h.in (gpgme_set_global_flag): New. * src/gpgme.def, src/libgpgme.vers: Add new public function. * src/debug.c (envvar_override): New.: (_gpgme_debug_set_debug_envvar): New. (debug_init): Take ENVVAR_OVERRIDE in account. -- On Android envvars can't be used, thus we need another way to enable GPGME debugging. The new function allows this and may be used in the future to implement similar things.
* Remove all trailing whitespace from source filesWerner Koch2012-09-251-7/+7
| | | | | -- Command used: sed -i 's,[ \t]*$,,' FILE
* Hopefully last changes for building with MSC.Werner Koch2010-11-031-0/+10
|
* More include guards.Werner Koch2010-11-031-1/+5
| | | | | | Provide access for Wince. Install dummy sehmap.h
* First take on changes to allow building with MSC for W32CE.Werner Koch2010-11-021-1/+3
| | | | | Fixed regression in plain W32 build.
* Enable debugging feature for W32CE.Werner Koch2010-10-071-0/+4
| | | | | kFreeBSD portability fix.
* 2010-05-06 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-061-1/+1
| | | | | | | | | | | | | | | | | | | * configure.ac: Require libgpg-error 1.8. src/ 2010-05-06 Marcus Brinkmann <[email protected]> * sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c, decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c, data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use gpg_error_from_syserror instead gpg_error_from_errno, and use gpg_err_set_errno to set error number. * setenv.c: Include <gpg-error.h> and define __set_errno to use gpg_err_set_errno. * gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is mapped in Windows CE) instead of E2BIG (which is not). (gt_import_keys): Initialize err.
* 2009-12-22 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-12-221-1/+1
| | | | | | | | | | * configure.ac: Do not use echo -n. Test for __thread. src/ 2009-12-22 Marcus Brinkmann <[email protected]> * debug.c: Test for TLS, not __GNUC__
* Test on sgid processWerner Koch2009-12-101-1/+5
|
* 2009-11-04 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-11-041-17/+55
| | | | | | | | | | | | | | | | | | | | * ath.h (ath_self): New prototype. Include <stdint.h> * ath.c, ath-pth.c, ath-pthread.c (ath_self): New function. * debug.h: Rewrite most macros to beautify debug output. (_gpgme_debug_buffer): Remove tagname and tag argument. (_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New prototypes. * debug.c: Include <time.h>. Don't include assuan.h. (frame_nr, FRAME_NR): New thread-specific variable and macro. (debug_init): Do not initialize assuan. Call _gpgme_debug after initialization instead using printf directly. (_gpgme_debug): Do not call debug_init (we now ensure proper initialization by user). Add timestamp and thread/process ID. (_gpgme_debug_buffer): Do not take tagname and tag argument. (_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New functions. * version.c (gpgme_check_version_internal, gpgme_check_version): Fix debug string. Do not initialize assuan. * posix-io.c (get_max_fds): Use 0 not NULL (nicer debug output).
* 2009-11-02 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-11-021-1/+2
| | | | | | | | | | * debug.h (_gpgme_debug_buffer): Make TAG argument const const. * debug.c (_gpgme_debug_buffer): Likewise. * gpgme-tool.c (input_notify, output_notify): Adjust type to new assuan interface. * decrypt.c (gpgme_op_decrypt_result): Remove unused variable. * opassuan.c (gpgme_op_assuan_transact): Fix return value.
* 2009-06-22 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-06-221-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Add AC_TYPE_UINTPTR_T. * assuan/assuan.h [_ASSUAN_IN_GPGME_BUILD_ASSUAN]: Declare _gpgme_io_connect. src/ 2009-06-22 Marcus Brinkmann <[email protected]> * debug.h: Everywhere, use %p instead of 0x%x to print pointer. [HAVE_STDINT_H]: Include <stdint.h>. (_TRACE, TRACE, TRACE0, TRACE1, TRACE2, TRACE3, TRACE6): Cast tag to (uintptr_t) before casting it to (void*) to silence GCC warning. * gpgme.h.in (_GPGME_DEPRECATED_OUTSIDE_GPGME): New macro. * sign.c (_GPGME_IN_GPGME): Define it. * keylist.c (_GPGME_IN_GPGME): Define it. * debug.c (_gpgme_debug_begin, _gpgme_debug_add): Handle error in vasprintf and asprintf. * priv-io.h: Include <sys/socket.h>. Declare _gpgme_io_connect. tests/ 2009-06-22 Marcus Brinkmann <[email protected]> * gpg/t-support.h (passphrase_cb): Implement write() according to the book to silence compiler warning. * gpgsm/t-support.h (passphrase_cb): Likewise.
* assuan/Marcus Brinkmann2009-03-061-2/+1
| | | | | | | | | | | | | 2009-03-06 Marcus Brinkmann <[email protected]> * assuan/: Update to libassuan SVN 2009-03-06. src/ 2009-03-06 Marcus Brinkmann <[email protected]> * version.c (do_subsystem_inits): Do not set assuan log level. * debug.c (debug_init): Likewise.
* 008-11-03 Marcus Brinkmann <[email protected]>Marcus Brinkmann2008-11-031-0/+295
* configure.ac: Replace gpgme paths with src. * gpgme: Move to ... * src: ... this new directory. assuan/ 2008-11-03 Marcus Brinkmann <[email protected]> * Makefile.am (INCLUDES): Replace gpgme path with src. tests/ 2008-11-03 Marcus Brinkmann <[email protected]> * gpgsm/Makefile.am (INCLUDES, LDADD): Replace gpgme path with src. * gpg/Makefile.am (INCLUDES, LDADD, t_thread1_LDADD): Likewise. * Makefile.am (LDADD): Likewise.