disassembling syscalls
How can syscalls be disassembled on BSD? So far, I tried using ktrace -tc on compiled code using the syscall I wanted, but the output from kdump doesn't look like asm. I also tried using gdb directly, compiling the source with the -g and -static flags, but I couldn't use the disassemble command on the syscall which appeared in the output of 'disassemble main'. Any suggestions would be greatly appreciated, Marc To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
No Subject
Hi all, I'm writing a server that multiplexes a MySQL connection to several clients. Since the connection has to be shared, I can't fork(), I have to thread. This isn't a problem, except that when I accept() and assign a socket descriptor, the first thread runs fine, but the next thread simply grabs the descriptor (since it's shared) from the previous thread and starts doing all its writing to that socket. Any idea how to get around this? If there's any good example code, please let me know. Thanks, Rob -- [EMAIL PROTECTED] http://ota.pernet.net/ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: disassembling syscalls
[removing -questions; this is a technical question] On Friday, 26 November 1999 at 13:51:50 -0500, Marc Tardif wrote: How can syscalls be disassembled on BSD? So far, I tried using ktrace -tc on compiled code using the syscall I wanted, but the output from kdump doesn't look like asm. I also tried using gdb directly, compiling the source with the -g and -static flags, but I couldn't use the disassemble command on the syscall which appeared in the output of 'disassemble main'. I'm not sure what you want to do here. Use a debugger for disassembly. But what do you really want to do? And what do you mean by 'syscall'? The userland stub function, the interface, or the kernel code which implements the call? In any case, since we have the source code to all of it, it's not clear that there's much to be gained by disassembling them. Greg -- Finger [EMAIL PROTECTED] for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
PThreads and Sockets
Hi all, I'm writing a server that multiplexes a MySQL connection to several clients. Since the connection has to be shared, I can't fork(), I have to thread. This isn't a problem, except that when I accept() and assign a socket descriptor, the first thread runs fine, but the next thread simply grabs the descriptor (since it's shared) from the previous thread and starts doing all its writing to that socket. Any idea how to get around this? If there's any good example code, please let me know. Thanks, Rob -- [EMAIL PROTECTED] http://ota.pernet.net/ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: disassembling syscalls
On FreeBSD 2.2.5 (I know I should change, but it works), gcc 2.7.2.1, gdb 4.16, typing 'disassemble syscall_as_seen_in_main' I get: No function contains specified address. Using the same procedure on FreeBSD 3.3-RELEASE, gcc 2.7.2.3, gdb 4.18, I get some output which is shorter than I expected, but I'll probably have to trace through more calls and branches. By the way, how can I trace names which start with a period? they sometime appear when I type 'disassemble' followed by a tab, but typing the name with and without the period doesn't work either. On Fri, 26 Nov 1999, Ronald F. Guilmette wrote: In message [EMAIL PROTECTED], you wrote : How can syscalls be disassembled on BSD? So far, I tried using ktrace -tc on compiled code using the syscall I wanted, but the output from kdump doesn't look like asm. I also tried using gdb directly, compiling the source with the -g and -static flags, but I couldn't use the disassemble command on the syscall which appeared in the output of 'disassemble main'. GDB disassembles stuff. As far as I know, that functionality works. What do you mean when you say that you ``couldn't use the disassemble command''. Why couldn't you? (Carpal tunnel finally getting to you perhaps? :-) To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: VAIO F270, ep0 and -current
On Fri, Nov 19, 1999 at 10:40:19AM -0700, Warner Losh wrote: In message [EMAIL PROTECTED] Josef Karthauser writes: : If you can give me some clues I'll work on it. I've got zero familiarity : with the code :(. [..] Somewhere in the above, something goes wrong :-(. Maybe it is the first parenthetical statement about waiting for the spl to be lowered, which would be something like: /* *disable_slot - Disables the slot by removing *the power and unmapping the I/O */ static void real_disable_slot(struct slot *slt); static void disable_slot(struct slot *slt) { slt-poff_ch = timeout(real_disable_slot, (caddr_t) slot, 0); } static void real_disable_slot(struct slot *slt) { // guts of the old disable_slot goes here } but there may be some more complicated book keeping needed... This didn't help. Interestingly if I unplug the network card and wait a while (minutes) and then suspend it hangs, however if I _never_ put the card in in the first place susspend works fine. I believe that the suspend is a read herring, and what actually happen is that the card doesn't detatch properly. Joe -- Josef KarthauserFreeBSD: How many times have you booted today? Technical Manager Viagra for your server (http://www.uk.freebsd.org) Pavilion Internet plc. [[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: disassembling syscalls
In message [EMAIL PROTECTED], you wrote : On FreeBSD 2.2.5 (I know I should change, but it works), gcc 2.7.2.1, gdb 4.16, typing 'disassemble syscall_as_seen_in_main' I get: No function contains specified address. What the heck is "syscall_as_seen_in_main"? (Sorry if I'm ignorant, but I have no idea what that stands for.) Using the same procedure on FreeBSD 3.3-RELEASE, gcc 2.7.2.3, gdb 4.18, I get some output which is shorter than I expected, but I'll probably have to trace through more calls and branches. By the way, how can I trace names which start with a period? What do you mean by ``trace''? they sometime appear when I type 'disassemble' followed by a tab, but typing the name with and without the period doesn't work either. Symbols that begin with periods are used for various things, some of which are NOT things that you can set breakpoints on (or disassemble, or whatever). For example ELF *section names* (e.g. .text) begin with periods, but section names are not things that you can set breakpoints on. Some versions of gcc (for some targets) also create regular symbols which begin with periods, but these are just so-called ``local'' symbols. Depending upon the assembler in use, they may or may not still be known in the binary object files and/or in the final executable file. If you have loaded something into gdb and then disassembled a part of it and if you see some symbol in the disassembled code that begins with a period, then you _may_ perhaps be able to get its address by just doing: print .foo (where `.foo' is the symbol), but then again, maybe not. Actually, I think that gdb will probably not allow you to do this because its built-in expression parser only understands higher-level language syntax (e.g. for C and/or C++) and in either C or C++, the expression .foo has invalid syntax. So you may just have to find the address of whatever ``normal'' symbol most directly preceeds the symbol you care about and then figure out the distance from that symbol to the symbol you do care about. Then you can get the address of the symbol that you do care about by doing something like: print preceeding_symbol+0x7e where `0x7e' is the distance between `preceeding_symbol' and the symbol that you actually care about, e.g. `.foo'. And before you ask, yes, it *is* a bummer that the assembler accepts names (for symbols) that gdb cannot deal with, but you've got to remember that gdb is first and foremost a ``source level'' debugger (for C, C++, etc.)... not an assembly level debugger. P.S. Actually, symbols with periods probably shouldn't even be showing up in your gdb-disassembled output *or* in your object file symbol tables. If they are, then this may perhaps just be due to a small glitch in the specific versions of the FreeBSD assembler that you are using. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: PThreads and Sockets
| int sd2; | if((sd2=accept(sd, (struct sockaddr*)cad, alen)) 0) { | pthread_create(thread1, pthread_attr_default, | serverstart, sd2); | } | | Then the serverstart function: | | void *serverstart(void *ptr) | { | int *sd2; | sd2 = (int*)ptr; | | dowhatever(sd2); | } | | Any ideas as to what I'm doing wrong? Also, thanks for your help. | | Rob Try this. void *serverstart(void *ptr) { int sd2; sd2 = *((int *) ptr); ... } -- Dan Moschuk ([EMAIL PROTECTED]) "Cure for global warming: One giant heatsink and dual fans!" To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
minor nag for minor PR
http://www.freebsd.org/cgi/query-pr.cgi?pr=14239 In case someone's bored this weekend... Doug -- "Welcome to the desert of the real." - Laurence Fishburne as Morpheus, "The Matrix" To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message