Note that there are some explanatory texts on larger screens.

plurals
  1. POGDB: error setting break point in template class functions in header files
    primarykey
    data
    text
    <p>I have used two different versions of GDB, both give problems in the following code:</p> <p>Trimmed down code in <code>MyFile.h</code>:</p> <pre><code>template&lt;class T&gt; struct ABC: PQR&lt;T&gt; { void flow(PP pp) { const QX qx = XYZ&lt;Z&gt;::foo(pp); // Trying to set a breakpoint here, line no. 2533 ASSERTp(qx &gt;= last_qx()); } } </code></pre> <p>GDB 7.1:</p> <pre><code>Reading symbols from /path_to_exec/exec...done. (gdb) break MyFile.h:2533 Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x156. Note: breakpoint 1 also set at pc 0x156. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x121. Note: breakpoint 1 also set at pc 0x156. Note: breakpoint 1 also set at pc 0x156. Note: breakpoint 1 also set at pc 0x121. Breakpoint 1 at 0x44e5c4: file PacketEngine.h, line 2533. (23 locations) (gdb) run Starting program: /path_to_exec/exec -options Warning: Cannot insert breakpoint 1. Error accessing memory address 0x121: Input/output error. Cannot insert breakpoint 1. Error accessing memory address 0x156: Input/output error. </code></pre> <p><strong>Why is it trying to set 23 breakpoints for one? And further down, it is giving error on <code>run</code></strong></p> <p>GDB 6.3:</p> <pre><code> This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/tls/libthread_db.so.1". (gdb) break MyFile.h:2533 No line 2533 in file "MyFile.h". </code></pre> <p><strong>At start of the program, it doesn't even accept the breakpoint</strong> If I break in function ASSERTp, it breaks. Then. if I go "UP", and type break, it successfully inserts breakpoint (<code>break MyFile.h:2533</code>). [thus somehow it finds the file/line after the program actually runs]. <em>However</em>, despite the breakpoint being set, on rerunning the program it does not stop at line 2533 but 2534 only (breakpoint in function ASSERTp).</p> <p>My questions:</p> <p>1) Can someone please help me solve this?</p> <p>2) I have often had problems with template code and GDB. Is there any good &amp; free C++ debugger for templates?</p> <p>3) <em>Not really important, but a side question if it matters: Which version is preferable? The 7.1 seems to be more buggy, but I remember on some runs, it gives less problems.</em></p> <hr> <p>System info:</p> <pre><code>uname -a Linux ... 2.6.9-67.ELsmp #1 SMP Fri Nov 16 12:49:06 EST 2007 x86_64 x86_64 x86_64 GNU/Linux file /usr/bin/gdb #### GDB 6.3 /usr/bin/gdb: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), stripped file ~/local/bin/gdb #### GDB 7.1 /home/user/local/bin/gdb: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped file /path_to_exec/exec /path_to_exec/exec: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload