summaryrefslogtreecommitdiff
path: root/src/debug.h
Commit message (Collapse)AuthorAgeFilesLines
* core: Avoid printf format warnings due to gpgme_ssize_t.Werner Koch2023-04-171-1/+1
| | | | * src/debug.h (_trace_sysres_ssize_t): Cast arg.
* core: Fix results returned by gpgme_data_* functionsIngo Klöcker2021-08-031-1/+33
| | | | | | | | | | | | | src/debug.h (TRACE_SYSRES_OFF_T, _trace_sysres_off_t, TRACE_SYSRES_SSIZE_T, _trace_sysres_ssize_t): New. src/data.c (gpgme_data_read, gpgme_data_write, gpgme_data_seek): Use appropriate new tracing macros instead of casting the results to int. -- This change adds tracing macros for results of system functions of type __off_t and __ssize_t. GnuPG-bug-id: 5481
* core: Prettify _gpgme_io_select debug output again and fix TRACE_SYSRES.Werner Koch2019-06-051-1/+2
| | | | | | | | | | | | * 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 <wk@gnupg.org>
* core: Improve the debug messages even more.Werner Koch2019-06-051-21/+16
| | | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* core: Protect the trace macros for fun and profit.Werner Koch2018-11-161-58/+88
| | | | | | | | * src/debug.h: Protect macros using. (_trace_err, _trace_sysres, _trace_syserr): New helper inline functions. Signed-off-by: Werner Koch <wk@gnupg.org>
* core: Remove old debug helper functionWerner Koch2018-11-161-21/+25
| | | | | | | * src/debug.c (_gpgme_debug): Remove. (_gpgme_debugf): Rename to _gpgme_debug. Signed-off-by: Werner Koch <wk@gnupg.org>
* core: Simplify the trace maros by using variadics.Werner Koch2018-11-161-135/+30
| | | | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* w32: Fix a few compiler warnings.Werner Koch2018-11-021-0/+5
| | | | | | | * src/debug.h (TRACE_SYSERR_NR): New. * src/w32-io.c: Fix compiler warnings. Signed-off-by: Werner Koch <wk@gnupg.org>
* core: Print a dump of the I/O data only at level 8.Werner Koch2018-11-021-1/+12
| | | | | | | | | | | | * src/debug.h (TRACE_SUC3): New. (TRACE_LOGBUFX): New. * src/posix-io.c: Use TRACE_LOGBUFX instead of TRACE_LOGBUF. * src/w32-glib-io.c: Ditto. -- This will also be changed for w32-io as part of another commit. Signed-off-by: Werner Koch <wk@gnupg.org>
* w32: Remove all support for WindowsCEWerner Koch2018-10-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* Fix compiler warnings about unused value in TRACE macros.Werner Koch2015-06-081-33/+30
| | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* Improve the debug output a bit.Werner Koch2014-11-061-2/+2
| | | | * src/debug.h (TRACE_ERR): Include the line number in the output.
* Trace the use of GPG_ERR_INV_ENGINE.Werner Koch2012-10-191-0/+17
| | | | | | | | | | | | | | * src/debug.h: Include "gpgme.h" (_gpgme_trace_gpgme_error): New. (trace_gpg_error): New macro. Use it in all files where we return GPG_ERR_INV_ENGINE; also "include debug.h" as needed. -- This is a pretty common error code but often it is hard to figure out the actual cause. With debug level 4 we now print the file name and line number where this error code is generated by gpgme. Along with the git revision printed in the first log lines, this should give us an easier way to track down the problems related to this error code.
* Add gpgme_set_global_flag to help debuggingWerner Koch2012-09-251-0/+3
| | | | | | | | | | | | | | * 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-4/+4
| | | | | -- Command used: sed -i 's,[ \t]*$,,' FILE
* 2010-06-10 Marcus Brinkmann <marcus@g10code.de>Marcus Brinkmann2010-06-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | * debug.h (TRACE_SUC6): New macro. * w32-io.c (MAX_SLAFD): New macro. (fd_table): New static variable. (new_fd, release_fd): New functions. (fd_to_handle, handle_to_fd, handle_to_socket): Remove macros. (MAX_READERS, MAX_WRITERS): Increase to 64. (notify_table): Increase to MAX_SLAFD. (struct reader_context_s, struct writer_context_s): Add member file_sock. (reader, writer): Use file_hd vs file_sock to decide if socket operations to use. Remove auto-detect mode. (create_reader, create_writer): Set file_sock. Unblock pending thread only if this is a pipe fd. (_gpgme_io_pipe): Allocate fds from table and return slot indices instead of windows handles. This allows to properly handle RVIDs. (_gpgme_io_close): Handle dup'ed file descriptors. (build_commandline) [HAVE_W32_SYSTEM]: Use RVID from fd table now. (_gpgme_io_spawn): Use fd table now. (_gpgme_io_fd2str): Use RVID from fd table now. (_gpgme_io_dup): Implement using fd table. (_gpgme_io_socket): Allocate fds from table. (_gpgme_io_connect): Use fd from table.
* 2009-11-04 Marcus Brinkmann <marcus@g10code.de>Marcus Brinkmann2009-11-041-96/+99
| | | | | | | | | | | | | | | | | | | | * 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 <marcus@g10code.de>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-10-30 Marcus Brinkmann <marcus@g10code.de>Marcus Brinkmann2009-10-301-90/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Check for argp.h and error_t. src/ 2009-10-30 Marcus Brinkmann <marcus@g10code.de> * Makefile.am (noinst_PROGRAMS): New target gpgme-tool. (gpgme_tool_LDADD): New variable. * gpgme-tool.c: New file. * ops.h (_gpgme_sig_notation_clearm _gpgme_signers_clear): New prototypes. * gpgme.c (gpgme_set_protocol): Allow GPGME_PROTOCOL_GPGCONF (when had that gone missing?). (_gpgme_sig_notation_clear): New function without debug output. (gpgme_release): Call it and _gpgme_signers_clear. * signers.c (_gpgme_signers_clear): New function without debug output. * g13.c (gpgme_op_vfs_mount): Add debug output. * assuan-support.c (my_spawn): Allow fd_child_list to be NULL. * conversion.c (_gpgme_encode_percent_string): Fix infinite loop. * debug.h: Put tag in front of debug lines, should make for nicer output. * engine-assuan.c (llass_new): Use our new system hooks for libassuan. * engine-g13.c (g13_new): Remove redundant assuan context allocation. * version.c (gpgme_check_version_internal): Delay debug output until after gpgme_check_version was called.
* 2009-10-27 Marcus Brinkmann <marcus@g10code.de>Marcus Brinkmann2009-10-271-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * edit.c (gpgme_op_edit_start, gpgme_op_edit) (gpgme_op_card_edit_start, gpgme_op_card_edit): Add debug output. * encrypt-sign.c (gpgme_op_encrypt_sign_start) (gpgme_op_encrypt_sign): Likewise. * encrypt.c (gpgme_op_encrypt_start, gpgme_op_encrypt) (gpgme_op_encrypt_result): Likewise. * export.c (gpgme_op_export_start, gpgme_op_export) (gpgme_op_export_ext_start, gpgme_op_export_ext) (gpgme_op_export_keys_start, gpgme_op_export_keys): Likewise. * genkey.c (gpgme_op_genkey_start, gpgme_op_genkey) (gpgme_op_genkey_result): Likewise. * getauditlog.c (gpgme_op_getauditlog_start) (gpgme_op_getauditlog): Likewise. * import.c (gpgme_op_import_result, gpgme_op_import_start) (gpgme_op_import): Likewise. * keylist.c (gpgme_op_keylist_result, keylist_colon_handler) (gpgme_op_keylist_start, gpgme_op_keylist_ext_start) (gpgme_op_keylist_next, gpgme_op_keylist_end, gpgme_get_key): Likewise. * opassuan.c (gpgme_op_assuan_transact_start) (gpgme_op_assuan_transact_ext, gpgme_op_assuan_result) (gpgme_op_assuan_transact): Likewise. * signers.c (gpgme_signers_add, gpgme_signers_clear): Likewise. * trustlist.c (gpgme_op_trustlist_start) (gpgme_op_trustlist_next, gpgme_op_trustlist_end): Likewise. * verify.c (gpgme_op_verify_start, gpgme_op_verify) (gpgme_op_verify_result): Likewise.
* 2009-10-26 Marcus Brinkmann <marcus@g10code.de>Marcus Brinkmann2009-10-261-5/+6
| | | | | | | | | | | | | | | | | | | * debug.h (DEBUG_GLOBAL): New debug level. * conversion.c (gnupg_errors, _gpgme_map_gnupg_error): Removed. * data-user.c (gpgme_data_new_from_cbs): Add debug output. * data-fd.c (gpgme_data_new_from_fd): Likewise. * data-stream.c (gpgme_data_new_from_stream): Likewise. * decrypt.c (gpgme_op_decrypt_result, gpgme_op_decrypt_start) (gpgme_op_decrypt): Likewise. * delete.c (gpgme_op_delete_start, gpgme_op_delete): Likewise. * decrypt-verify.c (gpgme_op_decrypt_verify_start) (gpgme_op_decrypt_verify): Likewise. * sign.c (gpgme_op_sign_result): Fix debug message. * data-mem.c (gpgme_data_new): Improve debug output. * verify.c (parse_trust): Use atoi instead of _gpgme_map_gnupg_error. * decrypt.c (_gpgme_decrypt_status_handler): Likewise.
* 2009-06-22 Marcus Brinkmann <marcus@g10code.de>Marcus Brinkmann2009-06-221-37/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <marcus@g10code.de> * 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 <marcus@g10code.de> * gpg/t-support.h (passphrase_cb): Implement write() according to the book to silence compiler warning. * gpgsm/t-support.h (passphrase_cb): Likewise.
* 008-11-03 Marcus Brinkmann <marcus@g10code.com>Marcus Brinkmann2008-11-031-0/+226
* configure.ac: Replace gpgme paths with src. * gpgme: Move to ... * src: ... this new directory. assuan/ 2008-11-03 Marcus Brinkmann <marcus@g10code.com> * Makefile.am (INCLUDES): Replace gpgme path with src. tests/ 2008-11-03 Marcus Brinkmann <marcus@g10code.com> * gpgsm/Makefile.am (INCLUDES, LDADD): Replace gpgme path with src. * gpg/Makefile.am (INCLUDES, LDADD, t_thread1_LDADD): Likewise. * Makefile.am (LDADD): Likewise.