public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/26840] New: Watchpoint for unassociated pointer in large C++/Fortran program fails
@ 2020-11-04 12:48 thomas.mitterfellner at gmail dot com
  0 siblings, 0 replies; only message in thread
From: thomas.mitterfellner at gmail dot com @ 2020-11-04 12:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26840

            Bug ID: 26840
           Summary: Watchpoint for unassociated pointer in large
                    C++/Fortran program fails
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: thomas.mitterfellner at gmail dot com
  Target Milestone: ---

I'm trying to set a hardware watchpoint in Fortran code to an unassociated
pointer to an array of a derived type in order to catch when it is allocated.
While this works as expected in my simple test program (see below), it fails in
my actual program which is a C++ main and loads a shared object with the actual
Fortran code I want to debug.
When I do watch s_struct%ps_substruct I get an unsuspicious "Hardware
watchpoint 2: s_struct%ps_substruct. But when I continue, I get:

Continuing.
Warning:
Could not insert hardware watchpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

Command aborted.

Unfortunately, I was not able to reproduce the behavior with a minimal example. 
 The actual program is large and complex, some details:

1) the containing type T_STRUCT is ~18 kB, and contains 
1 fixed size integer array dimension(82)
5 different derived type members ~3 kB each, e.g. TYPE(<x>) :: s_<x>
45 derived type array pointers, e.g. TYPE(T<n>), DIMENSION(:), POINTER :: s_<n>

2) the T_SUBSTRUCT in question to be allocated is ~162 kB, the rest of the
pointers' types to be allocated are ~16.5 kB±47 kB with the maximum type size 

I'll try hard to provide more information you may need to elucidate the cause
of the problem but I'd need instructions what is required.

MODULE mod_test
  TYPE :: T_SUBSTRUCT
     INTEGER :: someint = 0
     INTEGER :: someint1 = 0
     CHARACTER(10) :: somechararray(2,2)
  END TYPE
  TYPE :: T_STRUCT
     INTEGER :: someint = 0
     INTEGER :: someint1 = 0
     CHARACTER(1000) :: somechararray(200,20)
     TYPE(T_SUBSTRUCT), DIMENSION(:), POINTER => NULL() :: ps_substruct
  END TYPE
END MODULE mod_test

PROGRAM testprog
  USE mod_test
  IMPLICIT NONE

  TYPE(T_STRUCT):: s_struct

  s_struct%someint = 1
  s_struct%someint1 = 2

  ALLOCATE(s_struct%ps_substruct(4))

  s_struct%ps_substruct(1)%someint = 3
  WRITE(*,*) s_struct%someint, s_struct%ps_substruct(1)%someint
END PROGRAM testprog

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-04 12:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 12:48 [Bug breakpoints/26840] New: Watchpoint for unassociated pointer in large C++/Fortran program fails thomas.mitterfellner at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).