@@ -189,7 +189,7 @@ static void parse_probe_event(const char *str)
189189 /* Parse probe point */
190190 parse_probe_point (argv [0 ], pp );
191191 free (argv [0 ]);
192- if (pp -> file )
192+ if (pp -> file || pp -> line )
193193 session .need_dwarf = 1 ;
194194
195195 /* Copy arguments */
@@ -347,36 +347,24 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
347347 if (session .nr_probe == 0 )
348348 usage_with_options (probe_usage , options );
349349
350- #ifdef NO_LIBDWARF
351350 if (session .need_dwarf )
352- semantic_error ("Dwarf-analysis is not supported" );
353- #endif
354-
355- /* Synthesize probes without dwarf */
356- for (j = 0 ; j < session .nr_probe ; j ++ ) {
357- #ifndef NO_LIBDWARF
358- if (!session .probes [j ].retprobe ) {
359- session .need_dwarf = 1 ;
360- continue ;
361- }
362- #endif
363- ret = synthesize_probe_event (& session .probes [j ]);
364- if (ret == - E2BIG )
365- semantic_error ("probe point is too long." );
366- else if (ret < 0 )
367- die ("Failed to synthesize a probe point." );
368- }
369-
370- #ifndef NO_LIBDWARF
371- if (!session .need_dwarf )
372- goto setup_probes ;
351+ #ifdef NO_LIBDWARF
352+ semantic_error ("Debuginfo-analysis is not supported" );
353+ #else /* !NO_LIBDWARF */
354+ pr_info ("Some probes require debuginfo.\n" );
373355
374356 if (session .vmlinux )
375357 fd = open (session .vmlinux , O_RDONLY );
376358 else
377359 fd = open_default_vmlinux ();
378- if (fd < 0 )
379- die ("Could not open vmlinux/module file." );
360+ if (fd < 0 ) {
361+ if (session .need_dwarf )
362+ die ("Could not open vmlinux/module file." );
363+
364+ pr_warning ("Could not open vmlinux/module file."
365+ " Try to use symbols.\n" );
366+ goto end_dwarf ;
367+ }
380368
381369 /* Searching probe points */
382370 for (j = 0 ; j < session .nr_probe ; j ++ ) {
@@ -386,14 +374,34 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
386374
387375 lseek (fd , SEEK_SET , 0 );
388376 ret = find_probepoint (fd , pp );
389- if (ret <= 0 )
390- die ("No probe point found.\n" );
377+ if (ret < 0 ) {
378+ if (session .need_dwarf )
379+ die ("Could not analyze debuginfo." );
380+
381+ pr_warning ("An error occurred in debuginfo analysis. Try to use symbols.\n" );
382+ break ;
383+ }
384+ if (ret == 0 ) /* No error but failed to find probe point. */
385+ die ("No probe point found." );
391386 }
392387 close (fd );
393388
394- setup_probes :
389+ end_dwarf :
395390#endif /* !NO_LIBDWARF */
396391
392+ /* Synthesize probes without dwarf */
393+ for (j = 0 ; j < session .nr_probe ; j ++ ) {
394+ pp = & session .probes [j ];
395+ if (pp -> found ) /* This probe is already found. */
396+ continue ;
397+
398+ ret = synthesize_probe_event (pp );
399+ if (ret == - E2BIG )
400+ semantic_error ("probe point is too long." );
401+ else if (ret < 0 )
402+ die ("Failed to synthesize a probe point." );
403+ }
404+
397405 /* Settng up probe points */
398406 snprintf (buf , MAX_CMDLEN , "%s/../kprobe_events" , debugfs_path );
399407 fd = open (buf , O_WRONLY , O_APPEND );
0 commit comments