Index: rtl/inc/lnfodwrf.pp
===================================================================
--- rtl/inc/lnfodwrf.pp	(revision 14167)
+++ rtl/inc/lnfodwrf.pp	(working copy)
@@ -53,9 +53,13 @@
 type
   Bool8 = ByteBool;
 
+const
+  EBUF_SIZE = 100;
 var
   { the input file to read DWARF debug info from, i.e. paramstr(0) }
   e : TExeFile;
+  EBuf: Array [0..EBUF_SIZE-1] of Byte;
+  EBufCnt, EBufPos: Integer;
   DwarfErr : boolean;
   { the offset and size of the DWARF debug_line section in the file }
   DwarfOffset : longint;
@@ -177,6 +181,8 @@
   limit := aLimit;
   Init := (aBase + limit) <= e.size;
   seek(e.f, base);
+  EBufCnt := 0;
+  EBufPos := 0;
   index := 0;
 end;
 
@@ -196,39 +202,69 @@
 begin
   index := newIndex;
   system.seek(e.f, base + index);
+  EBufCnt := 0;
+  EBufPos := 0;
 end;
 
 
 { Returns the next Byte from the input stream, or -1 if there has been
   an error }
-function ReadNext() : Longint;
+function ReadNext() : Longint; inline;
 var
   bytesread : SizeInt;
   b : Byte;
 begin
   ReadNext := -1;
-  if (index < limit) then begin
-    blockread(e.f, b, 1, bytesread);
-    ReadNext := b;
+  if EBufPos >= EBufCnt then begin
+    EBufPos := 0;
+    EBufCnt := EBUF_SIZE;
+    if EBufCnt > limit - index then
+      EBufCnt := limit - index;
+    blockread(e.f, EBuf, EBufCnt, bytesread);
+    EBufCnt := bytesread;
+  end;
+  if EBufPos < EBufCnt then begin
+    ReadNext := EBuf[EBufPos];
+    inc(EBufPos);
     inc(index);
-  end;
-  if (bytesread <> 1) then
+  end
+  else
     ReadNext := -1;
 end;
 
 { Reads the next size bytes into dest. Returns true if successful,
   false otherwise. Note that dest may be partially overwritten after
   returning false. }
-function ReadNext(var dest; size : SizeInt) : Boolean;
+function ReadNext(var dest; size : SizeInt) : Boolean; inline;
 var
-  bytesread : SizeInt;
+  bytesread, totalread : SizeInt;
+  r: Boolean;
+  d: PByte;
 begin
-  bytesread := 0;
-  if ((index + size) < limit) then begin
-    blockread(e.f, dest, size, bytesread);
-    inc(index, size);
+  d := @dest;
+  totalread := 0;
+  r := True;
+  while (totalread < size) and r do begin;
+    if EBufPos >= EBufCnt then begin
+      EBufPos := 0;
+      EBufCnt := EBUF_SIZE;
+      if EBufCnt > limit - index then
+        EBufCnt := limit - index;
+      blockread(e.f, EBuf, EBufCnt, bytesread);
+      EBufCnt := bytesread;
+      if bytesread <= 0 then
+        r := False;
+    end;
+    if EBufPos < EBufCnt then begin
+      bytesread := EBufCnt - EBufPos;
+      if bytesread > size then bytesread := size;
+      System.Move(EBuf[EBufPos], d[totalread], bytesread);
+      inc(EBufPos, bytesread);
+      inc(index, bytesread);
+      inc(totalread, bytesread);
+    end;
   end;
-  ReadNext := (bytesread = size);
+  ReadNext := r;
 end;
 
 
