diff -ur gdb-5.3/gdb/annotate.c gdb-5.3.N/gdb/annotate.c --- gdb-5.3/gdb/annotate.c Tue Mar 6 09:21:05 2001 +++ gdb-5.3.N/gdb/annotate.c Sun Mar 23 13:52:10 2003 @@ -42,6 +42,7 @@ void (*annotate_exited_hook) (void); static int ignore_count_changed = 0; +char *annotation_format = "\032\032%f:%l:%c:%m:%a\n"; static void print_value_flags (struct type *t) @@ -415,16 +416,48 @@ void annotate_source (char *filename, int line, int character, int mid, CORE_ADDR pc) { - if (annotation_level > 1) + if (annotation_level > 1) { printf_filtered ("\n\032\032source "); - else - printf_filtered ("\032\032"); - - printf_filtered ("%s:%d:%d:%s:0x", filename, - line, character, - mid ? "middle" : "beg"); - print_address_numeric (pc, 0, gdb_stdout); - printf_filtered ("\n"); + printf_filtered ("%s:%d:%d:%s:0x", filename, + line, character, + mid ? "middle" : "beg"); + print_address_numeric (pc, 0, gdb_stdout); + printf_filtered ("\n"); + } else { + char *p; + for (p = annotation_format; *p; p++) { + if (*p == '%') + switch (*++p) { + case 'a': + puts_filtered("0x"); + print_address_numeric(pc, 0, gdb_stdout); + break; + case 'f': + puts_filtered(filename); + break; + case 'l': + printf_filtered("%d", line); + break; + case 'c': + printf_filtered("%d", character); + break; + case '%': + putchar_filtered('%'); + break; + case '\0': + putchar_filtered('%'); + return; + case 'm': + puts_filtered(mid ? "middle" : "beg"); + break; + default: + putchar_filtered('%'); + putchar_filtered(*p); + } + else + putchar_filtered(*p); + } + } } void diff -ur gdb-5.3/gdb/defs.h gdb-5.3.N/gdb/defs.h --- gdb-5.3/gdb/defs.h Thu Aug 1 19:18:32 2002 +++ gdb-5.3.N/gdb/defs.h Sun Mar 23 12:00:28 2003 @@ -397,6 +397,7 @@ /* Annotation stuff. */ +extern char* annotation_format; extern int annotation_level; /* in stack.c */ extern void begin_line (void); diff -ur gdb-5.3/gdb/main.c gdb-5.3.N/gdb/main.c --- gdb-5.3/gdb/main.c Sat Sep 28 17:10:31 2002 +++ gdb-5.3.N/gdb/main.c Sun Mar 23 13:01:37 2003 @@ -233,6 +233,8 @@ emacses which use --fullname. */ {"fullname", no_argument, 0, 'f'}, {"f", no_argument, 0, 'f'}, + {"annotation-format", required_argument, 0, 'F'}, + {"F", required_argument, 0, 'F'}, {"annotate", required_argument, 0, 12}, {"help", no_argument, &print_help, 1}, @@ -314,6 +316,9 @@ annotation_level = 1; /* We have probably been invoked from emacs. Disable window interface. */ use_windows = 0; + break; + case 'F': + annotation_format = optarg; break; case 's': symarg = optarg;