mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-04-06 14:21:43 +08:00
gprofng: fix build with -Werror=format-security
gprofng/ChangeLog 2022-06-13 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/28968 * src/src/Hist_data.cc (print_row): Make param const. * src/src/Hist_data.h (print_row): Likewise. * src/src/Print.h: Remove unused functions and variables. * src/Print.cc: Fix -Werror=format-security errors. * src/parse.cc: Likewise.
This commit is contained in:
parent
362a867f2a
commit
8e2de6c81a
@ -898,7 +898,8 @@ append_str (StringBuilder *sb, char *s, size_t len, int vis_bits)
|
||||
}
|
||||
|
||||
void
|
||||
Hist_data::print_row (StringBuilder *sb, int row, Metric::HistMetric *hmp, char *mark)
|
||||
Hist_data::print_row (StringBuilder *sb, int row, Metric::HistMetric *hmp,
|
||||
const char *mark)
|
||||
{
|
||||
TValue res;
|
||||
char buf[256];
|
||||
|
@ -116,7 +116,8 @@ public:
|
||||
TValue *get_real_value (TValue *res, int met_index, int row);
|
||||
TValue *get_value (TValue *res, int met_index, int row);
|
||||
TValue *get_value (TValue *res, int met_index, HistItem *hi);
|
||||
void print_row (StringBuilder *sb, int row, Metric::HistMetric *hist_metric, char *mark);
|
||||
void print_row(StringBuilder *sb, int row, Metric::HistMetric *hist_metric,
|
||||
const char *mark);
|
||||
void print_content (FILE *out_file, Metric::HistMetric *hist_metric, int limit);
|
||||
int print_label (FILE *out_file, Metric::HistMetric *hist_metric, int space);
|
||||
void update_total (Hist_data::HistItem *new_total);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -156,9 +156,6 @@ private:
|
||||
Histable *sobj;
|
||||
MetricList *mlist;
|
||||
Metric::HistMetric *hist_metric;
|
||||
char **fmt_int;
|
||||
char **fmt_real0;
|
||||
char **fmt_real1;
|
||||
int limit;
|
||||
int print_row;
|
||||
};
|
||||
@ -225,15 +222,13 @@ public:
|
||||
void data_dump ();
|
||||
|
||||
private:
|
||||
char fmt1[32], fmt2[32], fmt3[32], fmt4[32];
|
||||
// buffers shared by the following functions
|
||||
int max_len1, max_len2, max_len3;
|
||||
void overview_sum (int &maxlen);
|
||||
void overview_dump (int exp_idx, int &maxlen);
|
||||
void overview_summary (Ovw_data *ovw_data, int &maxlen);
|
||||
void overview_item (Ovw_data::Ovw_item *ovw_item,
|
||||
Ovw_data::Ovw_item *ovw_item_labels);
|
||||
void overview_value (Value *value, ValueTag value_tag,
|
||||
double total_value);
|
||||
void overview_value (Value *value, ValueTag value_tag, double total_value);
|
||||
void statistics_sum (int &maxlen);
|
||||
void statistics_dump (int exp_idx, int &maxlen);
|
||||
void statistics_item (Stats_data *stats_data);
|
||||
@ -252,11 +247,6 @@ void print_load_object (FILE *out_file);
|
||||
void print_header (Experiment *exp, FILE *out_file);
|
||||
|
||||
// Print Function metrics
|
||||
void get_width (Hist_data *data, MetricList *metrics_list,
|
||||
Metric::HistMetric *hist_metric);
|
||||
void get_format (char **fmt_int, char **fmt_real0, char **fmt_real1,
|
||||
MetricList *metrics_list, Metric::HistMetric *hist_metric,
|
||||
int nspace);
|
||||
int print_label (FILE *out_file, MetricList *metrics_list,
|
||||
Metric::HistMetric *hist_metric, int space);
|
||||
void print_anno_file (char *name, const char *sel, const char *srcFile,
|
||||
|
@ -789,6 +789,12 @@ Experiment::process_seg_unmap_cmd (char */*cmd*/, hrtime_t ts, Vaddr vaddr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
strstarts (const char *var, const char *x)
|
||||
{
|
||||
return strncmp (var, x, strlen (x)) == 0;
|
||||
}
|
||||
|
||||
int
|
||||
Experiment::process_Linux_kernel_cmd (hrtime_t ts)
|
||||
{
|
||||
@ -815,10 +821,6 @@ Experiment::process_Linux_kernel_cmd (hrtime_t ts)
|
||||
* but again Analyzer handles the case of not finding the file or not reading DWARF from it.
|
||||
*/
|
||||
mod->set_file_name (dbe_strdup ("LinuxKernel"));
|
||||
char last_mod_name[256];
|
||||
last_mod_name[0] = '\0';
|
||||
size_t line_n = 0;
|
||||
char *line = NULL;
|
||||
char kallmodsyms_copy[MAXPATHLEN];
|
||||
snprintf (kallmodsyms_copy, sizeof (kallmodsyms_copy), "%s/kallmodsyms",
|
||||
expt_name);
|
||||
@ -834,6 +836,8 @@ Experiment::process_Linux_kernel_cmd (hrtime_t ts)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t line_n = 0;
|
||||
char *line = NULL;
|
||||
while (getline (&line, &line_n, fd) > 0)
|
||||
{
|
||||
long long unsigned sym_addr;
|
||||
@ -851,9 +855,6 @@ Experiment::process_Linux_kernel_cmd (hrtime_t ts)
|
||||
if (strcmp (mod_name, "ctf") == 0)
|
||||
strcpy (mod_name, "shared_ctf");
|
||||
|
||||
char *mod_name_ptr;
|
||||
int skip;
|
||||
#define strstarts(var, x) (strncmp(var, x, strlen (x)) == 0)
|
||||
if (strcmp (sym_name, "__per_cpu_start") == 0
|
||||
|| strcmp (sym_name, "__per_cpu_end") == 0
|
||||
|| strstarts (sym_name, "__crc_")
|
||||
@ -878,24 +879,14 @@ Experiment::process_Linux_kernel_cmd (hrtime_t ts)
|
||||
|| strstarts (sym_name, "__dtrace_probe_")
|
||||
|| (strstr (sym_name, ".") != NULL
|
||||
&& strstr (sym_name, ".clone.") == NULL))
|
||||
{
|
||||
mod_name_ptr = last_mod_name;
|
||||
skip = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mod_name_ptr = mod_name;
|
||||
skip = 0;
|
||||
}
|
||||
#undef strstarts
|
||||
continue;
|
||||
|
||||
if (sym_text && skip == 0)
|
||||
if (sym_text)
|
||||
{
|
||||
char fname[128];
|
||||
snprintf (fname, sizeof (fname), "%s`%s", mod_name_ptr, sym_name);
|
||||
snprintf (fname, sizeof (fname), "%s`%s", mod_name, sym_name);
|
||||
Function *func = dbeSession->createFunction ();
|
||||
func->set_name (fname);
|
||||
// func->flags |= FUNC_FLAG_???; // XXX
|
||||
func->size = sym_size;
|
||||
func->img_offset = sym_addr;
|
||||
func->module = mod;
|
||||
@ -906,11 +897,10 @@ Experiment::process_Linux_kernel_cmd (hrtime_t ts)
|
||||
if (lo_max < sym_addr + sym_size)
|
||||
lo_max = sym_addr + sym_size;
|
||||
}
|
||||
sprintf (last_mod_name, mod_name_ptr);
|
||||
}
|
||||
fclose (fd);
|
||||
free (line);
|
||||
}
|
||||
free (line);
|
||||
lo->size = lo_max;
|
||||
lo->functions->sort (func_cmp);
|
||||
mod->functions->sort (func_cmp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user