Skip to content
Snippets Groups Projects
  • Andrew Burgess's avatar
    0a9ccb9d
    gdb: only allow one of thread or task on breakpoints or watchpoints · 0a9ccb9d
    Andrew Burgess authored
    After this mailing list posting:
    
      https://sourceware.org/pipermail/gdb-patches/2023-February/196607.html
    
    
    
    it seems to me that in practice an Ada task maps 1:1 with a GDB
    thread, and so it doesn't really make sense to allow uses to give both
    a thread and a task within a single breakpoint or watchpoint
    condition.
    
    This commit updates GDB so that the user will get an error if both
    are specified.
    
    I've added new tests to cover the CLI as well as the Python and Guile
    APIs.  For the Python and Guile testing, as far as I can tell, this
    was the first testing for this corner of the APIs, so I ended up
    adding more than just a single test.
    
    For documentation I've added a NEWS entry, but I've not added anything
    to the docs themselves.  Currently we document the commands with a
    thread-id or task-id as distinct command, e.g.:
    
      'break LOCSPEC task TASKNO'
      'break LOCSPEC task TASKNO if ...'
      'break LOCSPEC thread THREAD-ID'
      'break LOCSPEC thread THREAD-ID if ...'
    
    As such, I don't believe there is any indication that combining 'task'
    and 'thread' would be expected to work; it seems clear to me in the
    above that those four options are all distinct commands.
    
    I think the NEWS entry is enough that if someone is combining these
    keywords (it's not clear what the expected behaviour would be in this
    case) then they can figure out that this was a deliberate change in
    GDB, but for a new user, the manual doesn't suggest combining them is
    OK, and any future attempt to combine them will give an error.
    
    Approved-By: default avatarPedro Alves <pedro@palves.net>
    0a9ccb9d
    History
    gdb: only allow one of thread or task on breakpoints or watchpoints
    Andrew Burgess authored
    After this mailing list posting:
    
      https://sourceware.org/pipermail/gdb-patches/2023-February/196607.html
    
    
    
    it seems to me that in practice an Ada task maps 1:1 with a GDB
    thread, and so it doesn't really make sense to allow uses to give both
    a thread and a task within a single breakpoint or watchpoint
    condition.
    
    This commit updates GDB so that the user will get an error if both
    are specified.
    
    I've added new tests to cover the CLI as well as the Python and Guile
    APIs.  For the Python and Guile testing, as far as I can tell, this
    was the first testing for this corner of the APIs, so I ended up
    adding more than just a single test.
    
    For documentation I've added a NEWS entry, but I've not added anything
    to the docs themselves.  Currently we document the commands with a
    thread-id or task-id as distinct command, e.g.:
    
      'break LOCSPEC task TASKNO'
      'break LOCSPEC task TASKNO if ...'
      'break LOCSPEC thread THREAD-ID'
      'break LOCSPEC thread THREAD-ID if ...'
    
    As such, I don't believe there is any indication that combining 'task'
    and 'thread' would be expected to work; it seems clear to me in the
    above that those four options are all distinct commands.
    
    I think the NEWS entry is enough that if someone is combining these
    keywords (it's not clear what the expected behaviour would be in this
    case) then they can figure out that this was a deliberate change in
    GDB, but for a new user, the manual doesn't suggest combining them is
    OK, and any future attempt to combine them will give an error.
    
    Approved-By: default avatarPedro Alves <pedro@palves.net>