diff -upr .pc/symdb_enhance_libcpp/libcpp/lex.c libcpp/lex.c
--- .pc/symdb_enhance_libcpp/libcpp/lex.c    2011-12-08 06:05:59.000000000 +0800
+++ libcpp/lex.c    2012-05-25 14:56:56.747508973 +0800
@@ -51,7 +51,8 @@ static const struct token_spelling token
 #define TOKEN_SPELL(token) (token_spellings[(token)->type].category)
 #define TOKEN_NAME(token) (token_spellings[(token)->type].name)

-static void add_line_note (cpp_buffer *, const uchar *, unsigned int);
+static void add_line_note (cpp_buffer *, const uchar *, unsigned int,
+               const uchar *);
 static int skip_line_comment (cpp_reader *);
 static void skip_whitespace (cpp_reader *, cppchar_t);
 static void lex_string (cpp_reader *, cpp_token *, const uchar *);
@@ -82,7 +83,8 @@ cpp_ideq (const cpp_token *token, const
 /* Record a note TYPE at byte POS into the current cleaned logical
    line.  */
 static void
-add_line_note (cpp_buffer *buffer, const uchar *pos, unsigned int type)
+add_line_note (cpp_buffer *buffer, const uchar *pos, unsigned int type,
+           const uchar * offset)
 {
   if (buffer->notes_used == buffer->notes_cap)
     {
@@ -93,6 +95,7 @@ add_line_note (cpp_buffer *buffer, const

   buffer->notes[buffer->notes_used].pos = pos;
   buffer->notes[buffer->notes_used].type = type;
+  buffer->notes[buffer->notes_used].adjust_offset = offset;
   buffer->notes_used++;
 }

@@ -689,7 +692,7 @@ _cpp_clean_line (cpp_reader *pfile)
         {
           /* Have a trigraph.  We may or may not have to convert
              it.  Add a line note regardless, for -Wtrigraphs.  */
-          add_line_note (buffer, s, s[2]);
+          add_line_note (buffer, s, s[2], 0);
           if (CPP_OPTION (pfile, trigraphs))
             {
               /* We do, and that means we have to switch to the
@@ -734,7 +737,7 @@ _cpp_clean_line (cpp_reader *pfile)

       /* Have an escaped newline; process it and proceed to
      the slow path.  */
-      add_line_note (buffer, p - 1, p != d ? ' ' : '\\');
+      add_line_note (buffer, p - 1, p != d ? ' ' : '\\', s + 1);
       d = p - 2;
       buffer->next_line = p - 1;

@@ -759,14 +762,14 @@ _cpp_clean_line (cpp_reader *pfile)
           if (p == buffer->next_line || p[-1] != '\\')
         break;

-          add_line_note (buffer, p - 1, p != d ? ' ': '\\');
+          add_line_note (buffer, p - 1, p != d ? ' ': '\\', s + 1);
           d = p - 2;
           buffer->next_line = p - 1;
         }
       else if (c == '?' && s[1] == '?' && _cpp_trigraph_map[s[2]])
         {
           /* Add a note regardless, for the benefit of -Wtrigraphs.  */
-          add_line_note (buffer, d, s[2]);
+          add_line_note (buffer, d, s[2], 0);
           if (CPP_OPTION (pfile, trigraphs))
         {
           *d = _cpp_trigraph_map[s[2]];
@@ -789,7 +792,7 @@ _cpp_clean_line (cpp_reader *pfile)
  done:
   *d = '\n';
   /* A sentinel note that should never be processed.  */
-  add_line_note (buffer, d + 1, '\n');
+  add_line_note (buffer, d + 1, '\n', s + 1);
   buffer->next_line = s + 1;
 }

@@ -1886,6 +1889,8 @@ _cpp_lex_token (cpp_reader *pfile)
          handles the directive as normal.  */
           && pfile->state.parsing_args != 1)
         {
+          if (pfile->cb.start_directive)
+        pfile->cb.start_directive (pfile, result);
           if (_cpp_handle_directive (pfile, result->flags & PREV_WHITE))
         {
           if (pfile->directive_result.type == CPP_PADDING)
@@ -2032,6 +2037,17 @@ _cpp_lex_direct (cpp_reader *pfile)
       _cpp_process_line_notes (pfile, false);
       result->src_loc = pfile->line_table->highest_line;
     }
+  if (buffer->cur_note != 0)
+    {
+      int index = buffer->cur_note - 1;
+      result->file_offset = buffer->cur - buffer->buf;
+      result->file_offset +=
+    buffer->notes[index].adjust_offset - buffer->notes[index].pos;
+    }
+  else
+    {
+      result->file_offset = buffer->cur - buffer->buf;
+    }
   c = *buffer->cur++;

   if (pfile->forced_token_location_p)
@@ -2346,6 +2362,8 @@ _cpp_lex_direct (cpp_reader *pfile)
       break;
     }

+  if (pfile->cb.directive_token)
+    pfile->cb.directive_token (pfile, result);
   return result;
 }

