This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: Response to gdb multithreaded breakpoints' problem



On 11 May 2014 07:27, Luis Machado<lgustavo@codesourcery.com
<mailto:lgustavo@codesourcery.com>>wrote:

    On 05/10/2014 06:56 PM, Sofia wrote:

        I'm writing my GDB stub and trying to set breakpoints on
        different threads.
        When I don't ask GDB about the number of threads, It works fine
        as a single-
        threaded application and breakpoints are set correctly. But when
        I enter -
        'info threads', something strange happens.

        Firstly, GDB reads the contents of all threads' registers(it's
        OK). Then I
        enter 'continue' and see that breakpoints are not set at all
        threads my
        program has. I don't understand why, but the packet
        Z0(breakpoint packet) is
        only sent to inactive thread. The documentation says that if the
        thread id is
        not specified, breakpoints will be set at all threads. What's
        wrong with this
        or where can I read about such GDB behavior?




    Is this a software breakpoint (Z0/z0) or a hardware breakpoint we
    are talking about?

    A software breakpoint should be valid for all threads if the threads
    are executing a shared piece of code. If these breakpoints are not
    triggering, we may have a bug somewhere.

    For hardware breakpoints, the target code (in this case, the remote
    stub) is responsible for replicating the hardware breakpoint
    settings (register contents) to all threads upon their creation.

    What version of GDB are you using?


No, It's a software breakpoint. I set it as [b *addr].

My gdb-multiarch version is GNU gdb (Ubuntu 7.7-0ubuntu3) 7.7

How is breakpoints' setting implemented in gdb? I expect gdb to switch
between all currently active threads and send (Z0, addr) packet to all
of them. And it definitely doesn't do what I expect. So, how gdb should
behave in such cases?


I attach my logs(packets and responses of gdbstub and gdb-client), maybe
they will better explain what is going on.
I divided it into several parts for easier navigation.

1.  INITIALIZATION
2.  AFTER INFO THREADS COMMAND
3. CONTINUE
4.  CTRL+C IN GDB
5. b *0xbff77660
6. CONTINUE AFTER BREAKPOINT SETTING

Thank you.

--
Sincerely, Sophia Rodina
rodina@parallels.mipt.ru




Attachment: output.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]