]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Handle explicitely all enum values in 'switch' on AddrInfo tag
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 19 Sep 2014 18:58:18 +0000 (18:58 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 19 Sep 2014 18:58:18 +0000 (18:58 +0000)
(reported by Florian)

Note that Addr_Undescribed will cause an assert if such
an undescribed addrinfo is pretty printed, as normally
such addrinfo should always be described before being pretty printed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14558

coregrind/m_addrinfo.c
include/pub_tool_addrinfo.h

index 05566fdcc3d1b5a4f5455fc1c0e2b69b223b0cf5..582b960dcc1c70be3522bb6e7923b8cc156c6e34 100644 (file)
@@ -280,11 +280,14 @@ void VG_(initThreadInfo) (ThreadInfo *tinfo)
 void VG_(clear_addrinfo) ( AddrInfo* ai)
 {
    switch (ai->tag) {
+      case Addr_Undescribed:
+         break;
+
       case Addr_Unknown:
-          break;
+         break;
 
       case Addr_Stack: 
-          break;
+         break;
 
       case Addr_Block:
          break;
@@ -354,6 +357,9 @@ static void pp_addrinfo_WRK ( Addr a, AddrInfo* ai, Bool mc, Bool maybe_gcc )
    vg_assert (!maybe_gcc || mc); // maybe_gcc can only be given in mc mode.
 
    switch (ai->tag) {
+      case Addr_Undescribed:
+         VG_(core_panic)("mc_pp_AddrInfo Addr_Undescribed");
+
       case Addr_Unknown:
          if (maybe_gcc) {
             VG_(emit)( "%sAddress 0x%llx is just below the stack ptr.  "
index b07e47612365f51c7cab9cd5074fd8414c40af9e..0e55042441a3176453d902c278574f864450fca5 100644 (file)
@@ -188,7 +188,8 @@ extern void VG_(describe_addr) ( Addr a, /*OUT*/AddrInfo* ai );
 
 extern void VG_(clear_addrinfo) ( AddrInfo* ai);
 
-/* Prints the AddrInfo ai describing a. */
+/* Prints the AddrInfo ai describing a.
+   Note that an ai with tag Addr_Undescribed will cause an assert.*/
 extern void VG_(pp_addrinfo) ( Addr a, AddrInfo* ai );
 
 /* Same as VG_(pp_addrinfo) but provides some memcheck specific behaviour: