New function. Only warn once about bad CRC's.

Mon Mar  5 16:55:39 2007  Søren Sandmann  <sandmann@redhat.com>

        * binfile.c (already_warned): New function. Only warn once about
        bad CRC's.


svn path=/trunk/; revision=361
This commit is contained in:
Søren Sandmann
2007-03-05 21:53:57 +00:00
committed by Søren Sandmann Pedersen
parent 7800fcd870
commit 7b821752f9
6 changed files with 59 additions and 19 deletions

View File

@ -1,3 +1,8 @@
Mon Mar 5 16:55:39 2007 Søren Sandmann <sandmann@redhat.com>
* binfile.c (already_warned): New function. Only warn once about
bad CRC's.
2007-03-02 Soren Sandmann <sandmann@daimi.au.dk>
* sysprof-text.c (dump_data): Make this function static

View File

@ -68,6 +68,26 @@ read_inode (const char *filename)
return statbuf.st_ino;
}
static gboolean
already_warned (const char *name)
{
static GPtrArray *warnings;
int i;
if (!warnings)
warnings = g_ptr_array_new ();
for (i = 0; i < warnings->len; ++i)
{
if (strcmp (warnings->pdata[i], name) == 0)
return TRUE;
}
g_ptr_array_add (warnings, g_strdup (name));
return FALSE;
}
static ElfParser *
separate_debug_file_exists (const char *name, guint32 crc)
{
@ -89,7 +109,8 @@ separate_debug_file_exists (const char *name, guint32 crc)
if (file_crc != crc)
{
g_print ("warning: %s has wrong crc \n", name);
if (!already_warned (name))
g_print ("warning: %s has wrong crc \n", name);
elf_parser_free (parser);
@ -136,9 +157,12 @@ get_debug_file (ElfParser *elf,
tries[1] = g_build_filename (dir, ".debug", basename, NULL);
tries[2] = g_build_filename ("/usr", "lib", "debug", dir, basename, NULL);
tries[3] = g_build_filename (debug_file_directory, dir, basename, NULL);
for (i = 0; i < N_TRIES; ++i)
{
#if 0
g_print ("trying: %s\n", tries[i]);
#endif
result = separate_debug_file_exists (tries[i], crc32);
if (result)
{

View File

@ -75,21 +75,6 @@ create_format (void)
return format;
}
static int
compute_total (StackNode *node)
{
StackNode *n;
int total = 0;
for (n = node; n != NULL; n = n->next)
{
if (n->toplevel)
total += n->total;
}
return total;
}
static void
serialize_call_tree (StackNode *node,
SFileOutput *output)
@ -599,6 +584,21 @@ profile_caller_free (ProfileCaller *caller)
g_free (caller);
}
static int
compute_total (StackNode *node)
{
StackNode *n;
int total = 0;
for (n = node; n != NULL; n = n->next)
{
if (n->toplevel)
total += n->total;
}
return total;
}
static void
build_object_list (StackNode *node, gpointer data)
{

View File

@ -175,7 +175,7 @@ struct SFileInput
GHashTable *instructions_by_location;
};
gboolean
static gboolean
check_name (Instruction *instr,
const char *name)
{

12
sfile.h
View File

@ -78,6 +78,18 @@ SerializerFormat *serializer_make_pointer (Serializer *serialiser,
* enums, optionals, selections, empties
*
*
* Other things:
*
* "selections" - when several different types are possible - would need lambda transitions in and out
*
* ability to allow 'ignored' elements that are simply skipped at parse time. This could become important
* for future-proofing files.
*
* unions maybe?
*
*
*
*
*==============================================
* Also think about versioning - apps will want to be able to read and write
* different versions of the format, and they want to be able to sniff the

View File

@ -1405,7 +1405,6 @@ build_gui (Application *app)
gtk_widget_realize (GTK_WIDGET (app->main_window));
/* Tool items */
app->start_button = glade_xml_get_widget (xml, "start_button");
app->profile_button = glade_xml_get_widget (xml, "profile_button");
app->reset_button = glade_xml_get_widget (xml, "reset_button");