瀏覽代碼

--- Merging r24033 into '.':
U packages/gdbint/src/gdbint.pp
--- Merging r24227 into '.':
U ide/fpdebug.pas
--- Merging r24228 into '.':
U installer/install.dat
--- Merging r24230 into '.':
U rtl/go32v2/system.pp
--- Merging r24231 into '.':
U rtl/go32v2/v2prt0.as

# revisions: 24033,24227,24228,24230,24231
r24033 | pierre | 2013-03-28 14:04:54 +0100 (Thu, 28 Mar 2013) | 1 line
Changed paths:
M /trunk/packages/gdbint/src/gdbint.pp

Commit go32v2 specific fix in 2.6.0 branch rev 20576
r24227 | pierre | 2013-04-12 12:19:38 +0200 (Fri, 12 Apr 2013) | 11 lines
Changed paths:
M /trunk/ide/fpdebug.pas

Merge forgotten go32v2 2.6.0 branch changes back into trunk.
------------------------------------------------------------------------
r20575 | pierre | 2012-03-22 16:27:57 +0100 (Thu, 22 Mar 2012) | 1 line

Avoid 'Discard file' question inside reset
------------------------------------------------------------------------
r20581 | pierre | 2012-03-22 18:21:34 +0100 (Thu, 22 Mar 2012) | 1 line

* Disable iocheck when closing gdb_file
r24228 | pierre | 2013-04-12 12:21:34 +0200 (Fri, 12 Apr 2013) | 7 lines
Changed paths:
M /trunk/installer/install.dat

Merge forgotten go32v2 2.6.0 branch changes back into trunk.
------------------------------------------------------------------------
r20595 | pierre | 2012-03-23 14:45:47 +0100 (Fri, 23 Mar 2012) | 1 line

* Fix fppkg short source zip name
r24230 | pierre | 2013-04-12 12:28:40 +0200 (Fri, 12 Apr 2013) | 7 lines
Changed paths:
M /trunk/rtl/go32v2/system.pp

Merge forgotten go32v2 2.6.0 branch changes back into trunk.
------------------------------------------------------------------------
r20580 | pierre | 2012-03-22 17:52:40 +0100 (Thu, 22 Mar 2012) | 1 line

* Set __environ to envp in Setup_environment function
r24231 | pierre | 2013-04-12 12:33:06 +0200 (Fri, 12 Apr 2013) | 12 lines
Changed paths:
M /trunk/rtl/go32v2/v2prt0.as

Merge forgotten go32v2 2.6.0 branch changes back into trunk.

------------------------------------------------------------------------
r20577 | pierre | 2012-03-22 16:35:26 +0100 (Thu, 22 Mar 2012) | 4 lines

// * Provide both environ and _environ inside startup file
// to avoid loading of old or new crt1.o object from DJGPP libc.
// Not merged as this is now treated in linker script.
* Make some labels local to be able to get a complete
disassembly of start function using GDB.

git-svn-id: branches/fixes_2_6@24515 -

marco 12 年之前
父節點
當前提交
76cf0b8e75
共有 5 個文件被更改,包括 70 次插入31 次删除
  1. 21 0
      ide/fpdebug.pas
  2. 1 1
      installer/install.dat
  3. 22 6
      packages/gdbint/src/gdbint.pp
  4. 2 0
      rtl/go32v2/system.pp
  5. 24 24
      rtl/go32v2/v2prt0.as

+ 21 - 0
ide/fpdebug.pas

@@ -1090,11 +1090,16 @@ begin
 end;
 
 procedure TDebugController.Reset;
+var
+  old_reset : boolean;
 begin
   inherited Reset;
   { we need to free the executable
     if we want to recompile it }
+  old_reset:=reset_command;
+  reset_command:=true;
   SetExe('');
+  reset_command:=old_reset;
   NoSwitch:=false;
   { In case we have something that the compiler touched }
   If IDEApp.IsRunning then
@@ -3732,6 +3737,9 @@ begin
 {$endif def GDBWINDOW}
 end;
 
+const
+  Invalid_gdb_file_handle: boolean = false;
+
 
 procedure DoneDebugger;
 begin
@@ -3752,7 +3760,20 @@ begin
   If Use_gdb_file then
     begin
       Use_gdb_file:=false;
+{$IFOPT I+}
+  {$I-}
+  {$DEFINE REENABLE_I}
+{$ENDIF}
       Close(GDB_file);
