* 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 <wk@gnupg.org>
* 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: 7a1e7006d0
Signed-off-by: Werner Koch <wk@gnupg.org>
* 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>
* 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 <wk@gnupg.org>
* 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.
* 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>
* 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>
* 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 <wk@gnupg.org>
* 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 <wk@gnupg.org>
* 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 <wk@gnupg.org>
* 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>
* 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.
* configure.ac: Require libgpg-error 1.8.
src/
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* 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.
* 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).
* 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.
2009-03-06 Marcus Brinkmann <marcus@g10code.de>
* assuan/: Update to libassuan SVN 2009-03-06.
src/
2009-03-06 Marcus Brinkmann <marcus@g10code.de>
* version.c (do_subsystem_inits): Do not set assuan log level.
* debug.c (debug_init): Likewise.