Commit Graph

20 Commits

Author SHA1 Message Date
Karel Zak a15dca2f6d include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()
Let's make it possible to use debug.h without environment variables.

Suggested-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-17 13:58:29 +01:00
Karel Zak 7bd0c1ae18 include/debug: improve debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 13:46:49 +01:00
Karel Zak 66643f3151 include/debug: print info when addresses suppressed
Suggested-by: Peter Cordes <peter@cordes.ca>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 13:37:05 +01:00
Karel Zak 6d00cfb233 include/debug: don't print pointer address for SUID programs
* introduce new flag __UL_DEBUG_FL_NOADDR to suppress pointer address printing

* use __UL_DEBUG_FL_NOADDR when SUID

* move ul_debugobj() to debugobj.h, and require UL_DEBUG_CURRENT_MASK
  to provide access to the current mask from ul_debugobj(). It's better
  than modify all ul_debugobj() calls and use the global mask as
  argument.

* remove never used UL_DEBUG_DEFINE_FLAG

Reported-by: halfdog <me@halfdog.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 11:01:26 +01:00
Igor Gnatenko 0e0943c15b debug: use const void * for ul_debugobj()
We don't modify data it's pointing out and we should not modify it.

Also remove casting to void * as gcc will do it automatically (before
we had to cast it explicitly to avoid warning on discarding 'const'
qualifier).

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-09-21 08:22:35 +02:00
Sebastian Rasmussen 9e93004171 misc: Fix various typos
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.

Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
2016-05-31 23:40:21 +02:00
Karel Zak ef316a27de include/debug: improve and cleanup
* use ul_debug_ prefix for all routines
* support <NAME>_DEBUG=all also for programs without debug mask names
  (so we can avoid 0xffff mask in man pages)
* add function to print debug help

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-03 12:51:17 +01:00
Karel Zak 819d9a2975 include/debug: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-24 11:19:23 +02:00
Karel Zak 3635f53ca2 whereis: cleanup debug stuff, fix argv[] usage
* use debug stuff from include/debug.h and make whereis(1) sensitive
  to WHEREIS_DEBUG=0xffff mask

* fix problem with argv[] usage

  # whereis -b -m -M /usr/share/man/man1 -B /usr/bin -f gcc
  bin: /usr/local/bin
  gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

the code ignores "-B" and /usr/bin is interpreted as search pattern,
expected result is:

  # whereis -b -m -M /usr/share/man/man1 -B /usr/bin -f gcc
  gcc: /usr/share/man/man1/gcc.1.gz /usr/bin/gcc

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765306
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-23 13:44:00 +02:00
Sami Kerola aeeb81317e include/debug: remove duplicate 'const' declaration warning
./include/debug.h:89:55: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 13:09:35 +02:00
Karel Zak 1e06330329 include/debug: allow to speficy empty masknames
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 14:19:21 +02:00
Karel Zak 03e4220d29 include/debug: cleanup masks
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 14:13:32 +02:00
Karel Zak 6d577b7089 include/debug: make masknames optional
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 13:51:42 +02:00
Ondrej Oprala 14ad2353cc libs/debug: accept human readable names for _DEBUG=
For example
	$ LIBMOUNT_DEBUG=tab,cache findmnt

to debug only TAB and CACHE subsystem.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 12:33:47 +02:00
Karel Zak e7b49879ad include/debug: add another debug macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-21 12:04:12 +01:00
Karel Zak d282c88df5 include/debug: fix coding style
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-21 11:21:56 +01:00
Ondrej Oprala 274228fecc clean up redundant macros and defines
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-03-13 11:53:31 +01:00
Ondrej Oprala b681c25834 libcommon: don't mention lib versions in debug macros
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-03-13 10:42:11 +01:00
Ondrej Oprala cb3fa84753 libcommon: define more debugging macros
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-03-12 15:40:40 +01:00
Ondrej Oprala db08389d87 libcommon: add common debugging routines
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-03-12 14:37:41 +01:00