+      if ioresult<>0 then
+        begin
+          { This handle seems to get lost for DJGPP
+            don't bother too much about this. }
+          Invalid_gdb_file_handle:=true;
+        end;
+{$IFDEF REENABLE_I}
+  {$I+}
+{$ENDIF}
     end;
   If IDEApp.IsRunning then
     PopStatus;

+ 1 - 1
installer/install.dat

@@ -508,7 +508,7 @@ package=units-graph.source.zip[ugrphsrc.zip],Unit Graph sources
 # Source 17
 package=units-hermes.source.zip[uhermsrc.zip],Port of Hermes graphics library
 # Source 18
-package=units-fppkg.source.zip[ufppkdos.zip],Units for FPPkg packaging support
+package=units-fppkg.source.zip[ufppksrc.zip],Units for FPPkg packaging support
 
 #
 # Source packages 2nd part

+ 22 - 6
packages/gdbint/src/gdbint.pp

@@ -3116,32 +3116,48 @@ end;
 
 {$ifdef go32v2}
 var
-  c_environ : ppchar;external name '_environ';
+  c_environ : ppchar;external name '__environ';
   c_argc : longint;external name '___crt0_argc';
   c_argv : ppchar;external name '___crt0_argv';
 
   procedure ReallocateEnvironUsingCMalloc;
 
   var
-    neededsize , count : longint;
+    neededsize , i, count : longint;
     penv : pchar;
     newenv : ppchar;
   begin
     if not assigned(c_environ) then
-      neededsize:=0
+      neededsize:=sizeof(pchar)
     else
       begin
         count:=0;
-        penv:=c_environ^;
+        penv:=c_environ[count];
         while assigned(penv) do
           begin
             inc(count);
-            inc(penv,sizeof(pchar));
+            penv:=c_environ[count];
           end;
+        inc(count);
         neededsize:=count*sizeof(pchar);
       end;
     newenv:=malloc(neededsize);
-    system.move(c_environ,newenv,neededsize);
+    system.move(c_environ^,newenv^,neededsize);
+    if assigned(c_environ) then
+      begin
+        for i:=0 to count-1 do
+          begin
+            penv:=c_environ[i];
+            if assigned(penv) then
+              begin
+                neededsize:=strlen(penv)+1;
+                newenv[i]:=malloc(neededsize);
+                system.move(penv^,newenv[i]^,neededsize);
+              end
+            else
+              newenv[i]:=nil;
+          end;
+      end;
     c_environ:=newenv;
   end;
 

+ 2 - 0
rtl/go32v2/system.pp

@@ -159,6 +159,7 @@ implementation
 
 
 var
+  c_environ : ppchar;external name '__environ';
   _args : ppchar;external name '_args';
   __stubinfo : p_stub_info;external name '__stubinfo';
   ___dos_argv0 : pchar;external name '___dos_argv0';
@@ -476,6 +477,7 @@ begin
     end;
   envp := sysgetmem((env_count+1) * sizeof(pchar));
   if (envp = nil) then HandleError (203);
+  c_environ:=envp;
   cp:=dos_env;
   env_count:=0;
   while cp^ <> #0 do

+ 24 - 24
rtl/go32v2/v2prt0.as

@@ -111,11 +111,11 @@ start:
         movw    %ds, %bx
         movw    $0x000a, %ax
         int     $0x31
-        jnc     ds_alias_ok
+        jnc     .Lds_alias_ok
         movb    $0x4c, %ah
         int     $0x21
 
-ds_alias_ok:
+.Lds_alias_ok:
         movw    %ax, ___v2prt0_ds_alias
         movl    %eax, %ebx
         movw    $0x0009, %ax
@@ -149,11 +149,11 @@ ds_alias_ok:
         shrl    $4, %ebx
         movw    $0x0100, %ax
         int     $0x31
-        jnc     dos_alloc_ok
+        jnc     .Ldos_alloc_ok
         movb    $0x4c, %ah
         int     $0x21
 
-dos_alloc_ok:
+.Ldos_alloc_ok:
         movw    %cs, 2(%esi)
 /* store API information */
         movw    %ds, 4(%esi)
@@ -234,14 +234,14 @@ dos_alloc_ok:
         .byte 0x64 /* fs: */
         movl    STUBINFO_MINSTACK, %ecx /* get stub-requested stack size */
         cmpl    %ecx, %eax
-        jge     use_stubinfo_stack_size /* use the larger of the two */
+        jge     .Luse_stubinfo_stack_size /* use the larger of the two */
         movl    %ecx, %eax
         movl    %eax, __stklen    /* store the actual stack length */
-use_stubinfo_stack_size:
+.Luse_stubinfo_stack_size:
         pushl   %eax
         call    ___sbrk          /* allocate the memory */
         cmpl    $-1, %eax
-        je      no_memory
+        je      .Lno_memory
         movl    %eax, ___djgpp_stack_limit      /* Bottom of stack */
         addl    $256,%eax
         movl    %eax,__stkbottom               /* for stack checks */
@@ -262,7 +262,7 @@ use_stubinfo_stack_size:
         call    ___prt1_startup  /* run program */
         jmp     exit
 
-no_memory:
+.Lno_memory:
         movb    $0xff, %al
         jmp     exit
 
@@ -288,11 +288,11 @@ exit:
         movw    %ax,%fs
         movw    %ax,%gs
         cmpl    $0,_exception_exit
-        jz      no_exception
+        jz      .Lno_exception
         pushl   %ecx
         call    *_exception_exit
         popl    %ecx
-no_exception:
+.Lno_exception:
         cli                          /* Just in case they didn't unhook ints */
         FREESEL operatingsystem_go32_info_block+26     /* selector for linear memory */
         FREESEL ___v2prt0_ds_alias      /* DS alias for rmcb exceptions */
@@ -360,13 +360,13 @@ ___sbrk:
         movl    __what_size_app_thinks_it_is, %eax
         movl    4(%esp), %ecx              /* Increment size */
         addl    %ecx, %eax
-        jnc     brk_common
+        jnc     .Lbrk_common
         /* Carry is only set if a negative increment or wrap happens. Negative
            increment is semi-OK, wrap (only for multiple zone sbrk) isn't. */
         test    $0x80000000, %ecx              /* Clears carry */
-        jnz     brk_common
+        jnz     .Lbrk_common
         stc                                  /* Put carry back */
-        jmp     brk_common
+        jmp     .Lbrk_common
 
         .globl  ___brk
         .align  2
@@ -374,7 +374,7 @@ ___brk:
         movl    4(%esp), %eax
         clc
 
-brk_common:
+.Lbrk_common:
         pushl   %esi
         pushl   %edi
         pushl   %ebx
@@ -386,7 +386,7 @@ brk_common:
         /* multi code is not present */
         /* jc      10f                                           Wrap for multi-zone */
         cmpl    __what_size_dpmi_thinks_we_are, %eax        /* don't bother shrinking */
-        jbe     brk_nochange
+        jbe     .Lbrk_nochange
 
         addl    $0x0000ffff, %eax                              /* round up to 64K block */
         andl    $0xffff0000, %eax
@@ -409,7 +409,7 @@ brk_common:
 
         test    %dl,%dl
         popl    %edx
-        jne     brk_error
+        jne     .Lbrk_error
 
         movl    %edi, ___djgpp_memory_handle_list              /* store new handle */
         movw    %si, ___djgpp_memory_handle_list+2
@@ -456,7 +456,7 @@ brk_common:
         movl    ___djgpp_selector_limit, %edx
 12:     incl    %edx                                        /* Size not limit */
         testb   $0x60, __crt0_startup_flags     /* include/crt0.h */
-        jz      no_fill_sbrk_memory
+        jz      .Lno_fill_sbrk_memory
         pushl   %ds
         popl    %es
 
@@ -465,26 +465,26 @@ brk_common:
         subl    %edi, %ecx                    /* Adjust count for base */
         xorl    %eax, %eax
         testb   $0x40, __crt0_startup_flags
-        jz      no_deadbeef
+        jz      .Lno_deadbeef
         movl    $0xdeadbeef, %eax              /* something really easy to spot */
-no_deadbeef:
+.Lno_deadbeef:
         shrl    $2, %ecx                        /* div 4 Longwords not bytes */
         cld
         rep
         stosl
-no_fill_sbrk_memory:
+.Lno_fill_sbrk_memory:
         movl    %edx, __what_size_dpmi_thinks_we_are
 
-brk_nochange:                              /* successful return */
+.Lbrk_nochange:                              /* successful return */
         movl    __what_we_return_to_app_as_old_size, %eax
-        jmp     brk_return
+        jmp     .Lbrk_return
 
-brk_error:                                    /* error return */
+.Lbrk_error:                                    /* error return */
         movl    __what_we_return_to_app_as_old_size, %eax
         movl    %eax, __what_size_app_thinks_it_is
         movl    $0, %eax
 
-brk_return:
+.Lbrk_return:
         popl    %ebx
         popl    %edi
         popl    %esi