<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Hans,<div><br></div><div>Thank you for your hint. It's a good direction to look at. I started looking at your code I discovered the shell command <i>mkfifo</i>. It will be of a great help.</div><div><br></div><div>I'm using <i>mkfifo</i> to create a pipe cmd file (let's say <i>/tmp/tm_gdb_in</i>) from which GDB gets the commands to execute (-x option). And I use a <i>open("/tmp/tm_gdb_in", "r+") { |toGdb| toGdb.puts("bt") }</i>. But as GDB quits when it reaches the end of the command file , GDB quits when the IO is closed. So, to avoid that it seems that I have the use a little trick to cheat GDB. I have to create a Ruby thread opening the fifo <i>/tmp/tm_gdb_in</i> and an other fifo (let's say <i>/tmp/tm_gdb_multiple_in</i>) and running in loop to just get from /tmp/tm_gdb_multiple_in to put it in <span class="Apple-style-span" style="font-style: italic; ">/tmp/tm_gdb_in</span>. In this case, the file <span class="Apple-style-span" style="font-style: italic; ">/tmp/tm_gdb_in</span> is never closed, but the file <span class="Apple-style-span" style="font-style: italic; ">/tmp/tm_gdb_multiple_in</span> can be closed without finishing GDB.</div><div><br></div><div>Have you had to do such an inelegant thing?</div><div><br></div><div>About the parsing of GDB output, I agree it will not be easy, but I'll try to handle that. It will force me to use regular expression extensively. ;-)</div><div><br></div><div>I will try to set this up progressively and explain my method, it might help someone one day.</div><div><br></div><div><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div><div><div><div><div>Best regards,</div><div>Mathieu</div><div><br></div><div>___________________________________________</div><div><br></div><div>Mathieu Godart</div><div><br></div><div>Skype: mathieu_godart</div><div>MSN: <a href="mailto:mathieu_godart@hotmail.com">mathieu_godart@hotmail.com</a></div><div><br></div><div><div>ASIC Integration Manager</div><div>Coolsand Technologies</div></div><div>___________________________________________</div><div><br></div></div></div></div></div></div></div></div></span></div></span></div></span><br class="Apple-interchange-newline"> </div><br><div><div>Le 25 mars 09 à 17:39, Hans-Jörg Bibiko a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On 25.03.2009, at 17:06, Mathieu Godart wrote:<br><br><blockquote type="cite">I'm still thinking on how to implement this debugger wrapper.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">To do so, I would need to create a thread in which GDB would be<br></blockquote><blockquote type="cite">running. Ok, this is easy, but the tricky part is that I need to keep<br></blockquote><blockquote type="cite">track of this thread (of its STD IOs, in fact) and I need this thread<br></blockquote><blockquote type="cite">not to be killed when the TM command execution is done. And when a new<br></blockquote><blockquote type="cite">command needs to be sent to GDB, I would need to send it to the STDIN<br></blockquote><blockquote type="cite">of the thread and read back its STDOUT.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Does someone have a hint for that? Or a bundle doing that where I<br></blockquote><blockquote type="cite">could have a look?<br></blockquote><br>Hmm, I do not know whether my hint could help because I have no  <br>exhausted experiences of using gdb.<br><br>I wrote the bundle "R Console (Rdaemon)" <a href="http://svn.textmate.org/trunk/Bundles/R%20Console%20(Rdaemon).tmbundle">http://svn.textmate.org/trunk/Bundles/R%20Console%20(Rdaemon).tmbundle</a> <br>  which allows to run a Terminal process (here R) inside of a TM doc.  <br>This is done by spawning that process to an hidden terminal (pseudo- <br>terminal). This works because R has a (relatively) fixed prompt '> '.<br><br>[in short words how it works]<br>If the R process was started it prompts '> ' to signalise please enter  <br>a task. In the TM doc I can type 'sqrt(2)' and press ↩. ↩ is bound  <br>to a script which sends the task 'sqrt(2)' to a named pipe which is  <br>linked to the input of the R process. Then this script waits for the  <br>output of the R process until R returns '> '. After having the prompt  <br>this script takes the delta of R's output file and inserts it as  <br>snippet into the current TM doc.<br><br>gdb also has a prompt '(gdb) '. OK. But the tricky part with gdb would  <br>be to get rid of, amongst others, prompted questions like:<br><br>The program being debugged has been started already.<br>Start it from the beginning? (y or n)<br><br>Here I do not know a way how to detect from a script that gdb is  <br>expecting something from the user. Maybe a solution would be to use  <br>the tm_interactive_input.dylib stuff. In R I got rid of it by  <br>overwriting e.g. the readline function (i.e. by using DIALOG).<br><br>I tested that approach also with 'irb' and basically it works.<br><br>But I guess this could become a very stony way.<br><br><br>--Hans<br><br>_______________________________________________<br>textmate mailing list<br><a href="mailto:textmate@lists.macromates.com">textmate@lists.macromates.com</a><br>http://lists.macromates.com/listinfo/textmate<br></div></blockquote></div><br></div></body></html>