all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* running gdb as root under emacs (24)
@ 2018-01-10 16:53 stefan.puiu
  2018-01-11  9:20 ` Michael Albinus
       [not found] ` <mailman.7194.1515662450.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: stefan.puiu @ 2018-01-10 16:53 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, 

I'm working on a project that needs to run as root and was wondering if there is a way to run gdb as root from emacs. Simply trying 'M-x gdb' and then 'sudo gdb ...' does not seem to work. While googling, I found that you can use tramp to run certain commands as root (https://groups.google.com/forum/#!topic/gnu.emacs.help/fXxnXc3v-pM), so based on that I tried 'M-:' and then something like this: 

(with-temp-buffer
  (cd "/sudo::/")
  (shell-command "gdb -q"))

This doesn't seem to work interactively, however - I get a buffer that simply has "(gdb) quit" as the output and then there are some weird characters in the minibuffer. 

What would be a workable approach to achieve this? I'm using emacs24 on Ubuntu 16.04 (though I don't mind upgrading if that's what it takes). 

Thanks,
Stefan.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: running gdb as root under emacs (24)
  2018-01-10 16:53 running gdb as root under emacs (24) stefan.puiu
@ 2018-01-11  9:20 ` Michael Albinus
       [not found] ` <mailman.7194.1515662450.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Albinus @ 2018-01-11  9:20 UTC (permalink / raw)
  To: stefan.puiu; +Cc: help-gnu-emacs

stefan.puiu@gmail.com writes:

> Hi, 

Hi,

> What would be a workable approach to achieve this? I'm using emacs24
> on Ubuntu 16.04 (though I don't mind upgrading if that's what it
> takes).

Call "M-x gdb" from a buffer, which has a default-directory somewhere at
"/sudo::". I'm not sure whether it works with Emacs 24, but it is worth
a try.

> Thanks,
> Stefan.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: running gdb as root under emacs (24)
       [not found] ` <mailman.7194.1515662450.27995.help-gnu-emacs@gnu.org>
@ 2018-01-11 13:47   ` stefan.puiu
  2018-01-11 14:56     ` stefan.puiu
  0 siblings, 1 reply; 5+ messages in thread
From: stefan.puiu @ 2018-01-11 13:47 UTC (permalink / raw)
  To: help-gnu-emacs


Hi Michael,

> Call "M-x gdb" from a buffer, which has a default-directory somewhere at
> "/sudo::". I'm not sure whether it works with Emacs 24, but it is worth
> a try.

Thanks for the suggestion. 
I've tried this - opened up a C file from my project in emacs, then 'M-x cd' and used '/sudo::/'. I see a '@' next to the file name in the grey bar below, and if I hover over it it says 'Current directory is: remote:/sudo...'. However, running 'M-x gdb' results in gdb running as my user. Am I missing something, or was this what you suggested? 

I tried this only on Emacs 24, the one that comes with Ubuntu. I can try a newer version, just to make sure. 

Thanks,
Stefan.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: running gdb as root under emacs (24)
  2018-01-11 13:47   ` stefan.puiu
@ 2018-01-11 14:56     ` stefan.puiu
  2018-01-12  7:45       ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: stefan.puiu @ 2018-01-11 14:56 UTC (permalink / raw)
  To: help-gnu-emacs

> I tried this only on Emacs 24, the one that comes with Ubuntu. I can try a newer version, just to make sure. 

Hey, what do you know, this actually works on emacs 25! It asks for my password twice (once when setting the current directory, once when starting gdb), but otherwise, works OK! Thanks a lot! 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: running gdb as root under emacs (24)
  2018-01-11 14:56     ` stefan.puiu
@ 2018-01-12  7:45       ` Michael Albinus
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Albinus @ 2018-01-12  7:45 UTC (permalink / raw)
  To: stefan.puiu; +Cc: help-gnu-emacs

stefan.puiu@gmail.com writes:

> Hey, what do you know, this actually works on emacs 25! It asks for my
> password twice (once when setting the current directory, once when
> starting gdb), but otherwise, works OK! Thanks a lot!

That's why I said I don't know the situation with Emacs 24. There were
some changes, but I didn't remember when they've arrived Emacs.

The password requests could be minimized, check the Tramp manual about.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-12  7:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 16:53 running gdb as root under emacs (24) stefan.puiu
2018-01-11  9:20 ` Michael Albinus
     [not found] ` <mailman.7194.1515662450.27995.help-gnu-emacs@gnu.org>
2018-01-11 13:47   ` stefan.puiu
2018-01-11 14:56     ` stefan.puiu
2018-01-12  7:45       ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.