]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Simplify the VG_(get_filename_linenum) interface by removing
authorFlorian Krohm <florian@eich-krohm.de>
Tue, 16 Dec 2014 20:55:58 +0000 (20:55 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Tue, 16 Dec 2014 20:55:58 +0000 (20:55 +0000)
the dirname_available parameter. It's redundant. The value
of the returned directory name can be tested instead.

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

cachegrind/cg_main.c
callgrind/dump.c
callgrind/fn.c
coregrind/m_debuginfo/debuginfo.c
coregrind/m_scheduler/scheduler.c
include/pub_tool_debuginfo.h

index 559eea910a0203cbfc5e243066794332f7cb0fc8..685b973e7115d6e5d6612dd5b52252e7939270b5 100644 (file)
@@ -210,10 +210,9 @@ static HChar* get_perm_string(const HChar* s)
 static void get_debug_info(Addr instr_addr, const HChar **dir,
                            const HChar **file, const HChar **fn, UInt* line)
 {
-   Bool found_dirname;
    Bool found_file_line = VG_(get_filename_linenum)(
                              instr_addr, 
-                             file, dir, &found_dirname,
+                             file, dir,
                              line
                           );
    Bool found_fn        = VG_(get_fnname)(instr_addr, fn);
index 687f4df1ea76e65e1842f19e06d08495be14cde5..687561431b08fefab0fda8a2b149ffa1331c6658 100644 (file)
@@ -363,7 +363,7 @@ static /* __inline__ */
 Bool get_debug_pos(BBCC* bbcc, Addr addr, AddrPos* p)
 {
     const HChar *file, *dir;
-    Bool found_file_line, found_dirname;
+    Bool found_file_line;
 
     int cachepos = addr % DEBUG_CACHE_SIZE;
     
@@ -376,7 +376,6 @@ Bool get_debug_pos(BBCC* bbcc, Addr addr, AddrPos* p)
        found_file_line = VG_(get_filename_linenum)(addr,
                                                    &file,
                                                    &dir,
-                                                   &found_dirname,
                                                    &(p->line));
        if (!found_file_line) {
             file = "???";
index b6dff08ded38906374886f34a734aee6b62a0d09..c348fd77d1b8f16082f12f64c7a2dee4ee2b839a 100644 (file)
@@ -429,7 +429,7 @@ Bool CLG_(get_debug_info)(Addr instr_addr,
                           const HChar **fn_name, UInt* line_num,
                           DebugInfo** pDebugInfo)
 {
-  Bool found_file_line, found_fn, found_dirname, result = True;
+  Bool found_file_line, found_fn, result = True;
   UInt line;
   
   CLG_DEBUG(6, "  + get_debug_info(%#lx)\n", instr_addr);
@@ -443,7 +443,6 @@ Bool CLG_(get_debug_info)(Addr instr_addr,
    found_file_line = VG_(get_filename_linenum)(instr_addr,
                                               file,
                                               dir,
-                                              &found_dirname,
                                               &line);
    found_fn = VG_(get_fnname)(instr_addr, fn_name);
 
index 8df866d4927f1b12cbb09884f3de15db7a753544..e8df79c2d57cb8143b780d2b9c6a5d2d3d9a8fc5 100644 (file)
@@ -2067,21 +2067,15 @@ Bool VG_(get_linenum)( Addr a, UInt* lineno )
 Bool VG_(get_filename_linenum) ( Addr a, 
                                  /*OUT*/const HChar** filename,
                                  /*OUT*/const HChar** dirname,
-                                 /*OUT*/Bool* dirname_available,
                                  /*OUT*/UInt* lineno )
 {
    DebugInfo* si;
    Word       locno;
    UInt       fndn_ix;
 
-   vg_assert( (dirname == NULL && dirname_available == NULL)
-              ||
-              (dirname != NULL && dirname_available != NULL) );
-
    search_all_loctabs ( a, &si, &locno );
    if (si == NULL) {
-      if (dirname_available) {
-         *dirname_available = False;
+      if (dirname) {
          *dirname = "";
       }
       *filename = "";      // this used to be not initialised....
@@ -2095,7 +2089,6 @@ Bool VG_(get_filename_linenum) ( Addr a,
    if (dirname) {
       /* caller wants directory info too .. */
       *dirname = ML_(fndn_ix2dirname) (si, fndn_ix);
-      *dirname_available = (*dirname)[0] != '\0';
    }
 
    return True;
@@ -2258,9 +2251,10 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc)
       know_srcloc  = VG_(get_filename_linenum)(
                         eip, 
                         &buf_srcloc, 
-                        &buf_dirname, &know_dirinfo,
+                        &buf_dirname,
                         &lineno 
                      );
+      know_dirinfo = buf_dirname[0] != '\0';
    } else {
       const DiInlLoc *cur_inl = iipc && iipc->cur_inltab >= 0
          ? & iipc->di->inltab[iipc->cur_inltab]
index 4ddf8a35040d70f84e9ec07ea863c705c438e0ce..c45b147bbd37e3dc8fcedc92276c0edfe9adb355 100644 (file)
@@ -2003,7 +2003,7 @@ void do_client_request ( ThreadId tid )
          VG_(memset)(buf64, 0, 64);
          UInt linenum = 0;
          Bool ok = VG_(get_filename_linenum)(
-                      ip, &buf, NULL, NULL, &linenum
+                      ip, &buf, NULL, &linenum
                    );
          if (ok) {
             /* For backward compatibility truncate the filename to
index 95b203acdb0cea4f78bc9b57443cd279658137cf..91f375178f94c1035ccc4c7f33009f2c91bd8b33 100644 (file)
@@ -52,11 +52,10 @@ extern Bool VG_(get_fnname_w_offset)
 /* This one is the most general.  It gives filename, line number and
    optionally directory name.  filename and linenum may not be NULL.
    dirname may be NULL, meaning that the caller does not want
-   directory name info, in which case dirname_available must also be
-   NULL.  If dirname is non-null, directory info is written to *dirname, if
+   directory name info.
+   If dirname is non-null, directory info is written to *dirname, if
    it is available; if not available, '\0' is written to the first
-   byte.  In either case *dirname_available is set to indicate whether
-   or not directory information was available.
+   byte.
 
    The character strings returned in *filename and *dirname are not
    persistent. They will be freed when the DebugInfo they belong to
@@ -68,7 +67,6 @@ extern Bool VG_(get_filename_linenum)
                               ( Addr a, 
                                 /*OUT*/const HChar** filename,
                                 /*OUT*/const HChar** dirname,
-                                /*OUT*/Bool* dirname_available,
                                 /*OUT*/UInt* linenum );
 
 /* Succeeds only if we find from debug info that 'a' is the address of the