Skip to content

Commit

Permalink
Qualifying suppression types with the skin name, like this:
Browse files Browse the repository at this point in the history
  memcheck:Addr4

Changed the `name' need of the memcheck skin from "valgrind" to "memcheck" for
this.  But the name Valgrind will return when I print core and skin names in
the startup message.

One issue is that some skins share suppression types, eg. memcheck and
addrcheck.  Might be useful to allow multi-skin suppressions, viz:

  memcheck,addrcheck:Addr4

This won't be too hard to tack on, though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1163 a5019735-40e9-0310-863c-91ae7b9d1cf9
  • Loading branch information
njn committed Oct 2, 2002
1 parent 912ec7c commit c40c3a8
Show file tree
Hide file tree
Showing 9 changed files with 264 additions and 209 deletions.
66 changes: 37 additions & 29 deletions coregrind/vg_errcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,12 @@ static Bool setLocationTy ( Char** p_caller, SuppLocTy* p_ty )
static void load_one_suppressions_file ( Char* filename )
{
# define N_BUF 200
Int fd, i;
Bool eof;
Bool is_unrecognised_suppressions = False;
Char buf[N_BUF+1];
Int fd, i;
Bool eof;
Char buf[N_BUF+1];
Char* skin_name;
Char* supp_name;

fd = VG_(open)( filename, VKI_O_RDONLY, 0 );
if (fd == -1) {
VG_(message)(Vg_UserMsg, "FATAL: can't open suppressions file `%s'",
Expand All @@ -541,7 +543,7 @@ static void load_one_suppressions_file ( Char* filename )
while (True) {
/* Assign and initialise the two suppression halves (core and skin) */
CoreSupp* supp;
supp = VG_(arena_malloc)(VG_AR_CORE, sizeof(CoreSupp));
supp = VG_(arena_malloc)(VG_AR_CORE, sizeof(CoreSupp));
supp->count = 0;
for (i = 0; i < VG_N_SUPP_CALLERS; i++) supp->caller[i] = NULL;
supp->skin_supp.string = supp->skin_supp.extra = NULL;
Expand All @@ -559,29 +561,39 @@ static void load_one_suppressions_file ( Char* filename )

if (eof) goto syntax_error;

/* Is it a core suppression? */
else if (VG_(needs).core_errors && STREQ(buf, "PThread"))
supp->skin_supp.skind = PThreadSupp;
/* Check it has the "skin_name:supp_name" form (ie. look for ':') */
i = 0;
while (True) {
if (buf[i] == ':') break;
if (buf[i] == '\0') goto syntax_error;
i++;
}
buf[i] = '\0'; /* Replace ':', splitting into two strings */

/* Is it a skin suppression? */
else if (VG_(needs).skin_errors &&
SK_(recognised_suppression)(buf, &(supp->skin_supp.skind))) {
/* do nothing, function fills in supp->skin_supp.skind */
skin_name = & buf[0];
supp_name = & buf[i+1];

/* Is it a core suppression? (core:<supp_name>) */
if (VG_(needs).core_errors && STREQ(skin_name, "core"))
{
if (STREQ(supp_name, "PThread"))
supp->skin_supp.skind = PThreadSupp;
else
goto syntax_error;
}
//else goto syntax_error;

/* Is it a skin suppression? (<skin_name>:<supp_name>") */
else if (VG_(needs).skin_errors && STREQ(skin_name, VG_(needs).name))
{
if (SK_(recognised_suppression)(supp_name, & supp->skin_supp.skind))
{
/* Do nothing, function fills in supp->skin_supp.skind */
} else
goto syntax_error;
}

else {
/* SSS: if we don't recognise the suppression name, ignore entire
* entry. Not sure if this is a good long-term approach -- makes
* it impossible to spot incorrect suppression names? (apart
* from the warning given) */
if (! is_unrecognised_suppressions) {
is_unrecognised_suppressions = True;
VG_(start_msg)(Vg_DebugMsg);
VG_(add_to_msg)("Ignoring unrecognised suppressions: ");
VG_(add_to_msg)("'%s'", buf);
} else {
VG_(add_to_msg)(", '%s'", buf);
}
/* Ignore rest of suppression */
while (True) {
eof = VG_(get_line) ( fd, buf, N_BUF );
if (eof) goto syntax_error;
Expand Down Expand Up @@ -609,10 +621,6 @@ static void load_one_suppressions_file ( Char* filename )
supp->next = vg_suppressions;
vg_suppressions = supp;
}
if (is_unrecognised_suppressions) {
/* Print out warning about any ignored suppressions */
//VG_(end_msg)();
}
VG_(close)(fd);
return;

Expand Down
52 changes: 30 additions & 22 deletions glibc-2.1.supp
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@
# Format of this file is:
# {
# name_of_suppression
# kind: one of Param Value1 Value2 Value4 Value8
# Free Addr1 Addr2 Addr4 Addr8
# Cond (previously known as Value0)
# (if Param: name of system call param, if Free: name of free-ing fn)
# skin_name:supp_kind
# (optional extra info for some suppression types)
# caller0 name, or /name/of/so/file.so
# caller1 name, or ditto
# (optionally: caller2 name)
# (optionally: caller3 name)
# }
#
# For memcheck, the supp_kinds are:
#
# Param Value1 Value2 Value4 Value8
# Free Addr1 Addr2 Addr4 Addr8
# Cond (previously known as Value0)
#
# and the optional extra info is:
# if Param: name of system call param
# if Free: name of free-ing fn)

#-------- Suppress errors appearing as a result of calling
#-------- __libc_freeres()

{
__libc_freeres/free_mem(Addr4)
Addr4
memcheck:Addr4
fun:free_mem
fun:__libc_freeres
}
Expand All @@ -30,46 +38,46 @@

{
__pthread_mutex_unlock/__register_frame_info_bases
PThread
core:PThread
fun:__pthread_mutex_unlock
fun:__register_frame_info_bases
}

{
socketcall.connect(serv_addr)/__libc_connect/*(Param)
Param
memcheck:Param
socketcall.connect(serv_addr)
fun:__libc_connect
fun:*
}

{
strrchr/_dl_map_object_from_fd/_dl_map_object(Addr4)
Addr4
memcheck:Addr4
fun:strrchr
fun:_dl_map_object_from_fd
fun:_dl_map_object
}

{
strrchr/_dl_map_object_from_fd/_dl_map_object(Value1)
Value1
memcheck:Value1
fun:strrchr
fun:_dl_map_object_from_fd
fun:_dl_map_object
}

{
llseek(result)/__libc_lseek64/_IO_file_seek(Param)
Param
memcheck:Param
llseek(result)
fun:__libc_lseek64
fun:_IO_file_seek
}

{
__rawmemchr/_nl_*/*locale(Addr4)
Addr4
memcheck:Addr4
fun:__rawmemchr
fun:_nl_*
fun:*locale
Expand All @@ -78,52 +86,52 @@
# new ones for RH62 ls -l
{
__strchrnul/__nss_database_lookup(Cond)
Cond
memcheck:Cond
fun:__strchrnul
fun:__nss_database_lookup
}
{
__strchrnul/__gethostbyname_r(Cond)
Cond
memcheck:Cond
fun:__strchrnul
fun:__gethostbyname_r
}

{
strrchr/_dl_map*/_dl_map*(Cond)
Cond
memcheck:Cond
fun:strrchr
fun:_dl_map*
fun:_dl_map*
}

{
strchr/dl_open_worker/_dl_catch_error(Cond)
Cond
memcheck:Cond
fun:strchr
fun:dl_open_worker
fun:_dl_catch_error
}

{
__rawmemchr/???/__getgrgid_r(Cond)
Cond
memcheck:Cond
fun:__rawmemchr
fun:*
fun:__getgrgid_r
}

{
__rawmemchr/_nl_*/*locale*(Cond)
Cond
memcheck:Cond
fun:__rawmemchr
fun:_nl_*
fun:*locale*
}

{
_dl_relocate_object/dl_open_worker(Value0)
Cond
memcheck:Cond
fun:_dl_relocate_object
fun:dl_open_worker
}
Expand All @@ -135,29 +143,29 @@

{
libc-2.1.3.so/libc-2.1.3.so/libc-2.1.3.so(Cond)
Cond
memcheck:Cond
obj:*libc-2.1.3.so
obj:*libc-2.1.3.so
obj:*libc-2.1.3.so
}

{
strchr/libc-2.1.3.so(Cond)
Cond
memcheck:Cond
fun:*strchr*
obj:*libc-2.1.3.so
}

{
libc-2.1.3.so/libXt.so(Cond)
Cond
memcheck:Cond
obj:*libc-2.1.3.so
obj:*libXt.so*
}

{
socketcall.connect(serv_addr)/__libc_connect/*(Param)
Param
memcheck:Param
socketcall.connect(serv_addr)
obj:*libc-2.1.3.so
obj:*libX11.so*
Expand Down
Loading

0 comments on commit c40c3a8

Please sign in to comment.